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

Removing weather effect bug

Status
Not open for further replies.
Level 5
Joined
Jul 14, 2014
Messages
115
I've been trying to create a dynamic weather system and found a pretty strange bug. Whenever I call
  • Environment - Remove any_weather_variable
on any variable all existing effects seem to disappear.

Here's an example trigger which looks like it does nothing:

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
    • Conditions
    • Actions
      • Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)
      • Environment - Turn (last created weather effect) on
      • Environment - Remove weather_wind


Thanks.
 
Last edited:
Level 6
Joined
Jun 4, 2017
Messages
172
I've been trying to create a dynamic weather system and found a pretty strange bug. Whenever I call
  • Environment - Remove any_weather_variable
on any variable all existing effects seem to disappear.

Here's an example trigger which looks like it does nothing:

  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
    • Conditions
    • Actions
      • Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)
      • Environment - Remove weather_wind


Thanks.
I think (but I'm not sure), that WC3 allows to have only 1 weather effect in a region(the playable map area in your case).
So the problem is that you have some weather effect first, then you try to add the rain but you can't because there is already a weather effect in the same region, and after that you remove the weather effect that you had, so you will not have any weather effect. You could try to remove the weather effect before adding a new one(maybe a wait of 0.1 seconds can help).
 
Level 5
Joined
Jul 14, 2014
Messages
115
I think (but I'm not sure), that WC3 allows to have only 1 weather effect in a region(the playable map area in your case).
So the problem is that you have some weather effect first, then you try to add the rain but you can't because there is already a weather effect in the same region, and after that you remove the weather effect that you had, so you will not have any weather effect. You could try to remove the weather effect before adding a new one(maybe a wait of 0.1 seconds can help).
Thing is that I want different effects to stack. I'm pretty sure that's possible for multiple reasons:
1. I've read on this forum that it is possible to stack one of each category of effects (rain, wind, light, etc).
2. Only one effect exists in my above example. So essentially I'm removing an empty weather effect.
3. This trigger applies 2 weather effects and works perfectly.

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)
      • Environment - Turn (Last created weather effect) On
      • Environment - Create at (Playable map area) the weather effect Outland Wind (Heavy)
      • Environment - Turn (Last created weather effect) On


So it must be a bug or am I missing something? How do I fix this?
 
Last edited:
Level 6
Joined
Jun 4, 2017
Messages
172
2. Only one effect exists in my above example. So essentially I'm removing an empty weather effect.
So it must be a bug or am I missing something? How do I fix this?
I made some tests and i saw that if you use the "Remove weather effect" trigger with an empty variable, it will remove only the first weather effect that you created.
 
Level 5
Joined
Jul 14, 2014
Messages
115
I made some tests and i saw that if you use the "Remove weather effect" trigger with an empty variable, it will remove only the first weather effect that you created.
Actually it looks like it removes the last created weather effect. Take a look at my system:

  • WeatherPrecipitation
    • Events
      • Time - Every 11.00 seconds of game time
    • Conditions
    • Actions
      • -------- Clear all precipitation effects --------
      • Environment - Turn weather_precipitation Off
      • Environment - Remove weather_precipitation
      • -------- Create a random chance --------
      • Set random = (Random integer number between 1 and 20)
      • Game - Display to (All players) the text: ((String(random)) + prec)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • random Less than or equal to 7
        • Then - Actions
          • -------- Apply a random precipitation effect --------
          • If (random Equal to 1) then do (Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)) else do (Do nothing)
          • If (random Equal to 2) then do (Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Light)) else do (Do nothing)
          • If (random Equal to 3) then do (Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Heavy)) else do (Do nothing)
          • If (random Equal to 4) then do (Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Light)) else do (Do nothing)
          • If (random Equal to 5) then do (Environment - Create at (Playable map area) the weather effect Northrend Blizzard) else do (Do nothing)
          • If (random Equal to 6) then do (Environment - Create at (Playable map area) the weather effect Northrend Snow (Heavy)) else do (Do nothing)
          • If (random Equal to 7) then do (Environment - Create at (Playable map area) the weather effect Northrend Snow (Light)) else do (Do nothing)
          • Set weather_precipitation = (Last created weather effect)
          • Environment - Turn weather_precipitation On
        • Else - Actions
          • Do nothing
  • WeatherWind
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • -------- Clear all wind effects --------
      • Environment - Turn weather_wind Off
      • Environment - Remove weather_wind
      • -------- Create a random chance --------
      • Set random = (Random integer number between 1 and 8)
      • Game - Display to (All players) the text: ((String(random)) + wind)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • random Less than or equal to 3
        • Then - Actions
          • -------- Apply a random wind effect --------
          • If (random Equal to 1) then do (Environment - Create at (Entire map) the weather effect Outland Wind (Heavy)) else do (Do nothing)
          • If (random Equal to 2) then do (Environment - Create at (Entire map) the weather effect Outland Wind (Light)) else do (Do nothing)
          • If (random Equal to 3) then do (Environment - Create at (Entire map) the weather effect Wind (Heavy)) else do (Do nothing)
          • Set weather_wind = (Last created weather effect)
          • Environment - Turn weather_wind On
        • Else - Actions
          • Do nothing

