Page 1 of 1

LUA Function: GetItemType()

Posted: Thu Nov 21, 2013 11:27 pm
by thefoof
This function returns the int value of an item's type. Syntax is GetItemType(Item*).

LUA:GetItemType()

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 7:46 am
by John Adams
Exxxxcellent. Thank you.

Quick question though... is this just returning the value of the enum for item_type? (Armor, Weapon, Ranged...) If so, that might not be enough since non-bows can be equipped in the Ranged slot (right?) However, for the immediate need, this will do fine.

I like Jab's idea of IsBow(), which might be the long-term solution.

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 2:47 pm
by thefoof
Hmm looking it over I don't know that we really have a way to differ thrown weapons and bows in the first place? It looks like we just have ranged but no subtype as a bow or bandolier/satchel ect.

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 3:34 pm
by thefoof
It looks like this *might* be set by the item's skill_id_req or skill_id_req2, anybody know for sure? Either way we don't run any kind of check for this in the server when it comes to attacking with a ranged weapon currently.

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 3:38 pm
by John Adams
thefoof wrote:Either way we don't run any kind of check for this in the server when it comes to attacking with a ranged weapon currently.
BUG!!!

so I could equip a ranged sausage, and kill things with it?

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 3:48 pm
by thefoof
John Adams wrote:BUG!!!

so I could equip a ranged sausage, and kill things with it?
Let me explain :mrgreen: we run a check to see if a player has ammo, but not the type of ammo in relation to the bow. In other words right now you can throw arrows from a bandolier, or shoot throwing knives with a bow.

Re: LUA Function: GetItemType()

Posted: Fri Nov 22, 2013 3:49 pm
by John Adams
BUG!!!11/