Making activatable stairs go down and up.

Post » Thu Jun 21, 2012 8:17 am

Hello all,

I'm trying to get an Activator stair set to go up and down by a switch but so far I can only get it to go down.

The activator item involved is the DweBREntrance01. It has Havok animations of down.hkx and up.hkx so I know it has the capability of going back up.

I've attached a trigger to the stairs (enabling parent, activating parent) but the trigger only gets it to go down.

While I am old hat when it comes to modding in general...the scripting stuff, no matter how simple eludes me alot of time and I'm hoping for some help. :ermm:

Thanks in advance if anyone is aware what needs to be done.

-Rayek
User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am

Post » Thu Jun 21, 2012 3:55 am

can you post the script you have on the activator
User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am

Post » Thu Jun 21, 2012 7:56 am

The script I'm looking to edit is the default BlackReachDoorScript:

This is how it looks by default and being new to skyrim and the creation kit scripting items I'm leary to touch it.

I'm open to suggestions of where to go to learn this as well as I'm really taking shots in the dark here.

Scriptname BlackreachDoorScript extends ObjectReference Conditional
{Script to open the door to blackreach when activated by the lock.}
import game
import debug
import utility
bool property isOpen = false auto Conditional
{set to true to start open}
bool property isAnimating = false auto Hidden
{is the activator currently animating from one state to another?}
string property openAnim = "Down" auto Hidden
{animation to play when opening}
string property openEvent = "TransDown" auto Hidden
{open event name - waits for this event before considering itself "open"}
int myState = 1
; true when static or animating
; 0 == open or opening
; 1 == closed or closing
EVENT OnLoad()
if (isOpen )
myState = 0
endif
endEVENT
auto STATE waiting ; waiting to be activated
EVENT onActivate (objectReference triggerRef)
; switch open state when activated
SetOpen(!isOpen)
endEVENT
endState
STATE busy
; This is the state when I'm busy animating
EVENT onActivate (objectReference triggerRef)
trace (self + " Busy")
endEVENT
endSTATE
function SetOpen(bool abOpen = true)
; if busy, wait to finish
while getState() == "busy"
wait(1)
endWhile
; open
isAnimating = true
if !isOpen
gotoState ("busy")
trace(self + " Opening")
playAnimationandWait(openAnim, openEvent) ; Animate Open
endif
trace(self + " Opened")
isOpen = true
gotoState("done")
isAnimating = false
endFunction
STATE done
; This is the end state, player should not be able to reactivate
endSTATE

Thanks for any tips...if I'm way off base just let me know.

-Rayek
User avatar
Crystal Clarke
 
Posts: 3410
Joined: Mon Dec 11, 2006 5:55 am

Post » Thu Jun 21, 2012 7:24 am

i've rewritten the script. testing it out now... brb
User avatar
phillip crookes
 
Posts: 3420
Joined: Wed Jun 27, 2007 1:39 pm

Post » Thu Jun 21, 2012 5:28 am

ok it works:


create a duplicate of the stair activator, and rename this to your own (if you edit the original blackreach stairs it will break them in the vanilla game)

then attach a NEW script and name it whatever (i named it "test" so disregard that at the top of the code) do not use the original blackreach script for the same reason above
you can tick the condition option so that the IsOpen property can be queried in a condition function somewhere else if need be



Scriptname test extends ObjectReference  ConditionalBool Property IsOpen = False  Auto Conditional  ; Conditional property can be used to query  in external condition functions (AFAIK)Event OnInit()GoToState("Idle")  ;  The script will default with the stairs in its "up" positionEndEventState Idle  ; this state is awaiting activation and has no active animationEvent OnActivate(ObjectReference akActionRef)  GoToState("Busy")  ; sends the script into busy state, so that you don't override the action with another activation  StairAnim()  ; calls the animation functionEndEventEndStateState Busy  ; this state is when the activator is currently animating and its activation has been removed temporarilyEndStateFunction StairAnim()If (!IsOpen)  PlayAnimationAndWait("Down", "TransDown")  IsOpen = TrueElseIf (isOpen)  PlayAnimationAndWait("Up", "TransUp")  IsOpen = FalseEndIfGoToState("Idle")   ; send the script back into its idle state so that the object is ready to be interacted with againEndFunction



