• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Rain weather effects cause issues with unit formations

Status
Not open for further replies.
Level 2
Joined
May 18, 2016
Messages
25
Hello, I'm trying to do a triggered weather system and whenever rain effects are up they just bug out unit formations. If I order a group of units to go somewhere they just completely ignore their formation and end up forming a grotesque and unholy mosh pit.

This only happens when it's raining, the other weather effects work just fine. Anyone know what's up this and if there's a way of fixing it?
 
Level 2
Joined
May 18, 2016
Messages
25
I'm legit trash with triggers, but the other weather effects work fine and don't affect formations at all. They're all roughly similar to this one, maybe with one or two more weather specific actions.

So aside from making it rain it's supposed to have a random duration chance, a random chance to have lightning and a random chance to have wind.

Alright, here it is:

  • Rain
    • Events
    • Conditions
    • Actions
      • Set WeatherDurationChance = (Random real number between 1.00 and 100.00)
      • Set WeatherLightningChance = (Random real number between 1.00 and 100.00)
      • Set WeatherWindChance = (Random real number between 1.00 and 100.00)
      • Environment - Create at (Playable map area) the weather effect Lordaeron Rain (Light)
      • Set WeatherEffect = (Last created weather effect)
      • Environment - Turn WeatherEffect On
      • Set WeatherBuffDebuffDummyPoint = (Center of (Entire map))
      • Unit - Create 1 Weather Dummy for Neutral Passive at WeatherBuffDebuffDummyPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_WeatherBuffDebuffDummyPoint)
      • Set WeatherBuffDebuffDummy = (Last created unit)
      • Unit - Add Rain to WeatherBuffDebuffDummy
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherLightningChance Greater than or equal to 1.00) and (WeatherLightningChance Less than or equal to 10.00)
        • Then - Actions
          • Trigger - Turn on Lightning Mild <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherLightningChance Greater than or equal to 15.00) and (WeatherLightningChance Less than or equal to 20.00)
        • Then - Actions
          • Trigger - Turn on Lightning Normal <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherLightningChance Greater than or equal to 25.00) and (WeatherLightningChance Less than or equal to 30.00)
        • Then - Actions
          • Trigger - Turn on Lightning Medium <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherLightningChance Greater than or equal to 35.00) and (WeatherLightningChance Less than or equal to 38.00)
        • Then - Actions
          • Trigger - Turn on Lightning Heavy <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherWindChance Greater than or equal to 1.00) and (WeatherWindChance Less than or equal to 20.00)
        • Then - Actions
          • Environment - Create at (Entire map) the weather effect Outland Wind (Light)
          • Set WeatherWindEffect = (Last created weather effect)
          • Environment - Turn WeatherWindEffect On
          • Trigger - Turn on Upwind <gen>
          • Trigger - Turn on Upwind Removal <gen>
          • Trigger - Turn on Downwind <gen>
          • Trigger - Turn on Downwind Removal <gen>
          • Unit - Remove Rain from WeatherBuffDebuffDummy
          • Unit - Add Storm to WeatherBuffDebuffDummy
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherWindChance Greater than or equal to 50.00) and (WeatherWindChance Less than or equal to 60.00)
        • Then - Actions
          • Environment - Create at (Entire map) the weather effect Outland Wind (Heavy)
          • Set WeatherWindEffect = (Last created weather effect)
          • Environment - Turn WeatherWindEffect On
          • Trigger - Turn on Upwind <gen>
          • Trigger - Turn on Upwind Removal <gen>
          • Trigger - Turn on Downwind <gen>
          • Trigger - Turn on Downwind Removal <gen>
          • Unit - Remove Rain from WeatherBuffDebuffDummy
          • Unit - Add Storm to WeatherBuffDebuffDummy
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherDurationChance Greater than or equal to 1.00) and (WeatherDurationChance Less than or equal to 25.00)
        • Then - Actions
          • Countdown Timer - Start WeatherRain as a One-shot timer that will expire in 60.00 seconds
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherDurationChance Greater than or equal to 26.00) and (WeatherDurationChance Less than or equal to 50.00)
        • Then - Actions
          • Countdown Timer - Start WeatherRain as a One-shot timer that will expire in 90.00 seconds
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherDurationChance Greater than or equal to 51.00) and (WeatherDurationChance Less than or equal to 75.00)
        • Then - Actions
          • Countdown Timer - Start WeatherRain as a One-shot timer that will expire in 120.00 seconds
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (WeatherDurationChance Greater than or equal to 76.00) and (WeatherDurationChance Less than or equal to 100.00)
        • Then - Actions
          • Countdown Timer - Start WeatherRain as a One-shot timer that will expire in 150.00 seconds
        • Else - Actions
 
