Script For Weather Help Needed

OK with OCD my brain just won't click on this, I need help with a script which you can learn more about here.

http://forums.rpgmakerweb.com/index.php?/topic/45929-using-conditional-branch-for-weather-help/

But will repost the script here, long story short I have a script that adds a button to the pause menu. Thanks to Ksjp17 I found a way to stop the player from turning effects off and on while in doors, which would result in it raining in-doors. Now I just need one more thing solved, I know how to get events to turn on/off but I can not figure out how to:

A:Have the raining stop when entering buildings or dugeons, I could add switches with events but if a player plays with the effects off...well they would need to turn them off every new transfer to another map and would get annoyed.

B:Have more than just rain turn on/off, want to have snow in some maps for a example.

Here's the script, if it's possible to fix one of those two issues without having to rework the script please share. If not, well I have OCD, never gonna figure out how to rewrite by myself and as my friend lost internet for a few days...yeah. XD Again, I wanted this script to give the players who are slowed down by too many events (weather, animals, smoke, ect) to turn them off whenever so they can play if their systems can't handle so much on screen.

module CONSTANTS
  #Menu names
  COMMAND1_NAME = "Effects"

  #Common Event IDs
  COMMON_EVENT1_ID = 2

end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
#  This command window appears on the menu screen.
#==============================================================================

class Window_MenuCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
    add_original_commands
    add_formation_command
    add_custom_commands
    add_save_command
    add_game_end_command
  end
  #--------------------------------------------------------------------------
  # * Add Custom Commands
  #--------------------------------------------------------------------------
  def add_custom_commands
    add_command(CONSTANTS::COMMAND1_NAME, :command1)
  end
end

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_MenuBase
  def create_command_window
    @command_window = Window_MenuCommand.new
    @command_window.set_handler🙂item,      method🙂command_item))
    @command_window.set_handler🙂skill,     method🙂command_personal))
    @command_window.set_handler🙂equip,     method🙂command_personal))
    @command_window.set_handler🙂status,    method🙂command_personal))
    @command_window.set_handler🙂formation, method🙂command_formation))
    @command_window.set_handler🙂command1,  method🙂custom_command1))
    @command_window.set_handler🙂save,      method🙂command_save))
    @command_window.set_handler🙂game_end,  method🙂command_game_end))
    @command_window.set_handler🙂cancel,    method🙂return_scene))
  end
 
  def custom_command1
    return_scene
    $game_temp.reserve_common_event(CONSTANTS::COMMON_EVENT1_ID)
  end
end
Screanshots, and no Idk how the text got bigger/darker.http://www.mediafire.com/convkey/d530/tqjyj0t2x9xh2qxzg.jpg

http://www.mediafire.com/convkey/6a6d/qog3q59xrq43caezg.jpg

http://www.mediafire.com/convkey/50ca/m2vsj3plw6t5rw9zg.jpg
How are you determining what's inside and what's outside?


Nevermind - I see it in the screenshots.
You don't need a parallel process for starting a simple rain effect. You simply turn on the rain effect, and it will go on until it is switched off.


Why did you even create 3 common events? You can do that with one easily.


At the ON choice, turn ON the rain effect AND a switch, and at the OFF choice turn the effect AND the switch OFF.


You will use the switch turned ON/OFF in the indoor to outdoor transfers to check if the player enabled it or not.


As for the indoor canceling the effects...


On the transfer events which drops the player indoor, add a simple "clear weather effects" command just before the transfer.


For more weather effects, you can spice up your ON choice part of the common event.


Add map ID conditions, so depending on the map, you can set different weather effects to start.


No idea if there is a map ID check by default, but if there isn't, you can enter this into the condition branch command's script box:

$game_map.map_id == map_idReplace 'map_id' on the right of the equation signs to the ID of the maps you want to check for.
Inside these checks, add a suitable weather effect.


On the indoor to outdoor transfer events, add a rain weather ON/OFF command depending on the state of the switch you used at the ON/OFF choices.


Unless I misunderstood something, this should work.
You don't need a parallel process for starting a simple rain effect. You simply turn on the rain effect, and it will go on until it is switched off.

Why did you even create 3 common events? You can do that with one easily.

At the ON choice, turn ON the rain effect AND a switch, and at the OFF choice turn the effect AND the switch OFF.

You will use the switch turned ON/OFF in the indoor to outdoor transfers to check if the player enabled it or not.

As for the indoor canceling the effects...

On the transfer events which drops the player indoor, add a simple "clear weather effects" command just before the transfer.

