LukeH Posted March 9, 2012 Share Posted March 9, 2012 (edited) Hi,I need to make a reference from one ObjectReference (A) to another one (B) (I believe that B would be just Actor on what I need but can be dead) and obtain the linked one (B) anytime I want starting from A. I need to do this to a vanilla objects so extending that object's script with something like linkActor(Actor) and getLinkedActor() I believe won't do for me (or can I?).I was looking at ObjectReference#GetLinkedRef(Keyword) but can't find a setter for that using Papyrus or the way to do it.Also took in consideration ObjectReference#setActorCause(Actor) but can't find a getter for that, assuming I can use this for any object not only traps as I noticed it's usage and won't mess something else.Any way to do this?Thanks Edited March 9, 2012 by LukeH Link to comment Share on other sites More sharing options...
tunaisafish Posted March 9, 2012 Share Posted March 9, 2012 Not following exactly what you are looking for. The LinkedRef commands are set up in the CK, so they'd be constant refs to Actor B if you did it that way. If you've got a script on Actor A, and you want to create some link to Actor B, then you can define those functions above yourself, although you could just access the script variable directly without functions. Actor myLink Function linkActor(Actor akActor) myLink = akActor EndFunction Actor Function getLinkedActor() return myLink EndFunction Link to comment Share on other sites More sharing options...
LukeH Posted March 9, 2012 Author Share Posted March 9, 2012 If you've got a script on Actor A, and you want to create some link to Actor B, then you can define those functions above yourself, although you could just access the script variable directly without functions. Thanks but as I mentioned I need this for vanilla objects and I can't modify their scripts. Link to comment Share on other sites More sharing options...
tunaisafish Posted March 9, 2012 Share Posted March 9, 2012 You can attach scripts to any pretty much any world object through quest Alias's.I don't know what you're trying to do but even a token (dummy inventory item) may work too. Link to comment Share on other sites More sharing options...
LukeH Posted March 9, 2012 Author Share Posted March 9, 2012 You can attach scripts to any pretty much any world object through quest Alias's.I don't know what you're trying to do but even a token (dummy inventory item) may work too.Trough quest alias I have to extend ReferenceAlias, right? But I need to do that any number of times for different objects, I actually have a quest alias for my object but I call ForceRefTo on it when needed. I guess if I attach a script to the quest alias with those get/set methods I won't be able to have a unique link for each reference I used in ForceRefTo. Am I right (I'm at work without the CK at me)? Link to comment Share on other sites More sharing options...
tunaisafish Posted March 9, 2012 Share Posted March 9, 2012 I've used 2 formlists in the past for multiple one-to-one relationships.Papyrus has arrays now so that will make life a bit easier :) Link to comment Share on other sites More sharing options...
LukeH Posted March 9, 2012 Author Share Posted March 9, 2012 (edited) I've used 2 formlists in the past for multiple one-to-one relationships.Papyrus has arrays now so that will make life a bit easier :)That's my current implementation too, unfortunately I don't know how to clean it up when objects are destroyed in situations like ingredients used to create something, soul gems used to fill something, etc...I didn't had time to make a big research on how to handle that because of limited time, any insight on those particular cases would be welcomed. Problem with that is that the list may get big without cleanup but maybe I'm overthinking it, yet a link as in OP would be way more elegant.Arrays would have the same problem + missing the feature to write something like Actor[] actorsNew = new Actor[actorsOld.Length+1] Edited March 9, 2012 by LukeH Link to comment Share on other sites More sharing options...
Recommended Posts