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

[Spell] AOE Invulnerability Spell Help!

Status
Not open for further replies.
Level 9
Joined
Apr 22, 2020
Messages
430
Can someone help make me a hero spell which makes units near the hero casting the spell invulnerable for a certain amount of time. Obviously this spell should be 3 tiered level spell which each level increases the Invulnerability duranation, decreases the cooldown and the Increasement of the AOE.
 
Level 9
Joined
Apr 22, 2020
Messages
430
Why not use the mass invu from shadowptiest (troll hero ultimate)
It's a channeled spell, what i want is just a cast spell and make my units units invulnerable without channeling it. Plus channeling the spell will make my hero not do anything.
 
Level 9
Joined
Apr 22, 2020
Messages
430
use a dummy unit ? do you want a test map?
If i use a dummy unit that means the dummy unit will have the "Big Bad Vodoo" spell which makes NEARBY ALLIES NEAR THE DUMMY UNIT TO BE INVULNERABLE. Which i clearly not what i would want, what i want is the caster cast a spell which nearby allies affected to it will be invulnerable. Wouldn't having a dummy unit cast the big bad vodoo spell makes nearby units invulnerable which means if a unit is near the hero will be invulnerable, which i clearly don't want, i want it to be only the units affected by the spell to be invulnerable. Plus it's a 3 tiered level spell that i want.
 
Level 9
Joined
Apr 22, 2020
Messages
430
2 Choices :) and yes the one with the dummy i let evryone see a ghost dummy channeling so it feels cooler :p
If it's no trouble can you post the trigger of it? I'm not using my laptop right now because i'm not home so just a little heads up in case i have questions regarding of how you made the trigger.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Here's a working setup:
  • Invulnerability Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Duration and AoE per level --------
      • Set VariableSet Inv_AoE[1] = 300.00
      • Set VariableSet Inv_AoE[2] = 450.00
      • Set VariableSet Inv_AoE[3] = 600.00
      • Set VariableSet Inv_Duration[1] = 4.00
      • Set VariableSet Inv_Duration[2] = 6.00
      • Set VariableSet Inv_Duration[3] = 8.00
  • Cast Invulnerability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Test Ability
    • Actions
      • Set VariableSet Inv_Level = (Level of (Ability being cast) for (Triggering unit))
      • Set VariableSet Inv_Point = (Position of (Triggering unit))
      • Set VariableSet Inv_Group = (Units within Inv_AoE[Inv_Level] of Inv_Point.)
      • Unit Group - Pick every unit in Inv_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Unit - Add Invulnerable (New) to (Picked unit)
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Inv_Group.
      • Custom script: call RemoveLocation (udg_Inv_Point)
      • Wait Inv_Duration[Inv_Level] seconds
      • Unit Group - Pick every unit in Inv_Group and do (Actions)
        • Loop - Actions
          • Unit - Remove Invulnerable (New) from (Picked unit)
          • Unit Group - Remove (Picked unit) from Inv_Group.
      • Custom script: call DestroyGroup (udg_Inv_Group)
Invulnerable (New) is a copy & pasted version of the Invulnerable (Neutral) ability. You can adjust it's Art - Target field to add your own art.

Note that it's not MUI, meaning it will only work for 1 Hero, and the Cooldown needs to be longer than the Duration to avoid bugs.
 

Attachments

  • Invulnerability 1.w3m
    19.2 KB · Views: 9
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
They recommend avoiding Waits because most information gets lost between them. Waits are also imprecise on BNET due to latency/syncing, but this imprecision is often pretty small.

For example, this DOESN'T work because of the Wait:
  • BAD
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Wait 2.00 seconds
      • Unit - Kill (Target unit of ability being cast)
Target unit of ability being cast no longer exists after the Wait.

