HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Weather System Question [Dont know where else to post!]

09-10-2008, 06:38 PM#1
Syntic_Arrow
Hey,

I want to make a weathersystem that makes my map have rain on random times for random times. So it's not like I do something like:

Wait 20 sec
Weather - create rain at entire map
Wait 60 sec
Turn last created weather effect off

thats something I DONT want, I want something, like I said that randomly creates rain in the entire map at random times. Nothing else then rain, just rain or no rain.

Hope someone could give me help

Thanks with advance,

Syntic_Arrow ;-)
09-10-2008, 07:20 PM#2
Softmints
Try something like this:

Trigger:
Actions
Environment - Turn Global_Weather On
Wait (Random real number between 15.00 and 75.00) seconds
Environment - Turn Global_Weather Off
Wait (Random real number between 15.00 and 75.00) seconds
Trigger - Run (This trigger) (ignoring conditions)

It will create rain for a random time, at random times. You would need to create a global variable called 'Global Weather', and initialise it like this at map startup:

Trigger:
Actions
Environment - Create at (Entire map) the weather effect Ashenvale Rain (Light)
Set Global_Weather = (Last created weather effect)

Hope that helps.
09-10-2008, 08:14 PM#3
moyack
I did this at the office (damn, my boss is gonna kill me) I 'm not sure what's the index of the rain weather effect, but I think this can be found somewhere.

EDIT: Tested and working perfectly....

Collapse Random rain library (requires Jass New Gen Pack):
// Just open a trigger, call it "rain maker" or whatever you want,
// convert it into custom code, and replace it with this text. Ready to make your map a swamp...
library RandomWeather initializer init

globals
    private constant integer Rain = 'RAhr' // Ashenvale heavy rain rawcode...
    private constant real    MinDur = 15. // minimum time that we have to wait between weathers
    private constant real    MaxDur = 45. // maximum time that we have to wait between weathers
    private weathereffect W
    private timer T = CreateTimer()
    private boolean IsRain = false
endglobals

private function Loop takes nothing returns nothing
    local timer t = GetExpiredTimer()
    set IsRain = not IsRain
    call EnableWeatherEffect(W, IsRain)
    call PauseTimer(t)
    call TimerStart(t, GetRandomReal(MinDur, MaxDur), false, function Loop)
    set t = null
endfunction

private function init takes nothing returns nothing
    set W = AddWeatherEffect(GetWorldBounds(), Rain)
    call TimerStart(T, GetRandomReal(MinDur, MaxDur), false, function Loop)
endfunction

endlibrary
09-11-2008, 06:41 AM#4
Syntic_Arrow
so thanks both for your time to answer this for me!! I really owe you :D Ill get right onto it