Hi, I was wondering if anyone knows how to compare a creature object using a boolean. I can get it to work for a property of the creature like it's name but I would like to get it to work with the entire creature object.
For example :
if I have the creature hut_monsters.utc with the name Hut Monster
I can get this to work
string cName = GetName(OBJECT_SELF);
if ("Hut Monster" == cName)
blahblahblah;
but I don't know how to make this work
if (hut_monsters == OBJECT_SELF)
blahblahblah;
Any help would be appreciated, thanks!
Creature Object comparison
Débuté par
RivalryRedux
, mai 10 2010 06:20
#1
Posté 10 mai 2010 - 06:20
#2
Posté 10 mai 2010 - 04:55
The most obvious way would be to compare tags with GetTag(OBJECT_SELF).
If you use the same tag on different creature templates, you could compare resource with GetResRef(OBJECT_SELF).I think GetResRef will include the ".utc", so in this case will return "hut_monsters.utc". Be sure to test that, there's a chance it doesn't include the ".utc" and you'd want to just compare to "hut_monsters".
I'm not quite sure why you are running up against this problem though. Are you using a generic creature script for a whole bunch of different creatures? You might want to consider having a unique script, in which case you automaticaly know what creature resource OBJECT_SELF is because you know which creature the script is atatched to.
If you want to combine generic and custom handling, you could have a second creature script which the event is passed to instead of creature core, and then in the second script pass to creature core at the end, creating an extra scripting layer where you can do generic things.
If you use the same tag on different creature templates, you could compare resource with GetResRef(OBJECT_SELF).I think GetResRef will include the ".utc", so in this case will return "hut_monsters.utc". Be sure to test that, there's a chance it doesn't include the ".utc" and you'd want to just compare to "hut_monsters".
I'm not quite sure why you are running up against this problem though. Are you using a generic creature script for a whole bunch of different creatures? You might want to consider having a unique script, in which case you automaticaly know what creature resource OBJECT_SELF is because you know which creature the script is atatched to.
If you want to combine generic and custom handling, you could have a second creature script which the event is passed to instead of creature core, and then in the second script pass to creature core at the end, creating an extra scripting layer where you can do generic things.





Retour en haut