This DOES work however, because there is no Wait:
  • GOOD
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Unit - Kill (Target unit of ability being cast)
But I want to use a Wait, so how do we fix this issue? Well, we can use variables to keep track of the Target unit of ability being cast:
  • Simple Non-MUI Fix
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Set VariableSet Target = (Target unit of ability being cast)
      • Wait 2.00 seconds
      • Unit - Kill Target
But this still isn't perfect.

If multiple units have the Storm Bolt ability then problems can occur, this is because they're both sharing the Target variable, and Target can only ever be set to one unit at a time.
This may cause situations in which a unit is never killed because it's no longer set as Target after the 2.00 second Wait. This is what we call a non-MUI trigger.

But that doesn't mean that this is necessarily bad. As long as only 1 Unit has the Storm Bolt ability, and as long as the cooldown is longer than the Wait, then it will work perfectly fine. This is because the trigger will always finish before you can cast the ability again, so Target won't ever get overwritten.

To make your trigger MUI you can use one of many options such as Unit Indexing, Hashtables, and Dynamic Indexing to list a few. Unit Indexing is a personal favorite and is what I'd use to make this Invulnerability ability MUI.
 
Last edited:
Level 20
Joined
Feb 27, 2019
Messages
593
This is a way to give on use items to units even though they dont have an inventory but its incompatible with any Unit Inventory abilities. I tried to remedy this issue but it became a clusterfuck so I gave up. I believe it can be done though but I faced some dumb issues. So if you have any Unit Inventory abilities, this wont work.

What I added:
Unit Inventory Custom = Unit Inventory (Human) with the boolean Can Use Items set to True and removed techtree requirements.
Changed the field Use automatically when aquired on the items.

I attached a map if you want to check it out.

  • Setup Hero Spell
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set VariableSet Base = 350.00
      • Set VariableSet Increase = 100.00
      • Set VariableSet Item[1] = Potion of Lesser Invulnerability
      • Set VariableSet Item[2] = Potion of Invulnerability
      • Set VariableSet Item[3] = Potion of Divinity
  • Hero Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hero Spell
    • Actions
      • Set VariableSet Int_Calc = (Level of Hero Spell for (Triggering unit))
      • Set VariableSet Real_Calc = (Base + (Increase x (Real(Int_Calc))))
      • Set VariableSet Loc = (Position of (Triggering unit))
      • Set VariableSet Group = (Units within Real_Calc of Loc.)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not equal to (Triggering unit)
              • ((Picked unit) belongs to an ally of (Triggering player).) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to False
                • Then - Actions
                  • Unit - Add Unit Inventory (Custom) to (Picked unit)
                • Else - Actions
              • Hero - Create Item[Int_Calc] and give it to (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to False
                • Then - Actions
                  • Unit - Remove Unit Inventory (Custom) from (Picked unit)
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_Group)
      • Custom script: call RemoveLocation(udg_Loc)
EDIT: Lol picked unit is alive equal to true would be a useful condition to add and picked unit is a structure equal to false, good that Uncle knows what hes doing at least
 

Attachments

  • hero spell.w3m
    20.4 KB · Views: 9
Last edited:
Level 9
Joined
Apr 22, 2020
Messages
430
Thanks for all of your help guys, and i tried your trigger @Uncle and it's work perfectly but, is thier a way to show the buff is in the unit? I'm using Roar as the base of the invulnerable spell and when the hero cast the spell all unit within the area is invulnerable but it does not show the buff on them. I'm sure that roar always shows the buff whenever it's in a unit but, why doesn't it show?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,564
Thanks for all of your help guys, and i tried your trigger @Uncle and it's work perfectly but, is thier a way to show the buff is in the unit? I'm using Roar as the base of the invulnerable spell and when the hero cast the spell all unit within the area is invulnerable but it does not show the buff on them. I'm sure that roar always shows the buff whenever it's in a unit but, why doesn't it show?
Are the units actually affected by Roar? Invulnerability can turn off buffs so make sure Roar's Targets Allowed has Invulnerable + Vulnerable.
 
Status
Not open for further replies.
Top