• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with some random weather.

Status
Not open for further replies.
Level 5
Joined
Mar 12, 2005
Messages
117
Hi all. As always i hope everyone is well and enjoying there weekend :D . My question is does anyone know how to make a random integer loop (the trigger will explain more)

my trigger is

Event: every 10 sec(timer is set for test purposes)

Action: For each (integer A) from 1 to 1, do actions
sub Action:Set Weather = (Random Integer number between 1 and 10)

wait 1 sec

2ndsub Action:Set Weather = (Random Integer number between 1 and 10)
(this sets up the integer)

Then my different types of weather

Event: every 10 secs

Action: if weather=1 then:turn off last effect, wait 1 sec create rain, wait 0.10 turn on last created weather effect

if weather=6 then:turn off last effect, wait 1 sec create fog, wait 0.10 turn on last created weather effect

if weather=8 then:turn off last effect, wait 1 sec create wind, wait 0.10 turn on last created weather effect

if weather=10 then:turn off last effect.

again for testing i changed the rain wind and fog to equal 1,2 and 3 (the integer values). and made the random integer number 1 to 3 that worked perfectly so i changed the numbers to those above (Matching the trigger above) and now all it does is rain or not rain, then it stops and only either rains or not rain. how do i keep the loop going and how do i get the different weather cos all the random loop picks is 1 and 10. :?
 
Level 5
Joined
Nov 21, 2005
Messages
100
Why the loop? Why the second setting of the interger? And couldn't you have it with only one trigger, which sets the integer, then the weather?

How do you even spell it? Interger? Integer? Oh well

Yeah, just make it set an inetrger thingy every ten seconds, then set the weather based on that all in the same trigger. Just one linem set variable, then an IF/THEN/ELSE for the weather setting.
 
Level 4
Joined
Dec 8, 2005
Messages
58
Here's the trigger that I use and it seems to work fine...

Events
Time - Every 185.00 seconds of game time

Conditions - None

Actions
If (Weather Not equal to 9) then do (Environment - Turn (Last created weather effect) Off) else do (Do nothing)
If (Weather Not equal to 9) then do (Environment - Remove (Last created weather effect)) else do (Do nothing)
Set Weather = (Random integer number between 1 and 9)
If (Weather Equal to 1) then do (Environment - Create at (Entire map) the weather effect Ashenvale Rain (Heavy)) else do (Do nothing)
If (Weather Equal to 2) then do (Environment - Create at (Entire map) the weather effect Ashenvale Rain (Light)) else do (Do nothing)
If (Weather Equal to 3) then do (Environment - Create at (Entire map) the weather effect Dungeon White Fog (Heavy)) else do (Do nothing)
If (Weather Equal to 4) then do (Environment - Create at (Entire map) the weather effect Dungeon White Fog (Light)) else do (Do nothing)
If (Weather Equal to 5) then do (Environment - Create at (Entire map) the weather effect Wind (Heavy)) else do (Do nothing)
If (Weather Equal to 6) then do (Environment - Create at (Entire map) the weather effect Dungeon Blue Fog (Heavy)) else do (Do nothing)
If (Weather Equal to 7) then do (Environment - Create at (Entire map) the weather effect Dungeon Blue Fog (Light)) else do (Do nothing)
If (Weather Equal to 8 ) then do (Environment - Create at (Entire map) the weather effect Lordaeron Rain (Heavy)) else do (Do nothing)
If (Weather Not equal to 9) then do (Environment - Turn (Last created weather effect) On) else do (Do nothing)


I know it's kinda long but thats only because I have 8 diffrent weather effects, you can set it to whatever you want. BTW "Weather" is the name of my Variable.
 
Level 5
Joined
Mar 12, 2005
Messages
117
Well the trigger you have written is similar to mine except it mines smaller and there first 2 top lines clash with the bottom line of your code so it wouldn't work Many thanks for trying tho. but i worked out what the problem was. you need to change the random integer from 1-10 to 1- whatever weather changes you have and that fixed it.
 
Status
Not open for further replies.
Top