Auto-extinguishing torches
Hi guys,I want to share with you a simple and fast method to create a light (torch, lantern, lighter or anything else) which comes on when an item is used by your inventory, and that comes off after a certain period of time. I already went through this with my game and works pretty well. I don't know if it's been know yet. The only script you need is the khas awesome light effect : https://forums.rpgmakerweb.com/index.php?threads/khas-awesome-light-effects.4917/
1) First of all you have to create a commont event (named torch for example) and add a switch (torchON) into ON position.
Spoiler
http://i.imgur.com/NWnu2vN.jpg
2) Create a second switch named TorchOFF.
3) Then, create your item (a torch) and add your commont event "torch" into the "effects" area. The item must be useable only by inventory, of course.
Spoiler
http://i.imgur.com/v1nTTbB.jpg
3) Now, create an event into the first map where the player finds the item. This event must be set as parallel process, torchON switch as activation condition. So, when the item is used by inventory, the switch goes on and our event may start.
Spoiler
http://i.imgur.com/Wa3tkrK.jpg
4) In our event, add this commands into the first page (see the screen above):
Script Call:
l = $game_map.lantern
l.change_owner($game_player)
l.set_graphic("torch")
l.set_opacity(180,30)
l.show
Wait: 999 frames
Wait: 999 frames
Wait: 999 frames
switch: torchOFF
5) Add a second page in our event and put torchOFF as activating condition (second page always as parallel process) and put this command:
Script Call:
l = $game_map.lantern
l.change_owner($game_player)
l.set_graphic("torch")
l.set_opacity(180,30)
l.hide
Spoiler
http://i.imgur.com/k8quZRx.jpg
6) The last thing you should do is copy the same event into the following maps, but in this case the extinguish time is much faster
(Wait: 999 frames
Wait: 666 frames)
The lenght of time the torch should wait before extinguishing depends on the size of your maps and on your preference.
Spoiler
http://i.imgur.com/53UrpcR.jpg
Obviously, this method works fine when we have a small groups of dark rooms (as a sequence of caves). I'd say 3 - 4 linked dark maps, no more.
Let me know if you have some tips on how improve it!
本贴来自国际rpgmaker官方论坛作者:Vassago处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/auto-extinguishing-torches.79561/
页:
[1]