Firehawk777 Posted March 19, 2021 Share 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. Link to comment Share on other sites More sharing options...
Reneer Posted March 19, 2021 Share Posted March 19, 2021 You would use the 'Is' Papyrus keyword, like so: if (YourObjReference Is MiscObject) ; your code here. endif Link to comment Share on other sites More sharing options...
Firehawk777 Posted March 19, 2021 Author Share 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 Link to comment Share on other sites More sharing options...
Reneer Posted March 19, 2021 Share 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 Link to comment Share on other sites More sharing options...
DieFeM Posted March 19, 2021 Share Posted March 19, 2021 I would try : If YourObjReference.GetBaseObject() As MiscObject ; your code here. endif Link to comment Share on other sites More sharing options...
Reneer Posted March 19, 2021 Share 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. Link to comment Share on other sites More sharing options...
Firehawk777 Posted March 19, 2021 Author Share Posted March 19, 2021 Yes thanks. That works nicely. Link to comment Share on other sites More sharing options...
Recommended Posts