• 🏆 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!

[Trigger] Creating random weather effect

Status
Not open for further replies.
Level 16
Joined
Jun 25, 2008
Messages
1,043
I want the triggers to change the weather to a random one of 4 possible.
But it doesn't work :(

Let me show you the triggers i use first. (they somehow don't work <<)

  • Morning weather roll
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
    • Conditions
    • Actions
      • Set WeatherRoll[1] = False
      • Set WeatherRoll[2] = False
      • Set WeatherRoll[3] = False
      • Set WeatherRoll[4] = False
      • Wait 1.00 seconds
      • Set WeatherRoll[(Random integer number between 1 and 4)] = True
      • Trigger - Run (This trigger) (checking conditions)
(and then i have another one for night, exactly the same but time of day 18.00)

Then i have various weather types, 4 to be precise.
  • heavy Rain roll
    • Events
    • Conditions
    • Actions
      • Wait until (WeatherRoll[1] Equal to (==) True), checking every 1.00 seconds
      • Environment - Turn CurrentWeather Off
      • Environment - Turn Weather[1] On
      • Set CurrentWeather = Weather[1]
      • Trigger - Run (This trigger) (checking conditions)

That's basically how they look.

And then in initialization, i have this:
  • Map initialization
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Heavy)
      • Set Weather[1] = (Last created weather effect)
      • Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Light)
      • Set Weather[2] = (Last created weather effect)
      • Environment - Create at (Playable map area) the weather effect Outland Wind (Light)
      • Set Weather[3] = (Last created weather effect)
      • Trigger - Run heavy Rain roll <gen> (ignoring conditions)
      • Trigger - Run Light rain roll <gen> (ignoring conditions)
      • Trigger - Run Wind roll <gen> (ignoring conditions)
      • Trigger - Run Normal roll <gen> (ignoring conditions)

Now i wonder, what could be the problem? oO
 
Level 5
Joined
Oct 17, 2006
Messages
151
So does any of your weather activate in game?

And, why do you have this at the bottom of the first trigger? There would be no point in repeating it as all it is doing is setting the roll number.

And my final question... How is this:

  • Set WeatherRoll[3] = False
Even possible? Variable names do not include [ and this next code you used is also something I have never seen before...

  • Set WeatherRoll[(Random integer number between 1 and 4)] = True
Are these your actual triggers or like did you write these in the post? o_O
 
Level 5
Joined
Oct 17, 2006
Messages
151
It's called arrays.

Every heard of em? <<

Oh LOL... dur!!!

Ok then things make a lil bit more sence... :grin:

I think your problem is the fact that you are repeating your main event over and over and over... Making it so that you weatherroll[#] is constantly changing every time this trigger is "re run". Try putting in a condition or a wait (condition) making sure that this wont happen.

Your code
Morning weather roll
Events
Game - The in-game time of day becomes Equal to 6.00
Conditions
Actions
Set WeatherRoll[1] = False
Set WeatherRoll[2] = False
Set WeatherRoll[3] = False
Set WeatherRoll[4] = False
Wait 1.00 seconds
Set WeatherRoll[(Random integer number between 1 and 4)] = True
Trigger - Run (This trigger) (checking conditions)
 
Level 5
Joined
Dec 18, 2007
Messages
205
What about only 1 trigger?

  • Weather
    • Events
      • Game - The in-game time of day becomes Equal to 6.00
      • Game - The in-game time of day becomes Equal to 18.00
    • Conditions
    • Actions
      • Umgebung - Remove Weather_Effect[1]
      • Umgebung - Remove Weather_Effect[2]
      • -------- Remove every weather effect created --------
      • Set Random Numer = (Random integer number between 1 and 4)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • IF-Conditions
          • Random Numer Equal To 1
        • THEN-Actions
          • Umgebung - Create at Area_U_Want1 <gen> the weather effect Weather_Effect_U_Want1
          • Set Weather_Effect[1] = (Last created weather effect)
          • Umgebung - Turn (Last created weather effect) On
          • -------- Create in all areas weather effect number 1 --------
        • ELSE-Actions
          • none
      • -------- Now make something for random number = 2 3 and 4 --------
You don't need 3 triggers. And you don't need a variable for the weather effects if you use this trigger.

Hope it works, greetz
 
Status
Not open for further replies.
Top