Last edited:
Level 42
Joined
Feb 27, 2007
Messages
5,327
You are positive it is not any of the wind or lightning triggers? Disable all of the lightning and wind stuff (ctrl+f with lines selected) and confirm the problem persists.

What is the Rain ability? If some sort of aura, what is it based on? Are you sure your dummy unit has ghost or locust so it can't be collided with (which would affect pathjng and unit formations).
 
Level 2
Joined
May 18, 2016
Messages
25
What is the Rain ability? If some sort of aura, what is it based on?

Took turns on removing most actions from the trigger and it turns out it was that Rain buff that caused issues. It was supposed to be a map wide negative Endurance Aura to reduce ground unit movement speed a bit. Don't know why it would mess up formations though.

Anyway, it's fixed now, just going to use a periodic trigger to reduce movement speed.
 
Level 2
Joined
May 18, 2016
Messages
25
Yea but it wouldn't be that much of a problem to reset the movement speed back to its default value. Still, didn't think of using Unholy aura. Thanks, going to try it out.
 
Level 2
Joined
May 18, 2016
Messages
25
Just tried it with Unholy Aura and the outcome was similar to using Endurance Aura. Ah well, the movement speed triggers seem to work just fine.
 
Level 42
Joined
Feb 27, 2007
Messages
5,327
Instead of setting the unit's movespeed with triggers (for reasons I stated above) I would suggest creating a new ability based off of Tornado Slow Aura with targets set to: self, vulnerable, invulnerable and a slow value of whatever the rain slow should be (can use multiple levels for different strengths). You can change the buff to display something about Rain.

Then add that ability to/remove it from units you want to slow and interactions with all other movespeed-affecting things will be preserved. Tornado Slow Aura doesn't show up on the command card so you don't have to put it inside a disabled spellbook or anything.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Any chance it could be the aura? What happens if you remove it?

Also I noticed you were using multiple If-Then-Else statements. You can at least make the Duration actions at the end more efficient and simplify them by using a loop instead; there's a short example trigger I put together in the spoiler.

P.S.: I just noticed after creating the trigger below that you said you're not that great with triggering. Anyway, the trigger is there if you ever want to come back to it. Should really get some sleep though.

You can do this with a real variable like you have done already but there is a slightly smaller amount of conversions needed if it's an integer. The process is the essentially the same though, which is what I wanted to show you.

  • Duration Chance
    • Events
    • Conditions
    • Actions
      • Set WeatherDurationChance = (Random integer number between 1 and 100)
      • Set BoolKeepLooping = True
      • For each (Integer TempInteger) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WeatherDurationChance Less than or equal to (TempInteger x 25)
              • BoolKeepLooping Equal to True
            • Then - Actions
              • Set BoolKeepLooping = False
              • Set WeatherDurationTime = (Real((30 + (30 x TempInteger))))
              • Countdown Timer - Start WeatherRain as a One-shot timer that will expire in WeatherDurationTime seconds
            • Else - Actions
 
