Firehawk777 Posted March 19, 2021 Posted March 19, 2021 This is a pretty noob type question.How exactly is the best way to define from an Objectreference what its 'type' is? E.G if this is a miscObject, Funiture or an NPC.
Reneer Posted March 19, 2021 Posted March 19, 2021 You would use the 'Is' Papyrus keyword, like so: if (YourObjReference Is MiscObject) ; your code here. endif
Firehawk777 Posted March 19, 2021 Author Posted March 19, 2021 (edited) Thanks. Though I get an error when trying this method. It says the type miscobject is incompatible for the referenceObject to throw Edited March 19, 2021 by Firehawk777
Reneer Posted March 19, 2021 Posted March 19, 2021 Thanks. Though I get an error when trying this method. It says the type miscobject is incompatible for the referenceObject to throwI modified the code up above, it should work. At least, I've used the keyword that way in my own mods with success. Edit:Here is some code direct from my FO4 Radio Mod: if (akSenderRef Is Actor && ((akSenderRef As Actor).GetDialogueTarget() == PlayerRef || (akSenderRef As Actor).IsTalking() == true || akSenderRef.IsInDialogueWithPlayer() == true)) return endif
DieFeM Posted March 19, 2021 Posted March 19, 2021 I would try : If YourObjReference.GetBaseObject() As MiscObject ; your code here. endif
Reneer Posted March 19, 2021 Posted March 19, 2021 I would try : If YourObjReference.GetBaseObject() As MiscObject ; your code here. endif Good catch. That's what I get for trying to write code from memory late at night.
Recommended Posts