In the last few months, several people had problems handling the "set weather effect" event command - So I decided to make a very quick tutorial on how to best make such an effect and what to consider here (especially due to some less than optimal translations even in the english version of the editors).
Basically you need one event to start the weather on a map.
The simplest and easiest way is to do it like displayed in the following picture:
1) parallel processes are executed before autoruns, that is why it should be a parallel process if it is already raining on the map
2) priority should be above player to make sure it doesn't interfere in any way
3) in the set weather effect command, the duration should be set to 1
This is what I meant with the "less than optimal translation" - the duration value is not the duration of the weather effect, but how long the change between previous weather and next weather should be. If you set it to for example 360, then the map will start without weather and during the first six seconds the rain will slowly start before it gets to the set strength afer the 360 frames. If you want it already raining on entry to the map, you need to set the duration to 1
4) place an "erase event" after the set weather effect
Erase event erases this event from memory, but not from the mapfile. If the player leaves the map and returns later, it will be there again and start the rain for this map again.
And this is all you need to start a simple rain on a map.
Now we need to stop the rain when leaving the map, because otherwise it would continue raining on the next map (which is bad if it is an interior map, it doesn't rain in houses or caves).
ATTENTION:
Some people try to place the commands for this on the next map. Simply DON'T.
You should always stop the weather effect on the same map you started it, because game development takes months or years, with ever changing maps - if you change it on the next maps, you might forget to change it when adding maps or moving their transfers around.
If it rains again on the next map, then start the rain again there - complex checks should be handled differently to preserve your sanity during bughunting.
So if you need to stop the weather on transfer to another map, the easiest way is to edit the transfer events.
Most people use the automated quick event: transfer, so that is what I did as well with the next picture:
1) right-click on the map and create your transfer events as usual
2) after the quick event has been placed, doubleclick it to open it
3) doubleclick on the line with the transfer command, that will open the event command window to insert a new command directly above the transfer
4) select the "set weather effect" command, set it to none and the duration to 1 (again, you don't want the player to watch the rain slowly drying before the transfer so the duration should be as short as possible)
5) confirm with OK
finished, repeat whenever you make another transfer to a different map
That is all you need to have it rain on a single map and stop the rain for the next maps, whatever they are.
Advanced options:
If you don't want it to always rain on the map, or if you want to have different weather options, you need to place additional coding into the event for starting the weather - and only there.
If you want to have different weather options, the easiest way would be to store the current weather as a number into a variable, and have a series of conditional branches for each possible number, with different set weather effect commands in those branches. Don't use else, only check for equal and make sure that the number for each different settings is always the same on all maps.
That number might be set or randomized or whatever based on your game.
For an extremely complex weather system I suggest placing the commands for all checks and all effects into a single common event (trigger = none) that is called by the event above instead of the simple set weather effect command.
That is because you need the effect of the erase event command (and you can't erase common events), but on the other side you want only one place to handle the code for your weather, especially if it is complex or if you slowly add more conditions to the system.
本贴来自国际rpgmaker官方论坛作者:Andar处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/how-to-set-weather-for-a-single-map-only.76957/