varx Posted April 15, 2016 Share Posted April 15, 2016 (edited) In papyrus, I have an array of actor objects. When I walk into an area, I want to be able to tell whether any of the actors in that area match my list. I have a script attached to each actor, with an OnCellLoad() event that fires for each one. The code is very simple then, I can iterate through my array comparing them to the actor that just fired the event. Except, I don't see how to make this comparison? Can I get an instance ID of some kind and use that? Is there some kind of object equivalence test I can use against each actor in the array that will match against the actor that is currently firing the event? Edited April 15, 2016 by varx Link to comment Share on other sites More sharing options...
TheTalkieToaster Posted April 15, 2016 Share Posted April 15, 2016 'InstanceID'? 'two objects are the same object'? You're being a little unclear I'm afraid. The two types of ID are:Object ID/ Base ID: The ID of a base form type, e.g. NPC_, WEAP, PROJ.Reference ID: The ID of an reference to a BaseID in-world. In Papyrus, the 'Actor' script object that extends 'ObjectReference' is used to store a reference ID that is an instance of the NPC_ base form.Is your list a list of NPC_ objects, or a list of references (i.e. instances of the NPC_ form in the game world)? Is your goal to see if two actor references are instances of the same NPC_ form? We used to have GetBaseObject() to check the Object ID of a reference. Any functions for checking/comparing ObjectIDs are probably going to exist on the ObjectReference script that Actor extends. I'd look there. Link to comment Share on other sites More sharing options...
MasterMagnus Posted April 15, 2016 Share Posted April 15, 2016 (edited) This might help:GetIsID(ObjectRef)Which returns the BaseID of the object.**EDIT**Which returns True (1) if the selected object is an instance of the BaseID you passed in. Or False (0) if not. Edited April 15, 2016 by MasterMagnus Link to comment Share on other sites More sharing options...
varx Posted April 16, 2016 Author Share Posted April 16, 2016 Thanks for the clarification. What I was looking for was, for example, say I walked past a Diamond City Security Guard, and processed him once. I wanted to be able to determine whether I had processed him before, by comparing him to an array of everyone else who had been processed (that sounds bad, but that array would never have gotten very large). FormID as I understand, would be the same for all Diamond City Security Guards who are spawned from the same actor record (LvlDmndSecurity or something like that). As it is I was eventually able to find a much more elegant solution to my problem, so it's fine now. Link to comment Share on other sites More sharing options...
DarthWayne Posted April 16, 2016 Share Posted April 16, 2016 You have to separate Actor and ActorBase. While the ActorBase will be the same for all DC guards, the Actor is bind to the object reference in the game world. In your case I would use a formlist rather than an array. Formlist have functions to add and remove forms or check if a Form is already present in the list. And you don't have to deal with max length. Just create a new FLST in xEdit and pass it as parameter. Link to comment Share on other sites More sharing options...
Recommended Posts