Page 9 of 9

Re: LUA Functions Request

Posted: Sat Dec 12, 2009 11:38 am
by Astal
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)

Re: LUA Functions Request

Posted: Wed Apr 07, 2010 11:08 pm
by John Adams
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....

Re: LUA Functions Request

Posted: Sun Apr 11, 2010 2:43 pm
by Scatman
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?

Re: LUA Functions Request

Posted: Sun Apr 11, 2010 3:54 pm
by ZexisStryfe
Arrow keys shouldn't break the movement, however the jump key should.

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 12:00 pm
by John Adams
You saying I can jump off my griffon?

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 12:35 pm
by ZexisStryfe
that is exactly what i am saying... :shock:

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 12:53 pm
by John Adams
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.

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 2:16 pm
by ZexisStryfe
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.

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 2:38 pm
by John Adams
I think you're lying, just so I'll try it and fall to my death!

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 2:42 pm
by Scatman
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.

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 2:59 pm
by John Adams
Scatman wrote:It may be easier just to implement the real system imo.
Yes.

Re: LUA Functions Request

Posted: Mon Apr 12, 2010 3:09 pm
by Scatman
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*