Turning off an Item

Hello there, I am new to the RPG Making community, I am trying to make an item that is a lantern and I am doing this through a common event at the moment (I dont know how else I can do this )

My problem is after turning it on once, after using the item again it doesnt remove the state, any ideas?
do you use YEP_ButtonCommonEvents plugin as well? if so, can you screen
your event? if not, than still a screenshot of the event.
Turn on a switch after the lantern is on. Check if that switch is on. If it is, then turn the switch off as well as the lantern's graphic or light or whatever.
@frokas
Like this:
1597861524559.png
Hello @ShadowDragon thanks for the reply, please see attached my event (it's through Khas the plugin that enables the lantern)



Turn on a switch after the lantern is on. Check if that switch is on. If it is, then turn the switch off as well as the lantern's graphic or light or whatever.
@frokas
Like this:
View attachment 155819


But using the item again will turn it off afterwards like this?
Yes. Any time you use the item, if it's ON, it'll turn OFF. If it's OFF, it'll turn ON.
Yes. Any time you use the item, if it's ON, it'll turn OFF. If it's OFF, it'll turn ON.


Thanks it works, I don't really understand how but it worked. 🙂
Glad it's what you wanted ^^
Basically, you're turning on a switch to let the game know that the lantern is ON. So next time, when the item is used, the game will first check if it's already ON or not. If it is, it will turn the lantern OFF. Similarly, if it's OFF, it will turn the lantern ON.
This method not only works for lanterns, it can also work for pictures/maps or even events or anything like that. Like, suppose you want to press a button to show a picture. Then when you press the button again, the picture will be gone.

Original thread: https://forums.rpgmakerweb.com/threads/turning-off-an-item.125449/