Enable Disable then Re enable Collison Box

Post » Wed Feb 05, 2014 3:44 pm

I am relativley new to the Creation kit so bear with me. I am trying to get a collision box to disabable from a switch and then re-enable when pressed again. I can get it to disable by adding defaultEnableDisableLinkedRef script, seting trigger type to 1 and setting a LinkedRef to the collisionmarker however when I press the button again it does not re-enable. I am missing somthing but am missing it. Thanks in advance.

User avatar
Victoria Bartel
 
Posts: 3325
Joined: Tue Apr 10, 2007 10:20 am

Post » Wed Feb 05, 2014 1:38 pm

If you read the comments at the top of the script, it says it will only fire once. It goes into the "Done" state, which then essentially ignores all "Activate" events after that. I dont know if there is a default script to use, but you can make a custom one which may look something like this...

Scriptname _test_testscript extends ObjectReference    Event OnActivate(ObjectReference akActionRef)    ObjectReference kLinkedRef = GetLinkedRef() ;stores the linked ref in a variable    if kLinkedRef.IsDisabled()        kLinkedRef.Enable()    else        kLinkedRef.Disable()    endIfendEvent

If you need some sort of delay between button presses, then you might want something like this... (fDelay needs to be defined, the cooldown time)

Scriptname _test_testscript extends ObjectReferencefloat Property fDelay = 3.0 Auto ;3.0 is defaultEvent OnActivate(ObjectReference akActionRef)    GoToState("BusyState") ;busy state will ignore all OnActivate events    ObjectReference kLinkedRef = GetLinkedRef() ;stores the linked ref in a variable    if kLinkedRef.IsDisabled()        kLinkedRef.Enable()    else        kLinkedRef.Disable()    endIf    Utility.Wait(fDelay) ;wait to return to the empty state    GoToState("")endEventState BusyState    Event OnActivate(OBjectReference akActionRef)        ;do nothing    endEventendState
User avatar
Rude_Bitch_420
 
Posts: 3429
Joined: Wed Aug 08, 2007 2:26 pm


Return to V - Skyrim