baloney8sammich Posted November 28, 2021 Share Posted November 28, 2021 I downloaded a mod that allows collection and re-deployal of bear traps. This is the code that handles the removal: ;BEGIN FRAGMENT Fragment_1 Function Fragment_1(ObjectReference akTargetRef, Actor akActor) ;BEGIN CODE ObjectReference BearTrap = akTargetRef as ObjectReference If (BearTrap.GetTriggerObjectCount() == 0) Form toAdd = BearTrapFLST.getAt(1) Game.GetPlayer().AddItem(toAdd,1,false) BearTrap.Disable() BearTrap.DeleteWhenAble() Else Debug.Notification("You can't pick up the Trap while something is inside") EndIf ;END CODE EndFunction ;END FRAGMENT First of all, I was a bit concerned about the use of DeleteWhenAble(). It turns out that's actually not necessary for traps without an Enable Parent. But even with the DeleteWhenAble(), traps with an Enable Parent stick around until cell reload. I didn't see any functions for dealing with Enable Parent though. Not even just to check if a reference has an Enable Parent. So I'm wondering if anyone has any ideas about how this case can be handled properly. The one thing I could think of was changing the Z position to hide it in the ground, but apparently that's only temporary. In my tests the trap returned to its original location on cell reload (I had removed the DeleteWhenAble() obviously). Link to comment Share on other sites More sharing options...
Recommended Posts