ps. this thing is pretty cool! i might use it in a future mod LOL
User avatar
Brandon Bernardi
 
Posts: 3481
Joined: Tue Sep 25, 2007 9:06 am

Post » Thu Jun 21, 2012 9:58 am

That Script never defines how a "Close" Event/Animation and it leaves the object in a "Done" State that does not even allow further activation, you need to either write a scripts that does this or find one that does.
User avatar
Emily Graham
 
Posts: 3447
Joined: Sat Jul 22, 2006 11:34 am

Post » Thu Jun 21, 2012 8:59 am

ok it works:


create a duplicate of the stair activator, and rename this to your own (if you edit the original blackreach stairs it will break them in the vanilla game)

then attach a NEW script and name it whatever (i named it "test" so disregard that at the top of the code) do not use the original blackreach script for the same reason above



Scriptname test extends ObjectReference  ConditionalBool Property IsOpen = False  Auto Conditional  ; Conditional property can be used to query  in external condition functions (AFAIK)Event OnInit()GoToState("Idle")  ;  The script will default with the stairs in its "up" positionEndEventState Idle  ; this state is awaiting activation and has no active animationEvent OnActivate(ObjectReference akActionRef)  GoToState("Busy")  ; sends the script into busy state, so that you don't override the action with another activation  StairAnim()  ; calls the animation functionEndEventEndStateState Busy  ; this state is when the activator is currently animating and its activation has been removed temporarilyEndStateFunction StairAnim()If (!IsOpen)  PlayAnimationAndWait("Down", "TransDown")  IsOpen = TrueElseIf (isOpen)  PlayAnimationAndWait("Up", "TransUp")  IsOpen = FalseEndIfGoToState("Idle")   ; send the script back into its idle state so that the object is ready to be interacted with againEndFunction



ps. this thing is pretty cool! i might use it in a future mod LOL

Umm wow, I will give this a shot. I did not expect someone to fix the script for me...very nice of you.

Definitely will not save as the BlackreachDoorScript which is why I was hesitant to touch it in the first place...

I will make sure to study it as well to see what changes you made, who knows I might learn something.

But before I jump the gun I'm off to see if it works for me...regardless thank you very much for your efforts.

If I get it working I will be sure to credit you in my mod Rayek's End on the Nexus...Amethyst Deceiver unless you prefer a different name. ;)

Also thanks to SaidenStorm for the tip, by your comment I'm assuming you're referring to the first script I posted and I see what you mean about it ending in a done state. Thanks for the response.
User avatar
Racheal Robertson
 
Posts: 3370
Joined: Thu Aug 16, 2007 6:03 pm

Post » Thu Jun 21, 2012 4:50 pm

its no problem man, i love your rayeks end mod btw. your crafting stations have inspired me to re-do and pretty-ify crafting furniture on my current WIP mod
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Thu Jun 21, 2012 7:22 am

its no problem man, i love your rayeks end mod btw. your crafting stations have inspired me to re-do and pretty-ify crafting furniture on my current WIP mod

Thanks much, didn't know you were aware of it. :) Glad you may find this script useful and that I could give a little inspiration for your current WIP mod...let me know when you finish I'd love to check it out.
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Thu Jun 21, 2012 5:34 pm

Worked like a charm...thanks again. Really made my day much less of a headache.

Will be released in Version 06. ;)
User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Post » Thu Jun 21, 2012 1:01 pm

LOL i put this staircase in my armory. it leads to the secret shooting range
User avatar
lucile
 
Posts: 3371
Joined: Thu Mar 22, 2007 4:37 pm


Return to V - Skyrim