Game Development Community

Weapon / Item ... finding the Difference

by Badguy · in Torque Game Engine · 09/24/2002 (5:48 am) · 5 replies

In the script ..
how can I tell the Difference between an Item
and a Weapon?

using className house's the old one; Item.
I cant seem to find anything.

any help on this seemingly simple matter would not go unnoticed :)

#1
09/24/2002 (11:41 am)
className is the only way I know of to differentiate between Item types (IE. Weapon, Normal Item)


You have to remember to set the className in the datablock definition for the item to the correct specification.
#2
09/24/2002 (11:47 am)
yeah, or use some dynamic var in your datablock , e.g.
isWeapon=1;

Or, if you're looking for a specific weapon, e.g. the "Crossbow", use
%obj.getDatablock().getName();

Btw., how are the doors coming along? :p would *love* to see them working completely... :)
#3
09/25/2002 (2:32 am)
hmm well indeed that is what I thought but it is like I said the function getClassName for me is returning the Weapon's parent className "Item" and the variable className is returning " " this happens for me on stocker realm wars
when I type
echo((weaponId).getClassName()); 
or
echo((weaponId).className);

what am I doing wrong here?


Stephen :
as for the doors .. I was gonna crack into em last night and start playing .. as it is ive done nothing. :)
but instead im playing with the script getting warmed up.
#4
09/25/2002 (2:59 pm)
Should be %obj.getDatablock().className;

%obj being the ID of the object.
#5
09/25/2002 (6:51 pm)
ahh i c thanks alot :)