[Resolved][XP] Random Weather Generator <> MAWS

Started by Andreavnn, April 26, 2012, 11:56:18 pm

Previous topic - Next topic

Andreavnn

April 26, 2012, 11:56:18 pm Last Edit: April 28, 2012, 11:21:12 am by Andreavnn
I made a random weather generator common event, but when I start my game is just shows variable 6 and doesn't "rotate" through the other variables.  Any help?


Spoiler: ShowHide

ForeverZer0

Its a parallel process. You are calling it over and over?
Eliminate all the "Exit Event Processing" commands, and add a switch at the very bottom that turns the switch off.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Andreavnn

I have a event on my start map the calls it and setups it up so every map doesn't need to have a call event on it and the effect will be the same on each map. I am going to add a wait command too so they long last so long and then change to a effect. May I going about it wrong?

diagostimo

ok seen as though your using ates i would probably reset the weather every few hours, and you dont want it to be a parrallel process constantly running otherwise its just gonna keep changing the variable continuously, here something along the line that you should do:
parralel proccess common event, trigger switch, turn it on at the start of the game:
Spoiler: ShowHide
condition: $game_system.ates.time.hour == 6
  call common event(the one that sets the weather)
branch end
condition: $game_system.ates.time.hour == 12
  call common event(the one that sets the weather)
branch end
condition: $game_system.ates.time.hour == 18
  call common event(the one that sets the weather)
branch end
condition: $game_system.ates.time.hour == 24
call common event(the one that sets the weather)
branch end

so in this example everytime it hits a 6 hour marker the weather is going to change, then i would set your common event up like so, note this is not a parallel process whe only want it to run it the once when its called:
Spoiler: ShowHide
control variable[4] = rand no(1....6)
condition: variable 4 == 1
  @>in this one id set no weather
  else
    condition: variable 4 == 2
      @>set it to whatever you want
      else
        condition: variable 4 == 3
          @>set it to whatever you want
          else
           condition: variable 4 == 4
             @>set it to whatever you want
             else
               condition: variable 4 == 5
                 @>set it to whatever you want
               else
                 condition: variable 4 == 2
                   @>set it to whatever you want
branches end       

this should work perfectly for you :)

Andreavnn

@Thanks again diagostimo. I have everything in place, with this event system how many seconds in game is a hour in ATES? I am using game time not real time.

diagostimo

April 27, 2012, 05:34:33 pm #5 Last Edit: April 27, 2012, 05:37:12 pm by diagostimo
that completly depends on how you set it up in the ates config here:
Spoiler: ShowHide
module ATES
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 # switch ID of the "day" switch
 DSWITCH = 51
 # switch ID of the "night" switch
 NSWITCH = 52
 # length of a day in seconds in-game, can't be less than 36, is being
 # quantized into intervals of 36 seconds
 LENGTH = 36
 # how much time is it when the "day" starts
 DAY_START = 8
 # how much time is it when the "night" starts
 NIGHT_START = 20
 # makes the screen brighter during "summer" days
 OVERLIGHTING = true
 # makes the screen darker during the night, not recommended
 OVERDARKENING = false
 # display HUD clock
 SHOW_CLOCK = true
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

i would say a comftorbable in game hour would be about 5 mins, so 5 times by 24 means we have 120 mins equvilent to a day, so now we break 120 mins into seconds which is 60 secs * 120 mins which gives us 7200 secs to a in game day, so on the line:
# length of a day in seconds in-game, can't be less than 36, is being
 # quantized into intervals of 36 seconds
 LENGTH = 7200

then this equates to 5 mins to an hour in game, if you want to change it just follow the calculation i did, the event will run of however ates is configured :D

Andreavnn

April 27, 2012, 06:19:41 pm #6 Last Edit: April 27, 2012, 06:36:13 pm by Andreavnn
So I want an day to be 2 minutes, meaning the weather will change every 1.5 minute, 1.5 * 24 is 36, 36 *60 is 2160. 2160 = length.

Spoiler: ShowHide
  # length of a day in seconds in-game, can't be less than 36, is being
 # quantized into intervals of 36 seconds
 LENGTH = 2160
 # how much time is it when the "day" starts
 DAY_START = 640
 # how much time is it when the "night" starts
 NIGHT_START = 1800
 # makes the screen brighter during "summer" days


This setup meaning both day and night have 1080 seconds, which is 18 minutes right? If this math is correct then I am going to make it so that night and day each have 2 minutes active time. Meaning it is day for two minutes then night and every minute and a half the weather will change so it might be raining during the night and last into the day time.


*EDIT* AHAH, my game screen is completely yellow :( What did I break?



diagostimo

i dont fully understand the first part of what you said, you want the day to be 2 mins but you want an hour to be 1.5??? ill show you what you did in you calculation anyway:
so 1.5 is the mins in an hour, 1.5 * 24(a day) = 36(mins in a day) then 36 * 60(total mins times by seconds) = 2160, 2160 = your days length in seconds so your script should look like so if your wanting 1.5 mins to an hour:
Spoiler: ShowHide
 LENGTH = 2160
  # how much time is it when the "day" starts
  DAY_START = <----------day start is the hour that daylight starts, not the seconds so if its 6am for       daylight to begin you simply put 6
  # how much time is it when the "night" starts
  NIGHT_START = <------------same again if night begins at 8 you put 20
  # makes the screen brighter during "summer" days

notice how i marked day stat and night start, these are recorded in hours not seconds, you putting a number like 2800 would make it imposible to start at that time as there are only 24 hours in a day, also look at the event that calls the weather common event, its checking the hour of the day then when that hour is met it calls the weather to set at one of the variables, i think you setting the day and night start so high may be the problem to your screen tone as there set on an hour that doesnt exist.

Andreavnn

I see, maybe I do not fully understand how the configuring works. I will explain what I am wanting to do and maybe you can help me.

Day = 2 minutes long
Night = 2 minutes long
Weather Effects = 2.5 minutes long (So some effects might go over into the day or into the night)

I hope the clears things up.  :facepalm: Sorry I guess I am not very good at explaining what I am wanting to do.

diagostimo

ok, i get you now, well your day is going to be a total of 4 mins including night and day, so first we know how many mins are in your day, so we cut straight to 4*60 = 240 seconds in your day, now you want your day to be 12 hours and your night 12 hours so set your script up like so:
 LENGTH = 240
  # how much time is it when the "day" starts
  DAY_START = 6 #6am
  # how much time is it when the "night" starts
  NIGHT_START = 18 #6pm
  # makes the screen brighter during "summer" days

so day and night are both 12 hours long which = 2 mins each
now im guessing your just wanting to set 1 weather effect for the 12 hour period to cut slightly into the next, the way i would do it is make the weather start about 8am for the first 12 hours, then make the second start at 8pm, the way to do it exactly how you want it would be to have some sort counting method that counts how many mins have passed, in your case 2.5 then everytime it reaches this count it changes the weather, but i dont think this is currently possible with ates, like i said it would need a method to count how much time has passed, but you can still make the weather cut into the night and day just fine like so:
Spoiler: ShowHide
condition: $game_system.ates.time.hour == 8
  call common event(the one that sets the weather)
branch end
condition: $game_system.ates.time.hour == 20
  call common event(the one that sets the weather)
branch end

so as you can see in the config day and night start at 6am and 6pm, and your reseting the weather at 8am and 8pm giving it 2 hours of cross over :)

Andreavnn

Okay, I did all that and here is what I have setup in game right now. The weather effects aren't working however. What am I failing at  :facepalm:

ATES
Spoiler: ShowHide
  # quantized into intervals of 36 seconds
  LENGTH = 240
  # how much time is it when the "day" starts
  DAY_START = 6 #6am
  # how much time is it when the "night" starts
  NIGHT_START = 18 #6pm
  # makes the screen brighter during "summer" days


Parallel Process
Spoiler: ShowHide


Weather Generator
Spoiler: ShowHide


Random Weather
Spoiler: ShowHide

diagostimo

did you wait till 8am? turn the clock to true so you can see the time advancing, the game starts up at 6am so theres 2 hours till the condition is met for the weather, also you probably are but remember to turn ates on at begining of the game

Andreavnn

 :'( I let is rotate through two days, and nothing happened. It might be MAWS acting up or not wanting to display its effects. I uploaded a demo for you to check out. I am doing everything right, I don't know what else I am doing wrong or forgetting.  :shy:


diagostimo

April 27, 2012, 09:43:18 pm #13 Last Edit: April 27, 2012, 09:47:38 pm by diagostimo
ok iv noticed a few errors, first of look at the maws config:
#------------------------------------------------------------------------------- 
# CONFIGURATIONS
#-------------------------------------------------------------------------------

 WEATHER_TYPE_VARIABLE  = 5
 # ID of game variable. Will be equal to the "type" of weather.
 
 ADVERSE_WEATHER_SWITCH = 4
 # ID of the game switch. Will be true during bad weather. (see below)
 
 ADVERSE_WEATHER = [1, 2, 4, 5, 9, 16]
 # Include any effects you wish. Adverse weather switch will be true when
 # any of these weather patterns are occuring.
 
 THUNDER_RATE = 5
 # Adjust how constant the thunder is. Higher values will increase the delay
 # between thunder strikes. Weather power will still effect the rate, but this
 # will change the overall rate. 0 will result in constant, unending screen
 # flashes.

see the variable id and switch id, make sure these are set to something that nothing else is using and call them MAWS so you dont acidentily use them later, second look at the script call when setting the weather:
$game_screen.weather(2,25,40,0)
you need spaces after the comas like so
$game_screen.weather(2, 25, 40, 0)
now look at the random weather common event, in your condition branches to set the weather your checking variable 3 when your using variable 4 as your generator, i corected all these and it works fine :)
edit:
also give the parralel process that turns ates on a new event page, self switch a and make it turn that switch on, once you turn it on its on, you dont need the parrallel process to keep running, you may also want to add this script call to it: ATES.advance(m, h) where m is the min and h is the hour you want your game to set to, you may also want to create a one call common event in this event to so it calls the weather generator on startup

Andreavnn

April 27, 2012, 10:16:58 pm #14 Last Edit: April 27, 2012, 10:40:42 pm by Andreavnn
It works great! Only one problem now, it just does one effect it was storming for two days. :facepalm:

*EDIT* I added "Exit event processing" after each weather effect in the generator, which makes change. But it runs through every effect like a hundred times before stopping at one. Any advice?

**EDIT** Okay, I try adding wait commands and script calls that end the weather effects after the waits. However, I don't know how many frames to wait I made it 500 and it was still only a few seconds. I don't know :( I am lost now it is setup right, but dysfunctional.

diagostimo

ok i figured it out, first of one of your weather comands isnt filled out properly, the one in variable 2 or 3, it says: @>script: $game_screen_weath(0, 0, 0)
weath should be weather, also on another one inside the brackets theres a space at the begining:
( 0, 0, 0) it should be: (0, 0, 0),
in the random weather common event dont turn the switch off at the bottom, this is why the weather never updates, the other common event should be allowed to run seamlessly unless you turn it of for inside a house or some thing but it should always be on outside, now you probably think you need it as the script seems to go wild and do all the weathers, we need to change the weather generator event to look like this:
Spoiler: ShowHide

notice i have added it to check if the min is 1, if you think about it when the hour is 4 it has 60 mins where it is 4, so this allows the weather to constantly keep resetting no matter the min, then i added a wait 10 frames to the random weather event to allow it time for the min to be no longer 1 so it would not loop the command, i have tested it through the day and it works fine, also theres no need to indent all the conditions, i actually think it makes it messy, i laid out the random weather event like so:
Spoiler: ShowHide
just lay them out as i did and everything should be fine:D

Andreavnn

Works great thanks! Now I just need to add sounds, flashes and things. +1

diagostimo

no problem glad to be of help :) also i noticed your giving the map a fog on the last variable, fogs and weather can run together so when it changes the weather the fog will always be there, you should cancel out the fog when setting the weather, also i would make some variables that doubles up fogs and weathers just to make it a bit more interesting :)