Jump to content

SetLinkedRef


Elsidia1

Recommended Posts

I give up.

Can somebody explain how this work?

 

Event OnEquipped(Actor akActor)

 

akActor.SetLinkedRef(self,libs.Mykeyword)

Objectreference ff = akActor.GetLinkedRef(libs.Mykeyword)

 

EndEvent

 

return ff = none

 

Keyword Mykeyword must be on actor or and on equiped object?

Or just any non related keyword keyword to link?

 

Actor can have many linked ref on this keyword or only one?

Edited by Elsidia1
Link to comment
Share on other sites

A linkedef keyword source/clent can only use that keyword once to make an outbound target link.


A linkedref keyword target/server can have many inbound links on the same keyword.




LinkRefSourceA.SetLinkedRef(LinkRefTarget, CommonKeyword)
LinkRefSourceB.SetLinkedRef(LinkRefTarget, CommonKeyword)
LinkRefSourceC.SetLinkedRef(LinkRefTarget, CommonKeyword)



The keyword should *NOT* already be assigned to the source or target object. If in doubt always use a unique keyword for your link.

Link to comment
Share on other sites

I give up.

Can somebody explain how this work?

 

Event OnEquipped(Actor akActor)

 

akActor.SetLinkedRef(self,libs.Mykeyword)

Objectreference ff = akActor.GetLinkedRef(libs.Mykeyword)

 

EndEvent

 

return ff = none

 

Keyword Mykeyword must be on actor or and on equiped object?

Or just any non related keyword keyword to link?

 

Actor can have many linked ref on this keyword or only one?

What and where and why is that "return"? Either way, ff is out of scope anywhere outside said Event.

Edited by hereami
Link to comment
Share on other sites

 

I give up.

Can somebody explain how this work?

 

Event OnEquipped(Actor akActor)

 

akActor.SetLinkedRef(self,libs.Mykeyword)

Objectreference ff = akActor.GetLinkedRef(libs.Mykeyword)

 

EndEvent

 

return ff = none

 

Keyword Mykeyword must be on actor or and on equiped object?

Or just any non related keyword keyword to link?

 

Actor can have many linked ref on this keyword or only one?

What and where and why is that "return"? Either way, ff is out of scope anywhere outside said Event.

 

That was not part of script. I just put it outside as simple text to mark, that ff into event always return none value. Sorry for misunderstanding.

Link to comment
Share on other sites

What and how is attempted to be done? GetLinkedRef() should be used elsewhere to access stored Ref, Events don't Return anything. Still, ff is a local variable.

Also, there can be problem with libs structure. Also, may depend on how gets Equipped https://www.creationkit.com/index.php?title=Talk:OnEquipped_-_ObjectReference

Edited by hereami
Link to comment
Share on other sites

What and how is attempted to be done? GetLinkedRef() should be used elsewhere to access stored Ref, Events don't Return anything. Still, ff is a local variable.

Also, there can be problem with libs structure. Also, may depend on how gets Equipped https://www.creationkit.com/index.php?title=Talk:OnEquipped_-_ObjectReference

should be used elsewhere to access stored Ref, Events don't Return anything - I have suspicions about this. Thanks to point on it.

So probably i should define new function outside the event and call from there as i see in other examples.

Also, there can be problem with libs structure. - no there i made 100% sure that event is fired and also libs structure works.

Also, may depend on how gets Equipped - hmm... i heard about it and work on this info. But got bad results.

Not to going into details i now work on fixing some mod with author permissions. So there was something works wrong and be on battle tests and debugging i found that this event is fired by scripts. So i was force do some artificial programming to prevent trigger this event to be sure that script works 100% right. As Hodd says - "Somehow it works!" )

I'm not test if event is fired using console, so there still can be problem as of possibility trigger this event.

Anyway thanks for help.

 

Maybe you know, what happens with link, if linked reference is deleted by removeitem command?

Link to comment
Share on other sites

Hm, no, i don't know exactly, what happens when Ref is deleted. That's interesting. But you can try and check if becomes NONE or not?

 

LinkedRef is technically a tagged variable, so possibly nothing - it just holds the Ref value of an obsolete Ref and possibly prevents it from freeing the memory*, unless game clears every link to it when deleting a Ref. Let's say, Quest objective keeps pointing to a deleted Ref until corresponding Alias is cleared.

 

* Basically, another question, does dynamic linking make ObjectRef persistent? Don't have much experience with LinkedRefs. But for now, have Cait sandboxing around a linked marker spawned in game and she doesn't lose the location.

Link to comment
Share on other sites

The reference ("A") that another one ("B") is linked to can't be deleted. "A" becomes persistent and "B" needs to be unlinked from "A" for that. Unlinking "B" from "A" should cause the persistency of "A" to be ceased unless another object "also" makes it persistent (e.g., "A" is held in a quest alias too). "B" can be deleted anytime though.

B.GetLinkedRef(SomeKeyword) == A

A.GetRefsLinkedToMe(SomeKeyword).Find(B) >= 0

I hope I didn't mix up the two...

Link to comment
Share on other sites

Nice then, thanks.

 

ps. I suppose that generic rules apply then and, for example, a TempRef created by Alias will not vanish until all links are cleared? That's actually convenient, no need to handle own destruction and find linkers.

Edited by hereami
Link to comment
Share on other sites

  • 2 weeks later...

Ok i got it. It works only with persistent references. So any ideas how reference can be made persistent instead of made it PlaceAtMe? Boolean force reference persistent? And maybe reverse process - remove persistence from reference if it made by papyrus?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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