Level 2
Joined
May 18, 2016
Messages
25
Instead of setting the unit's movespeed with triggers (for reasons I stated above) I would suggest creating a new ability based off of Tornado Slow Aura with targets set to: self, vulnerable, invulnerable and a slow value of whatever the rain slow should be (can use multiple levels for different strengths). You can change the buff to display something about Rain.

Then add that ability to/remove it from units you want to slow and interactions with all other movespeed-affecting things will be preserved. Tornado Slow Aura doesn't show up on the command card so you don't have to put it inside a disabled spellbook or anything.

Huh, I'll have to give Tornado Aura a try then.

I strongly supports this statement. You should really check it out. Because its the only thing that seems to be able to mess with the unit formation thingy.

Yes, obviously.

Any chance it could be the aura? What happens if you remove it?

Yes, it was the aura.

Also I noticed you were using multiple If-Then-Else statements. You can at least make the Duration actions at the end more efficient and simplify them by using a loop instead; there's a short example trigger I put together in the spoiler.

P.S.: I just noticed after creating the trigger below that you said you're not that great with triggering. Anyway, the trigger is there if you ever want to come back to it. Should really get some sleep though.

Still learning how to properly use triggers, and now that I see what an unholy mess my weather triggers are, I've got to step it up big time. I'll definitely put your trigger to good use, thanks.
 
Level 2
Joined
May 18, 2016
Messages
25
I just don't get it man, tried Tornado Slow Aura and it was the same as using Endurance and Unholy. Even started a new map just to try this out in "safe" conditions.
 
Level 2
Joined
May 18, 2016
Messages
25
You don't add the modified tornado slow aura to the dummy unit. You add it to units you want to be slowed. Effectively you don't need the dummy at all.

Well, yea, that's what I literally just did and unit formations were still messed up resulting in a mosh pit.
 
Level 42
Joined
Feb 27, 2007
Messages
5,327
Weird. This leads me to think there is something strange going on in your map with unit pathing or something. Do you have LOTS of units on the map at once? Is the map huge with many doodads/destructables?

Is the 'jumbled' shape of units after moving through the rain the same each time you run the map (and order them to move to the same place), or is it different each time? If you order them to move only a little bit does it still mess them up?

