Jump to content

Please help...trying to script a secret wall door


River65

Recommended Posts

I'm trying to script a secret wall door for a player home I'm creating. I'm trying to wrap my head around papyrus and have watched many tutorials regarding scripting and understanding papyrus, but I'm not a computer programmer, just a person who enjoys playing Skyrim and playing around with the Creation Kit to customize my game.

 

The piece I'm using is the wrsecretwall door attached to a norpullchain. It plays a gamebyro based animation. I've been trying to get this to work for weeks and I've got it opening and closing, but it's not playing the smooth animation that shows in the preview window. It just pops in and out. This is the script I've been working on.

 

 

Scriptname R65SecretWallScript extends ObjectReference

{Script to play a gamebryo based animation with sound}


ObjectReference Property DoorRef Auto
Bool Property abStartOver = False Auto
Sound Property SFX Auto

Event OnActivate (ObjectReference TriggerRef)

if (abStartOver == True)
;debug.notification("I'm opening the wall")
Int SoundInstance = SFX.Play(Self)
DoorRef.PlayGamebryoAnimation("Forward")
abStartOver = False
else
(abStartOver == False)
;debug.notification("I'm closing the wall")
Int SoundInstance = SFX.Play(Self)
DoorRef.PlayGamebryoAnimation("Backward")
abStartOver = True
endIf

endEvent

 

 

 

I've looked up the Creation Kit Scripting reference for PlayGamebryoAnimation - ObjectReference, but I don't fully understand syntax (if I'm even saying that right). Anyway, I would greatly appreciate if anyone here could help me with this script.

Link to comment
Share on other sites

I *think* you need to add the ease-in time.....

 

afEaseInTime = 1.0

 

That's in seconds. If I am reading it right, (and that's only a maybe.....) the numeric value is how long it takes the animation to play. I think.....

Thank you for responding. The preview states the animation takes 4.33 seconds from start to end so I added a float property and set an ease-in time of 4.33. It didn't seem to have any effect, still got the popping in and out. I'll try adding it in again and test it, in case I missed something the first few times around. I'm wondering if I need to add some sort of start/stop (function? property?) - my head is spinning with all of the papyrus information I've been looking up, which is why I'm hoping someone here can help me understand how I can make this work.

Link to comment
Share on other sites

Personally I know next to nothing on playgamebryoanimation, however, I do not think you need a property as the ease in time is inherent to the function.

 

; Play the forward animation and ease it in over 1 second

DoorRef.PlayGamebryoAnimation("Forward", afEaseInTime = 1.0)

 

Should be all you need. Set the time you require.

 

Also, start over is contained within the function too. So:

 

DoorRef.PlayGamebryoAnimation("Forward", abStartOver = false, afEaseInTime = 1.0)

 

Another approach might be to sack all this off and come at it from a different angle...

 

 

I have been using this technique a lot recently and it is great. Lots of flexibility. A lot more work than just getting a door to open as desired. But this definitely works!

Edited by TyburnKetch
Link to comment
Share on other sites

Personally I know next to nothing on playgamebryoanimation, however, I do not think you need a property as the ease in time is inherent to the function.

 

; Play the forward animation and ease it in over 1 second

DoorRef.PlayGamebryoAnimation("Forward", afEaseInTime = 1.0)

 

Should be all you need. Set the time you require.

 

Also, start over is contained within the function too. So:

 

DoorRef.PlayGamebryoAnimation("Forward", abStartOver = false, afEaseInTime = 1.0)

 

Another approach might be to sack all this off and come at it from a different angle...

 

 

I have been using this technique a lot recently and it is great. Lots of flexibility. A lot more work than just getting a door to open as desired. But this definitely works!

Thank you for responding. I've watched Darkfox's tutorial several times (my go to for tutorials) and changed the piece to a static, then to a moveable and I couldn't get it to work. Probably because I couldn't find the right path to change in nifskope for the collision, or possibly because the piece already has an animation attached to it. I'm not knowledgeable enough to say...but I appreciate the suggestion.

 

I've changed the script as you suggested to:

 

 

ObjectReference Property DoorRef Auto

Bool Property abStartOver = False Auto

Sound Property SFX Auto

 

Event OnActivate (ObjectReference TriggerRef)

 

if (abStartOver == True)

;debug.notification("I'm opening the wall")

Int SoundInstance = SFX.Play(Self)

DoorRef.PlayGamebryoAnimation("Forward", abStartOver = False, afEaseInTime = 4.33)

 

else

(abStartOver == False)

;debug.notification("I'm closing the wall")

Int SoundInstance = SFX.Play(Self)

DoorRef.PlayGamebryoAnimation("Backward", abStartOver = True, afEaseInTime = 4.33)

 

endIf

 

endEvent

 

 

 

So I can get rid of the bool property abStartOver as well, since it's contained within the function? Thank you for explaining this to me.

 

There was some progress - now it pops out on the forward movement and automatically switches to the backward animation which plays smoothly. (However it doesn't stay open - no break between forward/backward animation) Perhaps my abStartOver parameters are mixed up?

 

It's my understanding that the abStartOver controls whether the animation starts over from the beginning - since I want it to open/"forward" on pulling the chain and then close/"backward" on pulling the chain again would my abstartover = false until after the second animation plays where I would then set it to true? Am I explaining/understanding this correctly?

Link to comment
Share on other sites

Yes, remove the property. It is not doing anything.

 

I do not think your first block is firing as start over(true) is not the default state. I think you are just seeing your else block.

 

Try removing the calls on start over at the start of each block and just let the function handle them?

 

Also try both start overs as false.

 

I actually think states might help you here, but without being able to compile and test atm I can not test this myself.

 

Have a play around :)