For more weather effects, you can spice up your ON choice part of the common event.

Add map ID conditions, so depending on the map, you can set different weather effects to start.

No idea if there is a map ID check by default, but if there isn't, you can enter this into the condition branch command's script box:

$game_map.map_id == map_idReplace 'map_id' on the right of the equation signs to the ID of the maps you want to check for.Inside these checks, add a suitable weather effect.

On the indoor to outdoor transfer events, add a rain weather ON/OFF command depending on the state of the switch you used at the ON/OFF choices.

Unless I misunderstood something, this should work.
I could try that and see if it works, btw you mean replace the very last map_ID and add the weather I want between the ==?

EDIT:I didn't make the 3 effects, if you read the link where I said more info is at you'll see a friend had someone make the script. In the test file they sent they had the 3 common effects and as I didn't wanna mess anything up and really mess up RPG Maker, just left stuff alone until I needed to post here for help.

EDIT AGAIN:I found the map IDs (top of the same page where you can add random encounters) but, um...how do I add map conditions? Sorry but Idk how. XD Keep in mind I have OCD and never did something like this before.
I meant that you can control all weather effects with a single switch, so you don't need to add/change anything in the script.

Here is what your common event should look like:

@Conditional Branch: Switch[51] == ON @Message: Cant use this here.else @Show Choices: ON, OFF When [ON] @Control Switches[50] = ON @Conditional Branch: Script: $game_map.map_id == 1 @Set Weather Effects: Rain, @0, wait end @Conditional Branch: Script: $game_map.map_id == 2 @Set Weather Effects: Snow, @0, wait end @Conditional Branch: Script: $game_map.map_id == 3 @Set Weather Effects: Storm, @0, wait end @Conditional Branch: Script: $game_map.map_id == 4 @Set Weather Effects: None, @0, wait end When [OFF] @Control Switches[50] = OFF Branch EndBranch EndSo, based on the map the player is, different weather effects will be shown when the player tuns the weather effects ON with your common event command.In the example above, the if the player is on the map with ID 1, and turns the weather effects ON, the rain weather effect would be triggered.

If the player is on map 2, and turns the effects ON, the snow effect would trigger. And so on.

Note that the condition check for Switch 51 is actually not needed at all if you do all the checks I mentioned.

You can shorten the check for map IDs with this syntax:

@Conditional Branch: Script: [2,3,5,13,15,45].include?($game_map.map_id) @Set Weather Effects: Storm, @0, wait end This would trigger the storm weather effect if the player is on any of the maps with the following IDs: 2, 3, 5, 13, 15 or 45.You can add more numbers into the array to set the effect for more maps.

Since there can be only one weather effect active at a time, this solution should be perfect for your weather effect toggle option, I think.

Now, if the player enters an indoor area, simply add a "Set weather effect: None" command for the transfer event which moves the player to the indoor area. This way the weather effect will be stopped on the indoor map.

And in the events which transfers the player into outdoor maps, you can add these commands before the transfer (or after, maybe that will work too, simple switch turnings work even after the transfer, I tried those already) on your event page:

@Conditional Branch: Switch[50] == ON Set Weather Effect: Rain, @0Branch EndThis would set the rain effect upon transferring the player to the outdoor map. Since you are the one adding the weather on your maps, you always know which one should be triggered after the transfer, so you can directly set the weather effects when the player enabled the effect with your common event command (that is why we check for switch 50 before turning ON the weather effect).And this should be it in short.
I meant that you can control all weather effects with a single switch, so you don't need to add/change anything in the script.

Here is what your common event should look like:

@Conditional Branch: Switch[51] == ON @Message: Cant use this here.else @Show Choices: ON, OFF When [ON] @Control Switches[50] = ON @Conditional Branch: Script: $game_map.map_id == 1 @Set Weather Effects: Rain, @0, wait end @Conditional Branch: Script: $game_map.map_id == 2 @Set Weather Effects: Snow, @0, wait end @Conditional Branch: Script: $game_map.map_id == 3 @Set Weather Effects: Storm, @0, wait end @Conditional Branch: Script: $game_map.map_id == 4 @Set Weather Effects: None, @0, wait end When [OFF] @Control Switches[50] = OFF Branch EndBranch EndSo, based on the map the player is, different weather effects will be shown when the player tuns the weather effects ON with your common event command.In the example above, the if the player is on the map with ID 1, and turns the weather effects ON, the rain weather effect would be triggered.

