Author Topic: Is it possible to allow a door to open only once?  (Read 818 times)

I'm trying to make something and it requires a door to open, but it opening activates events that I want to only activate once.
Is it possible with default events to get a door to only open once? And how?
Thanks.

Code: [Select]
0 [0] [X] onActivate > self > door > toggle
1 [2000] [X] onActivate > self > door > toggle
2 [2033] [X] onActivate >self > toggleEventEnabled > [0 1]

this will open the door when you activate it, then it will close, then it will turn off the events to open and close it.

this will open the door when you activate it, then it will close, then it will turn off the events to open and close it.
You need to include event 2 in the toggleEventEnabled output there or else it'll just re-enable after clicking twice. I tend to prefer using the setEventEnabled event since it's more clear how the events will be set.

Is there any way to reset it if the player dies? I don't want to make it so when they respawn they can't open it again.

well if you use vce then you can attach a variable to the player when they click the door but not with default events

also with the default event one the door only works once, period
any player can't open it after one does

PlayerTouch events will probably be able to reset events.

Code: [Select]
If it is a single player game, you could use onMinigameDeath to enable them again.
But this triggers every time a player dies in the minigame, so it might mess it up in multiplayer.

[quote author=Col. Burton link=topic=303015.msg9256155#msg9256155 date=1474574448]
2 [2033] [X] onActivate >self > toggleEventEnabled > [0 1]
[/quote]
You can also use setEventEnabled to set the events off without toggeling between the states.