Jump to content

Remove Linked Ref?


FiftyTifty

Recommended Posts

'Tis a good day 'n' hullo lads.

 

 

I'm working on a wee mod that allows ya to, amongst other things, have a squad of raiders follow yer commands. Trouble is, in order to have a proper patrol package, I need to unique linked refs to the individual actors in an AliasRefCollection, as well as remove the linked refs once the player cancels the patrol.

 

To add a LinkedRef, we use SetLinkedRef(). But how do we remove them? I didn't find any relevant functions for that in the ObjectReference docs.

Link to comment
Share on other sites

 

Uhm just a guess here, but try passing none into SetLinkedRef() on the calling object you want to remove a linkedref from.

I don't think that would work. You can only pass "none" for the keyword, not the linked ref. http://www.creationkit.com/fallout4/index.php?title=SetLinkedRef_-_ObjectReference

 

The default value for an ObjectReference is none, and it will error to the log if passing none, or calling a function on a none is not allowed. However the former is not the case with SetLinkedRef(). If you want to clear a linked ref, you pass none into the function. I have tested it myself, and you can "double-check" with a test of your own if you like. I don't know if passing none to both parameters is necessary, but it was 'just in case'.

 

I used this code for my testing. An xmarker and a door.

 

The xmarker had this script:

ReferenceAlias property DoorRef auto

Event OnCellAttach()
ObjectReference kDoor = DoorRef.GetReference()
    GetReference().SetLinkedRef(kDoor, none)
    utility.wait(2.0)
    debug.trace("Current linked ref " +GetReference().GetLinkedRef())
    utility.wait(1.0)
    GetReference().SetLinkedRef(none, none)
    utility.wait(1.0)
    debug.trace("Is this marker still linked to the door? " +GetReference().GetLinkedRef())
EndEvent
 

This is what is shown in my log:

[09/17/2016 - 01:04:55AM] Current linked ref [ObjectReference < (11000FB2)>]
[09/17/2016 - 01:04:57AM] Is this marker still linked to the door? None
Edited by EveningTide
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...