From what I've seen the previously created weather effect will be removed when removing any weather variable. It still seems like a bug. Is there any way to fix this or is it impossible?
 
Level 13
Joined
May 10, 2009
Messages
868
On map init, are you assigning any value to "weather_wind" variable? Every trigger that you've posted shows that you try to remove a weather effect from "weather_wind" var first, but I don't see it being initialized.
Unfortunately, trying to remove a "null" weather effect shouldn't do anything, but it does. The first time you execute the function like that, it removes the very first created weather effect, then it doesn't do anything until you create another weather effect. From now on, RemoveWeatherEffect(null) removes the last created weather effect.

To prevent those undesired effects, you can check if your variables are really storing anything before trying to remove them.
  • -------- Clear all wind effects --------
  • Custom script: if udg_weather_wind != null then
  • Environment - Remove weather_wind
  • Custom script: endif
  • -------- [...] --------
 
Level 6
Joined
Jun 4, 2017
Messages
172
Actually it looks like it removes the last created weather effect. Take a look at my system:

  • WeatherPrecipitation
    • Events
      • Time - Every 11.00 seconds of game time
    • Conditions
    • Actions
      • -------- Clear all precipitation effects --------
      • Environment - Turn weather_precipitation Off
      • Environment - Remove weather_precipitation
      • -------- Create a random chance --------
      • Set random = (Random integer number between 1 and 20)
      • Game - Display to (All players) the text: ((String(random)) + prec)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • random Less than or equal to 7
        • Then - Actions
          • -------- Apply a random precipitation effect --------
          • If (random Equal to 1) then do (Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Heavy)) else do (Do nothing)
          • If (random Equal to 2) then do (Environment - Create at (Playable map area) the weather effect Ashenvale Rain (Light)) else do (Do nothing)
          • If (random Equal to 3) then do (Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Heavy)) else do (Do nothing)
          • If (random Equal to 4) then do (Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Light)) else do (Do nothing)
          • If (random Equal to 5) then do (Environment - Create at (Playable map area) the weather effect Northrend Blizzard) else do (Do nothing)
          • If (random Equal to 6) then do (Environment - Create at (Playable map area) the weather effect Northrend Snow (Heavy)) else do (Do nothing)
          • If (random Equal to 7) then do (Environment - Create at (Playable map area) the weather effect Northrend Snow (Light)) else do (Do nothing)
          • Set weather_precipitation = (Last created weather effect)
          • Environment - Turn weather_precipitation On
        • Else - Actions
          • Do nothing
  • WeatherWind
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • -------- Clear all wind effects --------
      • Environment - Turn weather_wind Off
      • Environment - Remove weather_wind
      • -------- Create a random chance --------
      • Set random = (Random integer number between 1 and 8)
      • Game - Display to (All players) the text: ((String(random)) + wind)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • random Less than or equal to 3
        • Then - Actions
          • -------- Apply a random wind effect --------
          • If (random Equal to 1) then do (Environment - Create at (Entire map) the weather effect Outland Wind (Heavy)) else do (Do nothing)
          • If (random Equal to 2) then do (Environment - Create at (Entire map) the weather effect Outland Wind (Light)) else do (Do nothing)
          • If (random Equal to 3) then do (Environment - Create at (Entire map) the weather effect Wind (Heavy)) else do (Do nothing)
          • Set weather_wind = (Last created weather effect)
          • Environment - Turn weather_wind On
        • Else - Actions
          • Do nothing

From what I've seen the previously created weather effect will be removed when removing any weather variable. It still seems like a bug. Is there any way to fix this or is it impossible?
I see now, i think the problem is due to the fact that you remove your weather wind or rain at the start of the triggers but there is that the weather effect variable is empty, so the trigger will have to remove a weather effect stored in a empty variable so it will remove the other weather effect.
This is the rain code example that should work(also, put "Is_rain_on" False by default):
  • Rain
    • Eventi
      • Tempo - Every 11.00 seconds of game time
    • Condizioni
    • Azioni
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • Is_rain_on Uguale a TRUE
        • Allora - Azioni
          • Ambiente - Turn Rain No
          • Ambiente - Remove Rain
          • Set Is_rain_on = FALSE
        • Altrimenti - Azioni
      • Set Random = (Random integer number between 1 and 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • Random Minore o uguale a 7
        • Allora - Azioni
          • -------- ------------------------------- --------
          • -------- ------------------------------- --------
          • -------- ------------------------------- --------
          • -------- Put your types of rain here --------
          • -------- ------------------------------- --------
          • -------- ------------------------------- --------
          • -------- ------------------------------- --------
          • Set Rain = (Last created weather effect)
          • Set Is_rain_on = TRUE
        • Altrimenti - Azioni
 
Status
Not open for further replies.
Top