New LUA Function: SetPlayerLevel

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

Moderator: Team Members

Post Reply
Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

New LUA Function: SetPlayerLevel

Post by Jabantiz » Tue Aug 09, 2016 5:26 pm

SetPlayerLevel()

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

patrikpatrik
Posts: 16
Joined: Wed Aug 03, 2016 8:43 am

Re: New LUA Function: SetPlayerLevel

Post by patrikpatrik » Mon Aug 15, 2016 11:56 am

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?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA Function: SetPlayerLevel

Post by Jabantiz » Mon Aug 15, 2016 3:18 pm

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.

patrikpatrik
Posts: 16
Joined: Wed Aug 03, 2016 8:43 am

Re: New LUA Function: SetPlayerLevel

Post by patrikpatrik » Mon Aug 15, 2016 3:47 pm

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?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA Function: SetPlayerLevel

Post by Jabantiz » Mon Aug 15, 2016 3:51 pm

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.

patrikpatrik
Posts: 16
Joined: Wed Aug 03, 2016 8:43 am

Re: New LUA Function: SetPlayerLevel

Post by patrikpatrik » Mon Aug 15, 2016 4:35 pm

Of course! That did it, thx!

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: New LUA Function: SetPlayerLevel

Post by Gangrenous » Mon Aug 15, 2016 8:45 pm

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.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA Function: SetPlayerLevel

Post by Jabantiz » Mon Aug 15, 2016 9:30 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests