Jump to content

Can you spot what i did wrong? PLEASE HELP


Trevin4real

Recommended Posts

I Was wondering if anyone could look through my script and find my errors, im not great at scripting.

Upon activation The script is supposed to move 3 Activators(skyhavenbloodrings) to a location then move them again to another location and stop
Once activating the same button/other activator the 3 activators move to the previous location and then back to the starting location and stop.

(ALSO: i couldnt decide what If statement to put at the beginning so i left it blank)

here it is:

Scriptname ActivatetheVault extends ObjectReference
 
ObjectReference Property Obj1 Auto
ObjectReference Property Obj2 Auto
ObjectReference Property Obj3 Auto
ObjectReference Property Mid1 Auto
ObjectReference Property Mid2 Auto
ObjectReference Property Mid3 Auto
ObjectReference Property Open1 Auto
ObjectReference Property Open2 Auto
ObjectReference Property Open3 Auto
ObjectReference Property Close1 Auto
ObjectReference Property Close2 Auto
ObjectReference Property Close3 Auto
 
Event OnInit()

    If
        GoToState("Close")
    Else
        GoToState("Open")
    EndIf

EndEvent

State Open
    Event OnBeginState()
        If akActionRef == Obj1
            akActionRef.TranslateToRef(Mid1, 3.0)
        EndIf

        If akActionRef == Obj2
            akActionRef.TranslateToRef(Mid2, 3.0)
        EndIf

        If akActionRef == Obj3
            akActionRef.TranslateToRef(Mid3, 3.0)
        EndIf
    EndEvent

Event OnActivate
        GoToState("Close")
    EndEvent

    Event OnEndState()
        If akActionRef == Obj1
            akActionRef.TranslateToRef(Open1, 3.0)
        EndIf

        If akActionRef == Obj2
            akActionRef.TranslateToRef(Open2, 3.0)
        EndIf

        If akActionRef == Obj3
            akActionRef.TranslateToRef(Open3, 3.0)
        EndIf
    EndEvent
EndState

State Close
    Event OnBeginState()
        If akActionRef == Obj1
            akActionRef.TranslateToRef(Mid1, 3.0)
        EndIf

        If akActionRef == Obj2
            akActionRef.TranslateToRef(Mid2, 3.0)
        EndIf

        If akActionRef == Obj3
            akActionRef.TranslateToRef(Mid3, 3.0)
        EndIf
    EndEvent

Event OnActivate
        GoToState("Open")
    EndEvent

    Event OnEndState()
        If akActionRef == Obj1
            akActionRef.TranslateToRef(Close1, 3.0)
        EndIf

        If akActionRef == Obj2
            akActionRef.TranslateToRef(Close2, 3.0)
        EndIf

        If akActionRef == Obj3
            akActionRef.TranslateToRef(Close3, 3.0)
        EndIf
    EndEvent
EndState
Link to comment
Share on other sites

Been fiddling with it A LOT and i managed to make it work with [OnTriggerEnter]

next step is to make it work with buttons instead

for now im just glad it actualy compiles..

Scriptname ActivatetheVault extends ObjectReference
 
ObjectReference Property Obj1 Auto
ObjectReference Property Obj2 Auto
ObjectReference Property Obj3 Auto
ObjectReference Property Mid1 Auto
ObjectReference Property Mid2 Auto
ObjectReference Property Mid3 Auto
ObjectReference Property Open1 Auto
ObjectReference Property Open2 Auto
ObjectReference Property Open3 Auto
ObjectReference Property Close1 Auto
ObjectReference Property Close2 Auto
ObjectReference Property Close3 Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
    If akActionRef == Game.GetPlayer()
        GoToState("Open")
    Else
        GoToState("Close")
    EndIf

EndEvent

State Open
    Event OnBeginState()
        Obj1.TranslateToRef(Mid1, 3.0)
        Obj2.TranslateToRef(Mid2, 3.0)
        Obj3.TranslateToRef(Mid3, 3.0)
    EndEvent

    Event OnEndState()
        Obj1.TranslateToRef(Open1, 3.0)
        Obj2.TranslateToRef(Open2, 3.0)
        Obj3.TranslateToRef(Open3, 3.0)
    EndEvent
EndState

State Close
    Event OnBeginState()
        Obj1.TranslateToRef(Mid1, 3.0)
        Obj2.TranslateToRef(Mid2, 3.0)
        Obj3.TranslateToRef(Mid3, 3.0)
    EndEvent

    Event OnEndState()
        Obj1.TranslateToRef(Close1, 3.0)
        Obj2.TranslateToRef(Close2, 3.0)
        Obj3.TranslateToRef(Close3, 3.0)
    EndEvent
EndState
Link to comment
Share on other sites

  • Recently Browsing   0 members

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