WesternWolff Posted September 8, 2022 Share Posted September 8, 2022 Hello all! Hoping someone can help me out with this, as I've been trying to figure it out for a bit now, and I'm only getting more confused. I have a secret passage that opens based on a puzzle. It should go like this: The player enables the correct items (these are a series of activators: each one enables the next in sequence and disables itself.)The player pulls the chain, which activates the secret passage.The secret passage checks that the right activators are enabled, and if they are, it opens the door.If the right combination is not entered, the door doesn't budge, and the player has to try a new combo, then pull the chain.For the most part, this is working, but the bit about checking if the right activators are present doesn't seem to want to stop. Once you've pulled the chain, if you enter the right combo, the door opens again without needing a second chain pull. I've tried to govern this with states: all the work is done in the "Closed" state, which then exits to the "preClosed" or "preOpen" states depending on success. I've attached my full script, but here's the bit that governs that:If Answered == 1 PlayGamebryoAnimation("Forward", true) ;opens the secret door Utility.Wait(4.5) ;wait until animation finished GotoState("preOpen") Else Debug.Notification("The stones grind against eachother, but nothing happens.") GotoState("preClosed") EndIf The door does open with the correct combo, so I know this bit is firing, but it seems like maybe the "preClosed" and "Closed" states are running together, instead of switching. How do I get it to stop the "Closed" state, and force the player to start over? Link to comment Share on other sites More sharing options...
Sphered Posted September 8, 2022 Share Posted September 8, 2022 I wouldnt linger in a state for 4.5 seconds after trigger like that. Go to something immediately to avoid multi-procs GotoState("Limbo") for example Put whatever event you are doing, like OnActivate() in the limbo state, and give it nothing to do. Just leave it empty. Could also avoid the Wait() and instead RegisterForSingleUpdate. Wait gets flack for causing unnecessary stress on papyrus. For something like this it doesnt really matter, but all the same, events are cleaner so to speak, and its a good practice to use events when feasible Link to comment Share on other sites More sharing options...
WesternWolff Posted September 8, 2022 Author Share Posted September 8, 2022 I wouldnt linger in a state for 4.5 seconds after trigger like that. Go to something immediately to avoid multi-procs GotoState("Limbo") for example Put whatever event you are doing, like OnActivate() in the limbo state, and give it nothing to do. Just leave it empty. Could also avoid the Wait() and instead RegisterForSingleUpdate. Wait gets flack for causing unnecessary stress on papyrus. For something like this it doesnt really matter, but all the same, events are cleaner so to speak, and its a good practice to use events when feasible Thanks Sphered. I'm still getting the hang of Papyrus, and even after reading over the CreationKit Wiki, I'm not sure I really get how to use RegisterForSingleUpdate. That said, I added a blank limbo state like you suggested, and removed the wait time to see if it might be the culprit. New code looks like this: State Limbo Event OnActivate(ObjectReference akActionRef) ; do nothing here EndEvent EndState If Answered == 1 GotoState("Limbo") PlayGamebryoAnimation("Forward", true) ;opens the secret door GotoState("preOpen") Else GotoState("Limbo") Debug.Notification("The stones grind against eachother, but nothing happens.") GotoState("preClosed") EndIf And I'm still having the same issue. Any other thoughts? Did I do that the way you were thinking? Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts