Dwemer Secret Stairs Script - Able to toggle?

Post » Mon Jun 18, 2012 11:35 pm

I am wondering if you are able to change so that the 'DweBREntrance01' can be toggled, because at the moment you can only open it, you are not allowed to close it which i think is slightly stupid.

I don't know any Papyrus, only Lua, it has some similarities but its rather hard to get used too...
Here is the script;

Scriptname BlackreachDoorScript extends ObjectReference Conditional{Script to open the door to blackreach when activated by the lock.}import gameimport debugimport utilitybool 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 closingEVENT OnLoad()if (isOpen )  myState = 0endifendEVENTauto STATE waiting ; waiting to be activatedEVENT onActivate (objectReference triggerRef)  ; switch open state when activated  SetOpen(!isOpen)endEVENTendStateSTATE busy; This is the state when I'm busy animating  EVENT onActivate (objectReference triggerRef)	trace (self + " Busy")  endEVENTendSTATEfunction SetOpen(bool abOpen = true); if busy, wait to finishwhile getState() == "busy"  wait(1)endWhile; openisAnimating = true  if  !isOpen   gotoState ("busy")   trace(self + " Opening")   playAnimationandWait(openAnim, openEvent) ; Animate Open  endif  trace(self + " Opened")  isOpen = true  gotoState("done")isAnimating = falseendFunctionSTATE done; This is the end state, player should not be able to reactivateendSTATE

I am wondering if anyone can make it so that the 'passage' can be toggled rather than it only being able to open...
I will be making a new script for a copied version of the 'DweBREntrance01' so it wont mess up the original one.
User avatar
Richard
 
Posts: 3371
Joined: Sat Oct 13, 2007 2:50 pm

Post » Mon Jun 18, 2012 3:49 pm

bump
User avatar
Taylah Haines
 
Posts: 3439
Joined: Tue Feb 13, 2007 3:10 am

Post » Mon Jun 18, 2012 9:29 pm

http://www.creationkit.com/SetOpen_-_ObjectReference is a native function, and you should never want to override native functions. Pick another name that isn't already taken. Also, by declaring it outside of any state your definition will be unavailable in all of your states except the empty one, which isn't default for your script since you have an auto state, and isn't used by anything else except for your http://www.creationkit.com/OnLoad_-_ObjectReference event, which won't work for the same reason.

When you call SetOpen within your "waiting" state, the game will call the native version, so none of your other states will ever be entered.

If the stairs can only be "opened" then I expect it's entirely possible that there isn't a "close" animation for them.

Cipscis
User avatar
CSar L
 
Posts: 3404
Joined: Fri Nov 09, 2007 9:36 pm


Return to V - Skyrim