LUA Functions Request

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

Post Reply
User avatar
Astal
Posts: 96
Joined: Tue Dec 09, 2008 1:35 pm

Re: LUA Functions Request

Post by Astal » Sat Dec 12, 2009 11:38 am

I just figured id throw this out there.

Ive been workin with spells a bit and found we are lacking a lot of functions from the regular game.

I was wondering if anyone was thinking of adding some functions like these below

Setting the melee critical chance
Setting the attack speed
Setting the attack damage (directly)
Setting the attack rating (chance to hit)
I DIE FREE!!

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LUA Functions Request

Post by John Adams » Wed Apr 07, 2010 11:08 pm

Scat, can you whip me up a quick LUA that will move a Player (not an NPC or Spawn) like the MovementLoopAddLocation() does? Only, not a LOOP. I'd like it to just begin, have waypoints, and an end.

I was trying to fake a griffon ride tonight and realized the code doesn't work on Player, even if you pass it a player param. Here's the simple script I tried, standing in QC on the dock by the traders outpost. I expected to shoot out over the sand:

Code: Select all

function hailed(NPC, Player)
	FaceTarget(NPC, Player)
	Say(NPC, "Off you go!")
	MoveToLocation(Player, -56.02, -6.35, 57.01)
	MoveToLocation(Player, -65.47, -6.35, 58.06)
end
I even tried taking out the IsNPC() check, and adding another if IsPlayer, still doesn't work - so I am crying for help.

Does not work:

Code: Select all

	if(spawn){
		if(spawn->IsNPC())
			((NPC*)spawn)->RunToLocation(x, y, z);
		else if(spawn->IsPlayer())
			((Player*)spawn)->RunToLocation(x, y, z);
	}
Thanks!


edit: in a desperate attempt to make you proud, I even tried writing a new LUA function myself ;) It compiles, so it must work!! Nah, it doesn't. I still have no movement.

Code:

Code: Select all

int EQ2Emu_lua_MovePlayerToLocation(lua_State* state){
	if(!lua_interface)
		return 0;
	Spawn* player = lua_interface->GetSpawn(state);
	float x = lua_interface->GetFloatValue(state, 2);
	float y = lua_interface->GetFloatValue(state, 3);
	float z = lua_interface->GetFloatValue(state, 4);
	if(player){
		if(player->IsPlayer())
			((Player*)player)->RunToLocation(x, y, z);
	}
	lua_interface->ResetFunctionStack(state);
	return 0;
}
Hey, I'm tryin....

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: LUA Functions Request

Post by Scatman » Sun Apr 11, 2010 2:43 pm

Sure. I believe there is something wrong with the MoveToLocation LUA function anyway. I'm going to start looking at the movement loop stuff so while I'm in there I'll do this too. One thing though, how exactly is this going to work? What if a player is being moved and then presses an arrow key?

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: LUA Functions Request

Post by ZexisStryfe » Sun Apr 11, 2010 3:54 pm

Arrow keys shouldn't break the movement, however the jump key should.
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LUA Functions Request

Post by John Adams » Mon Apr 12, 2010 12:00 pm

You saying I can jump off my griffon?

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: LUA Functions Request

Post by ZexisStryfe » Mon Apr 12, 2010 12:35 pm

that is exactly what i am saying... :shock:
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LUA Functions Request

Post by John Adams » Mon Apr 12, 2010 12:53 pm

When has that ever been allowed? mid ride between towers, I can jump off my griffon and land on some gnolls? I do not believe you.

User avatar
ZexisStryfe
Posts: 1026
Joined: Thu Jul 26, 2007 6:39 am
EQ2Emu Server: Sytherian Legends
Location: Connecticut
Contact:

Re: LUA Functions Request

Post by ZexisStryfe » Mon Apr 12, 2010 2:16 pm

It has always been allowed. The only zone that doesn't allow it is Timorous Deep, because it would be insta-death so it is disabled.
~ EQ2 Emulator Project Manager

Image
Image
Image
"Zexis, from this day forth, you shall be known as... '3 of 6'" - John Adams

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LUA Functions Request

Post by John Adams » Mon Apr 12, 2010 2:38 pm

I think you're lying, just so I'll try it and fall to my death!

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: LUA Functions Request

Post by Scatman » Mon Apr 12, 2010 2:42 pm

It hasn't always been allowed. Wayyy back when you could not jump off your griffon in antonica. What I meant by the how to handle player movement is that LE thought there was a specific packet(s) needed to be sent while using a controller mount. This packet would disable all movement data sent to server so it couldnt be processed. Since this is not the real thing and just a mimic of the controlled mount, did we want to try to ignore all player-initiated movement? It may be easier just to implement the real system imo.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: LUA Functions Request

Post by John Adams » Mon Apr 12, 2010 2:59 pm

Scatman wrote:It may be easier just to implement the real system imo.
Yes.

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: LUA Functions Request

Post by Scatman » Mon Apr 12, 2010 3:09 pm

After I fix the last issue with spawn movement I think I'll look into flight and see what the system is like. I need a break from these bugs. They're bugging me *cheesy drum roll*

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests