- Joined
- Oct 25, 2009
- Messages
- 996
How can i create random weather? 
Example: Every 1 minute,
create random weather.

Example: Every 1 minute,
create random weather.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.

Custom script: set udg_Weather[1] = 'FDgl'
It's just jass :]
And this is what we are talking about - Weather is an effect in Warcraft3 and thus variable of that type are called Weather Effect.
Initialization

Events


Map initialization

Conditions

Actions


Custom script: set udg_WeatherHash = InitHashtable()


-------- Weather Library --------


Custom script: set udg_Weather[1] = 'RAhr'


Custom script: set udg_Weather[2] = 'RAlr'


Custom script: set udg_Weather[3] = 'MEds'


Custom script: set udg_Weather[4] = 'FDbh'


Custom script: set udg_Weather[5] = 'FDbl'


Custom script: set udg_Weather[6] = 'FDgh'


Custom script: set udg_Weather[7] = 'FDgl'


Custom script: set udg_Weather[8] = 'FDrh'


Custom script: set udg_Weather[9] = 'FDrl'


Custom script: set udg_Weather[10] = 'FDwh'


Custom script: set udg_Weather[11] = 'FDwl'


Custom script: set udg_Weather[12] = 'RLhr'


Custom script: set udg_Weather[13] = 'RLlr'


Custom script: set udg_Weather[14] = 'SNbs'


Custom script: set udg_Weather[15] = 'SNhs'


Custom script: set udg_Weather[16] = 'SNls'


Custom script: set udg_Weather[17] = 'WOcw'


Custom script: set udg_Weather[18] = 'WOlw'


Custom script: set udg_Weather[19] = 'LRaa'


Custom script: set udg_Weather[20] = 'LRma'


Custom script: set udg_Weather[21] = 'WNcw'


-------- End of Library --------


Set Random_Integer = (Random integer number between 1 and 21)


Custom script: call SaveInteger(udg_WeatherHash, GetHandleId(bj_mapInitialPlayableArea), StringHash("weather"), udg_Random_Integer)


Custom script: set udg_Weather_Effect = AddWeatherEffect(bj_mapInitialPlayableArea, udg_Weather[udg_Random_Integer])


Environment - Turn Weather_Effect On
Random Weather

Events


Time - Every 5.00 seconds of game time

Conditions

Actions


Set Random_Integer = (Random integer number between 1 and 21)


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If- Conditions




Random_Integer Not equal to (Load (Key weather) of (Key (Playable map area)) from WeatherHash)



Then - Actions




Custom script: call RemoveWeatherEffect (udg_Weather_Effect)




Custom script: set udg_Weather_Effect = AddWeatherEffect(bj_mapInitialPlayableArea, udg_Weather[udg_Random_Integer])




Environment - Turn Weather_Effect On




Custom script: call SaveInteger(udg_WeatherHash, GetHandleId(bj_mapInitialPlayableArea), StringHash("weather"), udg_Random_Integer)



Else - Actions
You are using JNGP right? As the tags used in the extract are Vjass and so need jass helper to precompile them down to proper jass WC3 can use.Sorry to say but when i copied the trigger over to my map it kept coming up with an error saying that it expected variables for the different kinds of weather.
Melee Initialization

Events


Map initialization

Conditions

Actions


Environment - Create at (Playable map area) the weather effect Northrend Snow (Light)


Set Weather_we[0] = (Last created weather effect)


Environment - Turn (Last created weather effect) Off


Environment - Create at (Playable map area) the weather effect Northrend Snow (Heavy)


Set Weather_we[1] = (Last created weather effect)


Environment - Turn (Last created weather effect) Off


Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)


Set Weather_we[2] = (Last created weather effect)


Environment - Turn (Last created weather effect) Off


Environment - Create at (Playable map area) the weather effect Northrend Blizzard


Set Weather_we[3] = (Last created weather effect)


Environment - Turn (Last created weather effect) Off
Change Weather

Events


Time - Every (90.00 + (Random real number between 0.00 and 90.00)) seconds of game time

Conditions

Actions


For each (Integer A) from 0 to 3, do (Actions)



Loop - Actions




Environment - Turn Weather_we[(Integer A)] Off


Environment - Turn Weather_we[(Random integer number between 0 and 3)] On
bj_mapInitialPlayableArea instead of GetPlayableMapRect().Oh dear... Someone seems to have forgoten (or not realised) that arguments for events are evaluated only when the event constructor is called. As such it will have a predictable perodic time every map session but that period would be random between map sessions.Time - Every (90.00 + (Random real number between 0.00 and 90.00)) seconds of game time