Just for kicks, try doing what you did with Unholy/Endurance aura but use Brilliance/Devotion/Vampiric (obviously it won't slow, just seeing if all auras cause the same weirdness).
 
Level 2
Joined
May 18, 2016
Messages
25
Weird. This leads me to think there is something strange going on in your map with unit pathing or something. Do you have LOTS of units on the map at once? Is the map huge with many doodads/destructables?

Is the 'jumbled' shape of units after moving through the rain the same each time you run the map (and order them to move to the same place), or is it different each time? If you order them to move only a little bit does it still mess them up?

Just for kicks, try doing what you did with Unholy/Endurance aura but use Brilliance/Devotion/Vampiric (obviously it won't slow, just seeing if all auras cause the same weirdness).

Right now the map is just a unit/trigger/system/whatever test map. It's where I add in units, triggers, effects etc to test them out.

Well it's safe to say now that it isn't the rain visual effect that's causing issues, it's the buffs with negative values. I even tried this on a new and empty map and units displayed the same behavior when given tornado/unholy/endurance buffs.

Also I've got quite a few normal auras for units on the test map and those don't seem to cause any formation issues.
 
Level 2
Joined
May 18, 2016
Messages
25
Ah. If you wouldn't mind posting the test map I'd like to play with it. Curious if Tornado Slow with an effective MS bonus (rather than slow) will also cause this. Maybe nobody has noticed in 13 years that modified auras affect unit formations.

I'm not at home currently, I'll post it tomorrow.

You could try starting up a new map, adding a tornado slow aura to every unit on the map via triggers and see if you can replicate the issue in the meanwhile.


Hmm, I AM using the default Blizzard editor since I'm not a big fan of third party programs. Do you think that might be part of the issue?
 
Level 42
Joined
Feb 27, 2007
Messages
5,327
I'm not at home currently, I'll post it tomorrow.

You could try starting up a new map, adding a tornado slow aura to every unit on the map via triggers and see if you can replicate the issue in the meanwhile.


Hmm, I AM using the default Blizzard editor since I'm not a big fan of third party programs. Do you think that might be part of the issue?
I think that is unlikely, as the reason the 3rd party editors work at all is that under the hood they're not doing anything fundamentally different than the vanilla editors, just enabling more features that are walled from users. Could make my own map, I just want to have the same setup as you for a proper control; the scientist in me needs it. :p
 
Level 2
Joined
May 18, 2016
Messages
25
Well, alright, I'll post it tomorrow.

You MAY want to ready yourself for a heart attack or an aneurysm. I've a good number of triggers on the map and none of them are polished or masterfully crafted.
 
Level 2
Joined
May 18, 2016
Messages
25
Here's the map. The weather triggers are pretty messy right now, still figuring out what to add to or remove from them.
 

Attachments

  • Unit Test Map 2.29.64.w3x
    37.9 MB · Views: 132
Level 13
Joined
May 10, 2009
Messages
868
I've created a new map using the vanilla editor and added an unholy aura with -0.01 "bonus" (percentage set as false), and that's enough for messing with the unit formation. If you just remove the buff from the units, and reorder them to do what they were doing before, it restores their formation. However, that would lead to another problem, which would be the time that takes to re-apply the ''buff'' to the unit again. Players could just spam-click to not get that debuff .
I tried to work around that issue, writing the code below. It works, but I believe it could've been better:

JASS:
constant function UnholyAbil takes nothing returns integer
    return 'A000' // Custom Unholy Aura ( -0.01 MS "Bonus" )
endfunction

constant function UnholyBuff takes nothing returns integer
    return 'BUau' // Unholy Aura buff (default)
endfunction

function AddAbilityWithDelay takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen udg_NMS_index == 0
        call UnitAddAbility(udg_NMS_unit[i], udg_NMS_abil[i])
        set udg_NMS_index = udg_NMS_index - 1
        set udg_NMS_abil[i] = udg_NMS_abil[udg_NMS_index]
        set udg_NMS_unit[i] = udg_NMS_unit[udg_NMS_index]
        set i = i + 1
    endloop
endfunction

function NMSKeepFormation takes nothing returns boolean
    local unit u = GetTriggerUnit()
 
    if GetUnitAbilityLevel(u, UnholyAbil()) > 0 then
        // Avoiding infinite loops
        call DisableTrigger( GetTriggeringTrigger() )
 
        // Remove ability and buff from the unit
        call UnitRemoveAbility(u, UnholyAbil())
        call UnitRemoveAbility(u, UnholyBuff())
 
        // Re-order
        call IssuePointOrderById(u, GetIssuedOrderId(), GetOrderPointX(), GetOrderPointY())
 
        // Add ability to the unit
        set udg_NMS_unit[udg_NMS_index] = u
        set udg_NMS_abil[udg_NMS_index] = UnholyAbil()
        set udg_NMS_index = udg_NMS_index + 1
        call TimerStart(udg_NMS_timer, .03, false, function AddAbilityWithDelay) // I tried with 0.025*, sometimes it works. (*EDIT: I, previously, said "0.25")
 
        call EnableTrigger( GetTriggeringTrigger() )
    endif
 
    set u = null
    return false
endfunction

//===========================================================================
function InitTrig_Keep_Formation takes nothing returns nothing
    local trigger kform = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(kform, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition(kform, Condition(function NMSKeepFormation))
    set kform = null
endfunction

I've made it like that, because I'm not used to vJass (structs, libraries, etc), and also, I didn't want to lose compatibility with vanilla editor (creating non-udg_ variables by declaring a new global block).
 
Last edited:
Status
Not open for further replies.
Top