If the player is on map 2, and turns the effects ON, the snow effect would trigger. And so on.

Note that the condition check for Switch 51 is actually not needed at all if you do all the checks I mentioned.

You can shorten the check for map IDs with this syntax:

@Conditional Branch: Script: [2,3,5,13,15,45].include?($game_map.map_id) @Set Weather Effects: Storm, @0, wait end This would trigger the storm weather effect if the player is on any of the maps with the following IDs: 2, 3, 5, 13, 15 or 45.You can add more numbers into the array to set the effect for more maps.

Since there can be only one weather effect active at a time, this solution should be perfect for your weather effect toggle option, I think.

Now, if the player enters an indoor area, simply add a "Set weather effect: None" command for the transfer event which moves the player to the indoor area. This way the weather effect will be stopped on the indoor map.

And in the events which transfers the player into outdoor maps, you can add these commands before the transfer (or after, maybe that will work too, simple switch turnings work even after the transfer, I tried those already) on your event page:

@Conditional Branch: Switch[50] == ON Set Weather Effect: Rain, @0Branch EndThis would set the rain effect upon transferring the player to the outdoor map. Since you are the one adding the weather on your maps, you always know which one should be triggered after the transfer, so you can directly set the weather effects when the player enabled the effect with your common event command (that is why we check for switch 50 before turning ON the weather effect).And this should be it in short.
Think I see, boy will that be long tho after I add more maps. And hopefully with what you said, if the player has the effects turned off...well I could add 2 pages for the transfer to outside, 1 for when the effects are off (so players who have it off won't have to turn back off after every transfer outside) and 1 for when the effects are on. I'm gonna re-read your reply a few times as with OCD, first read I have no idea. XD Usually with scripts gotta read over and over a few times so I can get a guess at what to do. I'll let you know if it works.
You don't have to do anything extra when the effects are OFF in the transfer events which move the player to outside maps.


If you don't trigger the weather effects, they won't happen, obviously. That is why you check for switch 50 in those events, and only turn ON the effects when the switch is turned ON too.


The switch 50 is automatically turned ON when the player sets the effects ON with your common event command button, and it will be automatically turned OFF when the player turns the effects OFF.


This mechanism is included in the common event I presented above for your menu option button.
You don't have to do anything extra when the effects are OFF in the transfer events which move the player to outside maps.

If you don't trigger the weather effects, they won't happen, obviously. That is why you check for switch 50 in those events, and only turn ON the effects when the switch is turned ON too.

The switch 50 is automatically turned ON when the player sets the effects ON with your common event command button, and it will be automatically turned OFF when the player turns the effects OFF.

This mechanism is included in the common event I presented above for your menu option button.
Let me ask 1 more thing, you said I can do this all in 1 common effect? Wouldn't I need to change that in the script? Like the script has 

"#Common Event IDs

  COMMON_EVENT1_ID = 2"

I would need to change that and similar lines to COMMON_EVENT1_ID = 1 right?

EDIT:I notice there's a few ends in

"@Conditional Branch: Switch[51] == ON  

  @Message: Cant use this here.

else

  @Show Choices: ON, OFF

  When [ON]

    @Control Switches[50] = ON

    @Conditional Branch: Script: $game_map.map_id == 1

      @Set Weather Effects: Rain, @0, wait

    end

    @Conditional Branch: Script: $game_map.map_id == 2

      @Set Weather Effects: Snow, @0, wait

    end

    @Conditional Branch: Script: $game_map.map_id == 3

      @Set Weather Effects: Storm, @0, wait

    end    

    @Conditional Branch: Script: $game_map.map_id == 4

      @Set Weather Effects: None, @0, wait

    end    

  When [OFF]

    @Control Switches[50] = OFF

  Branch End

Branch End"

is that the branch end or else? A screenshot would really help. ^^; I don't see a end command anywhere.

EDIT AGAIN:Tested and the rain doesn't turn back on when going back outside, maybe I can use a branch to fix this. -----------Didn't work, so what? When a player walks inside and the weather ends, they have to turn effects off/on to have it appear when going back outside? Idk how to fix this! I don't want the weather to turn off for good! I want it back on when they go outside, ugh I hate my OCD! XD
Sorry for double posting, but letting you know I got this to work. However I did in fact "need" to mess witht he transfer event, when leaving a building I told it to read a weather effect and it works. I had to add the "turn weather off" in the above common event. That's why it didn't work before.

Original thread: https://forums.rpgmakerweb.com/threads/script-for-weather-help-needed.45942/