Jump to content

Return a lift to its original position. See details...


Recommended Posts

Video explains it better but basically player exits a mine via a lift going up. If player, when player, wants to go back down the mine I used a MoveTo script as I thought this was the best idea. In any case, player is moved into the mine and if player has already exited the mine via the lift, the lift will be at its top position, determined by a TranslateTo script which was executed when player exited. I want the lift to be back at the bottom, its starting position. The lift has a global variable which tracks which position, up or down, the lift is in. The global variable is only used for a check for the lift's TranslateTo script to see which part of the script (up or down) it should execute.

I added an OnActivate TranslateTo script on the pullchain at the top (outside/exterior cell) which also changed the lift's TranslateTo script variable to the down position but the lift, as seen in video, stays at its last position which for immersion case it should be but in my case I need it moved.

Thanks for input.

https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2134451&parId=B60C11D037429D8E%21191&o=OneUp

Link to comment
Share on other sites

You can use an "OnCellDetach" Event to make the lift return to its original position.

Example :

Event OnActivate()
 
          ; Do Stuff - Move the lift UP
 
Endevent
 
 
Event OnCellDetach() 
 
         : Return lift to the original position - DOWN
 
Endevent
Link to comment
Share on other sites

So, I don't know how to do this. What I did was place a script on the pullchain inside the mine which should fire when the player exits the mine via the lift. To ME it makes sense that the script is on the pullchain that is inside the cell where the player is. OnCellDetach suggests to ME that 'do this when I have left this cell'. Obviously it isn't doing it. Do I have to/should I put the script on the pullchain activator at the top of the mine (outside of the cell where the lift is)? - sounds counter-intuitive to me or should I add it to the lift's translate to script as another event?

 

GlobalVariable Property MyGlobal Auto
ObjectReference Property MyObj01 Auto
Float Property PosX1 Auto
Float Property PosY1 Auto
Float Property PosZ1 Auto
Float Property RotX1 Auto
Float Property RotY1 Auto
Float Property RotZ1 Auto
Float Property SpeedVal Auto

Event OnCellDetach()
MyObj01.TranslateTo(PosX1, PosY1, PosZ1, RotX1, RotY1, RotZ1, SpeedVal)
MyGlobal.SetValue(0)

EndEvent

 

Link to comment
Share on other sites

The " OnCellDetach " Event should be in the same Script that is moving your lift, in your LIFT TRANSLATE SCRIPT.

You can have more that one Event in a script, that's why i posted the example :

Event OnActivate()

; Do Stuff - Move the lift UP

Endevent


Event OnCellDetach()

: Return lift to the original position - DOWN

Endevent

Link to comment
Share on other sites

Ok, got it. Did that and its hit and miss if the lift returns. Reason for this is because the player is teleported out of the mine before the lift's TranslateTo has finished the OnCellDetach Event doesn't get called, usually the first time. After activating the lift from inside the mine more than once it sometimes works.

As player will likely return to the mine down the shaft it looks weird that the lift is still 'almost up' and activating the pullchain from inside the mine lets the lift complete its Translation, which is a small amount and throws out the timing off the SFX. On a second activation the lift then Translates down which is what I wanted to avoid from the beginning. COC-ing back into the mine confirms that the lift has not finished its TranslateTo. I guess this is all a matter of timing unless you can think of another way to get around this.

Thanks for your help.

Link to comment
Share on other sites

Why don't you just add a " Utility.Wait() " on the " OnCellDetach() " so that the first Event finish first its sequence, and then trigger the second Event.

Event OnCellDetach() 
           Utility.Wait(5.0)  ; Seconds to wait before the below gets triggered
 
         : Return lift to the original position - DOWN
 
Endevent
This is the simplest way to do this, but there are other ways too.
You can make your Script with " States ".
Example :

Auto state waiting
Event OnActivate()
          GoToState("Busy")
 
          ; Do Stuff - Move the lift UP
 
          ; When done with the LIFT SEQUENCE
           GoToState("allDone")
Endevent
ENDSTATE
 
 
State Busy
Event OnActivate(ObjectReference akActionRef)
;Do nothing.
EndEvent
EndState
 
 
STATE allDone
Event OnActivate()
 
         : Return lift to the original position - DOWN
 
          ; When done with the LIFT DOWN SEQUENCE RETURN TO BE ACTIVATED AGAIN
          GoToState("Waiting")
Endevent
ENDSTATE

OR with " State " and " Function " :

Auto state waiting
Event OnActivate()
 
          ; Do Stuff - Move the lift UP
 
          ; When done with the LIFT SEQUENCE execute FUNCTION
           LiftDown()
Endevent
ENDSTATE
 
 
Function LiftDown()
 
         : Return lift to the original position - DOWN
 
          ; When done with the LIFT DOWN SEQUENCE RETURN TO BE ACTIVATED AGAIN
          GoToState("Waiting")
 
ENDFUNCTION

EDIT : I just thought of this one...

 

 

You can also do this to your original Translate Script :
If your script has ( let's say ) 3 stages, i'm putting stages cause i don't know how you have actually done your script, but this idea applies to any other way you may have done it ( global idea ).
Example :
- Stage 1 DOWN
- Stage 2 MIDDLE
- Stage 3 UP
Add one more stage
- Stage 4 DOWN AGAIN
Edited by maxarturo
Link to comment
Share on other sites

The utility.wait has no effect.

I already use STATES for the script.

Structured like you mentioned.

 

Stage1 - Lift is activated, UP translation begins.

Stage2 - Lift is in motion and cannot be interrupted ("Busy")

Stahe3 - Lift has finished its translate to UP, global is set to the UP position.

If lift is activated again it will now go DOWN.

 

Issue:- In Stage2 Player is teleported (autoload door) out of the mine. This means Stage2 never finishes. So now player activates the pullchain on the top of the mine (exterior cell) and a MoveTo script takes the player back into the mine. Now in the mine player looks up and sees the lift almost at the top (lift stopped when player was teleported out). Player now wants to exit the mine again so activates the pullchain in the mine. The lift now continues its 'Paused' Stage2 and continues to the top. Player now has to activate again for the lift to come back down. Confusing part is this only happens the first time player exits and re-enters the mine. After that the OnCellDetach script is executed every time.

I know it is all for the sake of immersion and is a minor gripe but would be nice to get it to work.

Cheers.

Link to comment
Share on other sites

Asking you to post me the script for testing won't help since i'm on vacations and my tablet can't run Skyrim... lol.


This reminds me of the issue i was having with my multi teleportation script ( one spell, one cast, multiple targets ), i was trying to make the script to execute an Event that was " Object Reference " in an " ActiveMagicEffect " script, at the end of the " OnEffectStart " Event and at the beginning of the " OnCellAttach ", and all that in the same script.

I was struggling for 5 days with this !, and at the end the solution was so F***ING SIMPLE !!.


This is the same exact situation you are facing right now...

As i said, i can't test but i"ll think about this after my brain weaks up, i'm sure the solution is quite simple !.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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