Page 1 of 1

New LUA Function: SetPlayerLevel

Posted: Tue Aug 09, 2016 5:26 pm
by Jabantiz
SetPlayerLevel()

Sets the players level, for NPC's you would still use SpawnSet()

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 11:56 am
by patrikpatrik
Hi Jabantiz,

Thanks for the 3 functions, the Addcoin() and RemoveCoin() works great but for SetPlayerLevel() I'm getting LUA SetPlayerLevel command error: new level can't be 0.

I tried SetPlayerLevel(Spawn, 50) but for some reason level thinks its still 0. In *.cpp I'm looking at line 8373

Code: Select all

if (level == 0) {
		lua_interface->LogError("LUA SetPlayerLevel command error: new level can't be 0");
		return 0;
	}
Is this the culprit?

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 3:18 pm
by Jabantiz
That is a safety check to make sure correct values are being set, the issue is where level is set

Code: Select all

int8 level = lua_interface->GetInt8Value(state, 1);
that 1 should actually be a 2

Code: Select all

int8 level = lua_interface->GetInt8Value(state, 2);
Basically I screwed up because I am so use to starting at 0 and counting up where in lua it starts at 1, sorry about that.

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 3:47 pm
by patrikpatrik
No problem, recompiled it and works fine now thanks!

Btw, just out of curiosity, is there a way to make the voiceover functions to play one after another instead of all jumbled at once?

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 3:51 pm
by Jabantiz
You would play one then you would need to set a timer for the duration of that voice over and in the callback play the next.

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 4:35 pm
by patrikpatrik
Of course! That did it, thx!

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 8:45 pm
by Gangrenous
There are many I think we need.

#castspell
#damage
#aggrozone
#finditem
#mana

Those should be super simple to code. I am not sure why we do not have #damage. That one seems like one everyone would need. You want to aggro something across the way that you have targeted, but you do not want to kill it. #damage 1 would do that. #aggrozone would be something to really help test performance or even pathing for that matter.

Re: New LUA Function: SetPlayerLevel

Posted: Mon Aug 15, 2016 9:30 pm
by Jabantiz
All LUA Functions
CastSpell
SpellDamage, ProcDamage, ModifyHP, for just agro use AddHate or Attack
Nothing to agro a whole zone, more of a dev thing any way
GetItemByID
Not sure what you intend mana to do but there are various functions for modifying power.