Page 1 of 1

New LUA Item functions

Posted: Tue Nov 26, 2013 5:43 pm
by Jabantiz
New item script functions equipped and unequipped, will be called when you equip or unequip an item

Code: Select all

function equipped(Item, Player)

end

function unequipped(Item, Player)

end
Item = item being equipped/unequipped
Player = Player equipping/unequipping the item

Re: New LUA Item functions

Posted: Wed Nov 27, 2013 8:30 am
by John Adams
Spell Check!

~runs~

Re: New LUA Item functions

Posted: Wed Nov 27, 2013 1:38 pm
by Jabantiz
Yea I suck at spelling and copy and paste tends to spread the typos around... will fix it some time today

Re: New LUA Item functions

Posted: Thu Dec 12, 2013 8:00 pm
by thefoof
Hikacking this thread since we have sooo many damn lua posts :wink: 3 new functions.

First is GetItemCount(), this returns the current count of an item. Syntax is GetItemCount([Item*] item).

Second is SetItemCount(), this sets the count of an item (count must be <= the max stackcount of this item), if set to 0 this removes the item. Syntax is SetItemCount([Item*] item, [Spawn*] owner, [int16] new_count)

Third is GetItemSkillReq(), this returns either skillreq1 or skillreq2 from an item, this is useful for determining certain item subtypes. For example you could use

Code: Select all

if GetItemSkillReq(item, 1) == GetSkillIDByName("Bow")
to determine if an item is a bow. Syntax is GetItemSkillReq([Item*] item, [int8] type {use type 1 or 2})