HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Random Weather?

04-13-2005, 08:32 PM#1
Linera
How can I do random weather?
04-13-2005, 09:29 PM#2
Guest
1 - Create an integer variable, call it something like "Random_Weather", then create a weather effect variable and call it "Weather"

2 - Add these actions in a trigger:
Set (Random_Weather) = random number between (1) and (whatever)
Remove weather effect (Weather)
If (Random_Weather) = 1 Then create (weather effect at (point))
If (Random_Weather) = 2 Then create (other weather effect at (point))
etc... for as much weather effects as you want. Remember to set the maximum random number of random_weather up in this trigger to the number of weather effects you have
Set (Weather) = (last created weather effect)

Here you go!
04-13-2005, 09:43 PM#3
iNfraNe
The best way todo it (without having to add lots of if/then/elses (which is NEVER good)):

make a weather effect array variable. Then set the different values of the array

set weather[1] = ashenvale rain
set weather[2] = dungeon fog (white)

do this at map init.

Then just do: create Weather[random int between 1 and 2 (or bigger, depends on how many weathers u have)] at rect.

EDIT: ohhh I take this back. U cant have weather variables which SUX. Use badfurdays way..
04-13-2005, 11:14 PM#4
Guest
I made this and it doesn't work. Never get rain.

Events
Time - Every (Random real number between 150.00 and 200.00) seconds of game time

Actions
Set random_weather = (Random integer number between 1 and 2)
Environment = Remove weather
If((String(random_weather)) equal to 1) then do (Environment - Create at Playable map area the weather effect Ashenvale Rain (light)) else do (Environment - remove weather)
Set weather = (Last created weather effect)
04-13-2005, 11:18 PM#5
Anitarf
Quote:
Originally Posted by Galbuu
I made this and it doesn't work. Never get rain.

Events
Time - Every (Random real number between 150.00 and 200.00) seconds of game time

Actions
Set random_weather = (Random integer number between 1 and 2)
Environment = Remove weather
If((String(random_weather)) equal to 1) then do (Environment - Create at Playable map area the weather effect Ashenvale Rain (light)) else do (Environment - remove weather)
Set weather = (Last created weather effect)
First of all, I have no idea how your event works, if it works, having a random number in a periodic event is, well, wierd. Second, don't do a string comparison, do an integer comparison. Thirdly, maybe you didn't wait long enough, maybe you got a series of twos... Try changing these things and see if it works.
04-13-2005, 11:32 PM#6
Guest
Quote:
Originally Posted by Anitarf
First of all, I have no idea how your event works, if it works, having a random number in a periodic event is, well, wierd. Second, don't do a string comparison, do an integer comparison. Thirdly, maybe you didn't wait long enough, maybe you got a series of twos... Try changing these things and see if it works.

I changed those things and it doesn't work. I made it a set amount of seconds, not random, and I did an integer comparison. Oh, and for testing I reduce the time (in this case 15 seconds) and in about 2 minutes I didn't see rain.
04-14-2005, 01:35 AM#7
Raptor--
Quote:
Originally Posted by Galbuu
I changed those things and it doesn't work. I made it a set amount of seconds, not random, and I did an integer comparison. Oh, and for testing I reduce the time (in this case 15 seconds) and in about 2 minutes I didn't see rain.

uh, you have to run at the end, the action

turn last created weather effect on

or something like that name, cheers
04-14-2005, 02:13 AM#8
Guest
Quote:
Originally Posted by Raptor--
uh, you have to run at the end, the action

turn last created weather effect on

or something like that name, cheers

Thanks mate.