Edited by TyburnKetch
Link to comment
Share on other sites

I'm just using what you have posted, i don't know if the door / activator you are using, it's actually using 'GamebryoAnimation' or if the animation name is the correct one.

Sound Property SFX Auto
 
Bool Property Triggered = False Auto Hidden
Int SoundInstance   ;used to store sound ref
 
Auto State WaitingActivation
Event OnActivate (ObjectReference akActionRef)
      If ( Triggered == False )
            GoToState("Busy")
            Triggered = True
            SoundInstance = SFX.Play(Self)
            PlayGamebryoAnimation("Forward", True)
            Utility.Wait(4.33)
            StopInstance(SoundInstance)
            GoToState("WaitingActivation")
   Else
            GoToState("Busy")
            Triggered = False
            SoundInstance = SFX.Play(Self)
            PlayGamebryoAnimation("Backward", True)
            Utility.Wait(4.33)
            StopInstance(SoundInstance)
            GoToState("WaitingActivation")
 EndIf
EndEvent
EndState
 
 
State Busy
         ;
EndState

 

 

 

* The script need to live on the door / activator.

Edited by maxarturo
Link to comment
Share on other sites

Yes, remove the property. It is not doing anything.

 

I do not think your first block is firing as start over(true) is not the default state. I think you are just seeing your else block.

 

Try removing the calls on start over at the start of each block and just let the function handle them?

 

Also try both start overs as false.

 

I actually think states might help you here, but without being able to compile and test atm I can not test this myself.

 

Have a play around :smile:

I've tried removing the calls on start over and it won't compile - I get these errors

 

C:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\R65SecretWallDoor.psc(14,1): mismatched input 'else' expecting ENDEVENT

C:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\R65SecretWallDoor.psc(17,22): no viable alternative at input 'SFX'

C:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\R65SecretWallDoor.psc(17,25): required (...)+ loop did not match anything at input '.'

C:\Steam\steamapps\common\Skyrim Special Edition\Data\Source\Scripts\temp\R65SecretWallDoor.psc(17,6): Unknown user flag SFX

No output generated for R65SecretWallDoor, compilation failed.

 

 

I've also tried various combinations of true/false on the start overs and the only one that works for both open and close is the way it's written. I think you may be right about the states. Thank you again for your feedback. This 'wrsecretwall' seems to be a well kept secret, there's very little information out there on how to use it, other than linking it up to a teleport door for a cut civil war quest.

 

 

 

I'm just using what you have posted, i don't know if the door / activator you are using, it's actually using 'GamebryoAnimation' or if the animation name is the correct one.

Sound Property SFX Auto
 
Bool Property Triggered = False Auto Hidden
Int SoundInstance   ;used to store sound ref
 
Auto State WaitingActivation
Event OnActivate (ObjectReference akActionRef)
      If ( Triggered == False )
            GoToState("Busy")
            Triggered = True
            SoundInstance = SFX.Play(Self)
            PlayGamebryoAnimation("Forward", True)
            Utility.Wait(4.33)
            StopInstance(SoundInstance)
            GoToState("WaitingActivation")
   Else
            GoToState("Busy")
            Triggered = False
            SoundInstance = SFX.Play(Self)
            PlayGamebryoAnimation("Backward", True)
            Utility.Wait(4.33)
            StopInstance(SoundInstance)
            GoToState("WaitingActivation")
 EndIf
EndEvent
EndState
 
 
State Busy
         ;
EndState

 

 

 

* The script need to live on the door / activator.

 

Hi Maxarturo, thank you for responding. When previewing the piece in the creation kit the animations of forward/backward are listed under gamebryo. I watched the following video to learn about how to set up gamebyro animations to an activator. https://www.youtube.com/watch?v=SRz12_ykvf4

 

The sound marker I'm using doesn't play on a loop. So I tried your script but I removed StopInstance, it wouldn't compile with that line stating 'stop instance is not a function or does not exist'. However, I attached the script to the wall door (minus the stopinstance lines) and it worked!!!!!!!! Thank you, thank you, thank you! :thumbsup:

 

So the working script attached to the wall door is as follows:

 

Scriptname R65SecretWallDoor extends ObjectReference

{Script to play a gamebyro animation with sound}

 

Sound Property SFX Auto

 

Bool Property Triggered = False Auto Hidden

 

 

Auto State WaitingActivation

Event OnActivate (ObjectReference akActionRef)

If ( Triggered == False )

GoToState("Busy")

Triggered = True

SoundInstance = SFX.Play(Self)

PlayGamebryoAnimation("Forward", True)

Utility.Wait(4.33)

GoToState("WaitingActivation")

Else

GoToState("Busy")

Triggered = False

SoundInstance = SFX.Play(Self)

PlayGamebryoAnimation("Backward", True)

Utility.Wait(4.33)

GoToState("WaitingActivation")

EndIf

EndEvent

EndState

 

 

State Busy

;

EndState

 

Link to comment
Share on other sites

Glad you got it working :smile:

Me too. As I said I've been working on this one issue for weeks. I've been tinkering around in the Creation Kit for years, created numerous houses, followers, even a couple of islands, but everything just dies when it comes to scripting, so I scrap it, start a new game, get an idea and the cycle continues. I think the highest level I've ever gotten to is something like 72....anyway, scripting challenges my learning curve. I'm definitely appreciative of all of the talented mod authors who give freely of their time and knowledge.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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