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

Ancient Protector spell immunity problem

Level 11
Joined
Sep 11, 2013
Messages
327
Greetings!
I have a new problem with my building Ancient Protector tower and i have no ideea how to solve this.

My tower has an upgrade that give him spell immunity to all spells(also, can't be targeted with spells), but i have another unit which have inner fire spell and i want to give that spell/buff (+armor / +damage) to my Ancient protector building. I can't because is obvious.. spell immunity..
How can i put that inner fire exception in spell immunity? :peasant-sad:

The help will be appreacited!
 
Last edited:
Level 13
Joined
Mar 23, 2008
Messages
1,214
Iirc spellbreakers in the base game have magic immunity, but can still be targeted by friendly spells like paladin’s holy light. You could look into that synergy.
It might also be because your tower has the “building” type and inner fire can’t target buildings.
Not a very technical answer, but it might help 😅
 
Level 11
Joined
Sep 11, 2013
Messages
327
Iirc spellbreakers in the base game have magic immunity, but can still be targeted by friendly spells like paladin’s holy light. You could look into that synergy.
It might also be because your tower has the “building” type and inner fire can’t target buildings.
Not a very technical answer, but it might help 😅
This a very good start! Thanks! Indeed the holy light pierce spell immunity, but i don't understand why.. I've put the same target allowed, but only Holy lights works.. Inner fire can target buildings, but not spell immunity.

I still need to figure out how to put the damage bonus 10% and bonus 5 armor..
 
Level 11
Joined
Nov 13, 2010
Messages
211
i dont think you can target a building or a unit with Inner fire as long it got spell immunity.

i did give a try with this
  • test
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Inner Fire test
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Targeted unit)) Equal to Test Tower
            • Then - Actions
              • Unit - Remove Spell Immunity from (Targeted unit)
              • Wait 1.00 seconds
              • Unit - Add Spell Immunity to (Targeted unit)
            • Else - Actions
        • Else - Actions
 
Level 11
Joined
Sep 11, 2013
Messages
327
i dont think you can target a building or a unit with Inner fire as long it got spell immunity.

i did give a try with this
  • test
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Inner Fire test
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Targeted unit)) Equal to Test Tower
            • Then - Actions
              • Unit - Remove Spell Immunity from (Targeted unit)
              • Wait 1.00 seconds
              • Unit - Add Spell Immunity to (Targeted unit)
            • Else - Actions
        • Else - Actions
I tried, but the message is the same : This unit is immune to magic.

It won't let me to cast the inner fire spell.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
You can make an ability pierce Spell Immunity by marking it as a Hero ability and setting it's Required Level to 6. This tells the game that it's an "Ultimate" which should bypass immunities. You can then uncheck the Hero field after setting the Required Level to 6 because all it cares about is the level requirement.

For the sake of clarity, Polardudes trigger would work if he did it like this:
1: User casts fake "Inner Fire" ability.
2: Remove Spell Immunity from (Target unit of ability being cast) - NOT (Targeted unit) since that's the wrong Event Response.
3: Order Dummy unit to cast Inner Fire on (Target unit of ability being cast).
4: Add Spell Immunity back to (Target unit of ability being cast).

But that isn't ideal since it may leave a small 1 frame window where your unit is no longer Spell Immune and an unwanted spell can slip by.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Another possible solution, that is less ideal than some of the above, would be to try giving the tower "resistant skin" (from mountain giant) rather than "spell immune". This would make it out right resist some debuffs and otherwise be treated as a hero for others. Depending on what debuffs it is up against, this might be enough.
 
Level 11
Joined
Sep 11, 2013
Messages
327
You can make an ability pierce Spell Immunity by marking it as a Hero ability and setting it's Required Level to 6. This tells the game that it's an "Ultimate" which should bypass immunities. You can then uncheck the Hero field after setting the Required Level to 6 because all it cares about is the level requirement.
I have already disable that option from constants because i have many ultimates that must be not able to pierce spell immunity.
1: User casts fake "Inner Fire" ability.
What is this fake "Inner Fire"?? It can be Holy light?

But that isn't ideal since it may leave a small 1 frame window where your unit is no longer Spell Immune and an unwanted spell can slip by.
Indeed..
 
Level 11
Joined
Sep 11, 2013
Messages
327
Another possible solution, that is less ideal than some of the above, would be to try giving the tower "resistant skin" (from mountain giant) rather than "spell immune". This would make it out right resist some debuffs and otherwise be treated as a hero for others. Depending on what debuffs it is up against, this might be enough.
This will not work for me, but thanks for the suggestion!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
I have already disable that option from constants because i have many ultimates that must be not able to pierce spell immunity.

What is this fake "Inner Fire"?? It can be Holy light?


Indeed..
It can be any unit targeted ability that doesn't cause problems. Holy Light may not work on full hp units and this "fake" spell needs to be able to bypass Spell Immunity. Maybe Ensnare with a 0.001 second duration would work nicely.
 
Level 11
Joined
Sep 11, 2013
Messages
327
It can be any unit targeted ability that doesn't cause problems. Holy Light may not work on full hp units and this "fake" spell needs to be able to bypass Spell Immunity. Maybe Ensnare with a 0.001 second duration would work nicely.
  • Untitled Trigger 002
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ensnare (Neutral Hostile) XXX
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Target unit of ability being cast)) Equal to Ancient Protector
            • Then - Actions
              • Set VariableSet TempPointINV = (Position of (Triggering unit))
              • Unit - Remove Spell Immunity ZZ from (Target unit of ability being cast)
              • Unit - Create 1 Dummy [1] for (Owner of (Triggering unit)) at TempPointINV facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Inner Fire X to (Last created unit)
              • Unit - Set level of Inner Fire X for (Last created unit) to (Level of Ensnare (Neutral Hostile) XXX for (Triggering unit))
              • Unit - Order (Last created unit) to Human Priest - Inner Fire (Target unit of ability being cast)
              • Unit - Add Spell Immunity ZZ to (Target unit of ability being cast)
              • Custom script: call RemoveLocation(udg_TempPointINV)
            • Else - Actions
        • Else - Actions
I don't understand.. Inner Fire work great, but the Spell Immunity didn't come back to Ancient protector.. Even if i put a wait 1 second and then Add Spell Unit - Add Spell Immunity ZZ to (Target unit of ability being cast) the trigger do not work.

what could be the problem?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
You should try something like this:
  • Inner Fire Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare (Neutral Hostile) XXX
    • Actions
      • Set VariableSet IF_Target = (Target unit of ability being cast)
      • Set VariableSet IF_Point = (Position of IF_Target)
      • Unit - Create 1 Dummy [1] for (Owner of (Triggering unit)) at IF_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_IF_Point)
      • Set VariableSet IF_Dummy = (Last created unit)
      • Unit - Add a 0.20 second Generic expiration timer to IF_Dummy
      • Unit - Add Inner Fire X to IF_Dummy
      • Unit - Set level of Inner Fire X for IF_Dummy to (Level of Ensnare (Neutral Hostile) XXX for (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of IF_Target) Equal to Ancient Protector
        • Then - Actions
          • Unit - Remove Spell Immunity ZZ from IF_Target
          • Unit - Order IF_Dummy to Human Priest - Inner Fire IF_Target
          • Unit - Add Spell Immunity ZZ to IF_Target
        • Else - Actions
          • Unit - Order IF_Dummy to Human Priest - Inner Fire IF_Target
Your current design makes the ability only work on Ancient Protectors and uses the wrong Event. With this design it will cast Inner Fire on the target regardless of what it is, but will also make a special case for Ancient Protectors and remove their Spell Immunity temporarily.

I recommend using ALL of those variables and you MUST make sure that your Dummy unit is setup correctly.

Here's how to make a proper Dummy unit:
1: Copy and paste the Locust unit.
2: Change the following fields, Movement Type = None, Speed Base: 0, Model = None, Shadow = None, Attacks Enabled = None.

You now have a Dummy unit which can cast abilities immediately without needing to turn to face it's target and without any delays that would prevent it from casting multiple times in the same game frame. Also, make sure that your Dummy abilities have 99999 cast range, 0 mana cost, 0 cooldown, the correct Targets Allowed, and no Requirements!

Also, it may make more sense to have a separate trigger which detects when the Inner Fire ability is cast and adds Spell Immunity back to the Ancient Protector. So the above trigger would only Remove Spell Immunity from the Ancient Protector and then once the Dummy casts Inner Fire on the target it would Add Spell Immunity back.
 
Last edited:
Level 11
Joined
Sep 11, 2013
Messages
327
You should try something like this:
  • Inner Fire Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ensnare (Neutral Hostile) XXX
    • Actions
      • Set VariableSet IF_Target = (Target unit of ability being cast)
      • Set VariableSet IF_Point = (Position of IF_Target)
      • Unit - Create 1 Dummy [1] for (Owner of (Triggering unit)) at IF_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_IF_Point)
      • Set VariableSet IF_Dummy = (Last created unit)
      • Unit - Add a 0.20 second Generic expiration timer to IF_Dummy
      • Unit - Add Inner Fire X to IF_Dummy
      • Unit - Set level of Inner Fire X for IF_Dummy to (Level of Ensnare (Neutral Hostile) XXX for (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of IF_Target) Equal to Ancient Protector
        • Then - Actions
          • Unit - Remove Spell Immunity ZZ from IF_Target
          • Unit - Order IF_Dummy to Human Priest - Inner Fire IF_Target
          • Unit - Add Spell Immunity ZZ to IF_Target
        • Else - Actions
          • Unit - Order IF_Dummy to Human Priest - Inner Fire IF_Target
Your current design makes the ability only work on Ancient Protectors and uses the wrong Event. With this design it will cast Inner Fire on the target regardless of what it is, but will also make a special case for Ancient Protectors and remove their Spell Immunity temporarily.

I recommend using ALL of those variables and you MUST make sure that your Dummy unit is setup correctly.

Here's how to make a proper Dummy unit:
1: Copy and paste the Locust unit.
2: Change the following fields, Movement Type = None, Speed Base: 0, Model = None, Shadow = None, Attacks Enabled = None.

You now have a Dummy unit which can cast abilities immediately without needing to turn to face it's target and without any delays that would prevent it from casting multiple times in the same game frame. Also, make sure that your Dummy abilities have 99999 cast range, 0 mana cost, 0 cooldown, the correct Targets Allowed, and no Requirements!

Also, it may make more sense to have a separate trigger which detects when the Inner Fire ability is cast and adds Spell Immunity back to the Ancient Protector. So the above trigger would only Remove Spell Immunity from the Ancient Protector and then once the Dummy casts Inner Fire on the target it would Add Spell Immunity back.
Well.. I've made everything as you said, but i just discovered that is impossible because after the spell immunity is back, each buff will dissapear.
Spell immunity don't allow positive or negative buffs so is just impossible i think..
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
Hmm, I was always under the impression that it only stopped future effects from applying. Luckily, we can salvage this and keep most of the existing trigger the same.

So instead of trying to cast Inner Fire on the Ancient Protector, let's add abilities to it which function like Inner Fire. So you can add a Command Aura ability for the +% damage, an Item Armor Bonus ability for the bonus armor, and an Item Life Regen ability for the bonus regen. Then after X seconds (when the buff would normally expire), remove these abilities.

This could be handled with a Unit Indexer system and the standard design of a Unit Group + Loop trigger for tracking the duration of the effects and removing them when necessary. You only want to add these abilities if the Ancient Protector doesn't already have them, so you would check for this before adding them. The Item abilities may stack so you definitely don't want to add multiple copies.
 
Level 11
Joined
Sep 11, 2013
Messages
327
Hmm, I was always under the impression that it only stopped future effects from applying. Luckily, we can salvage this and keep most of the existing trigger the same.

So instead of trying to cast Inner Fire on the Ancient Protector, let's add abilities to it which function like Inner Fire. So you can add a Command Aura ability for the +% damage, an Item Armor Bonus ability for the bonus armor, and an Item Life Regen ability for the bonus regen. Then after X seconds (when the buff would normally expire), remove these abilities.

This could be handled with a Unit Indexer system and the standard design of a Unit Group + Loop trigger for tracking the duration of the effects and removing them when necessary. You only want to add these abilities if the Ancient Protector doesn't already have them, so you would check for this before adding them. The Item abilities may stack so you definitely don't want to add multiple copies.
This "unit indexer" is way too complicated for my brain:)) I think i'll just use item inventory slots for ancient protector or some other work around..
Thanks for help anyway! :peasant-ok-hand:
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
This "unit indexer" is way too complicated for my brain:)) I think i'll just use item inventory slots for ancient protector or some other work around..
Thanks for help anyway! :peasant-ok-hand:
A Unit Indexer is a very simple system, I'm sure you'd find it easy to use if you spent some time figuring it out (it's worth it).

This particular system automatically runs once you've imported it into your map - so by copying and pasting the folder into the Trigger Editor you're already done.

So what does it do exactly?
All the Unit Indexer does is assign a unique number to each unit in your map, whether they're preplaced or created in the future (trained from a barracks, bought from a merchant, created in a trigger, etc).

How does it do this exactly?
The system assigns this unique number using this custom value Action:
  • Unit - Create 1 Footman...
  • Unit - Set the custom value of (Last created unit) to 100
100 in that example would be a number that the system has determined isn't being used by another unit.

So if you had 50 Footman running around your map, each of them would be assigned a number between 1 and 50 with NO repeats! It's important that each Footman has it's own unique number because we're going to use this number like an ID to store data to the unit. It's similar to how in real life we all have a unique ID on our driver's license or birth certificate, and it's important that these are different numbers since that's how we can identify one person from another.

Why is all of this useful?
It's useful because of another important thing to understand, Variable Arrays:
  • Set Variable AbilityPower[1] = 100.00
  • Set Variable AbilityPower[2] = 200.00
  • Set Variable AbilityPower[3] = 300.00
I'm sure you've seen these before, they're just a slightly more advanced version of a normal Variable. An Array allows us to store a bunch of different data inside of the same Variable as long as we use different [indexes] for each. The [index] is the Integer that you put inside of the variable's brackets [ ].

So in the above example I've stored the value 100.00 at AbilityPower[1], 200.00 at AbilityPower[2], and 300.00 at AbilityPower[3].

How does this tie back into the Unit Indexer and Custom Value?
Simple, we can plug any unit's Custom Values into the [index] of any of our Variable Arrays to store data directly to that unit:
  • Unit - Create 1 Mountain King...
  • Set Variable AbilityPower[(Custom value of (Last created unit)] = 100.00
  • Unit - Create 1 Archmage...
  • Set Variable AbilityPower[(Custom value of (Last created unit)] = 250.00
In the above example, I've given the Mountain King I just created an AbilityPower value of 100. I've also given the Archmage I just created an AbilityPower value of 250. This value is now stored directly to the heroes and can be referenced from ANY of our other triggers at ANY time!

Here's an example of us referencing it at a later time:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Storm Bolt
    • (Unit-type of (Casting unit)) Equal to Mountain King
  • Actions
    • Unit - Cause (Casting unit) to deal AbilityPower[(Custom value of (Casting unit))] damage to (Target unit of ability being cast)...
In the above example, our Mountain King's Storm Bolt is going to deal an additional 100.00 damage because we've referenced his AbilityPower[] variable by using his custom value in it's [index].

It's really that simple, just a couple of Actions and a basic understanding of Arrays. Once you understand that, you can proceed to making slightly more advanced triggers with Unit Groups + Loop triggers like I mentioned before. Just take it one step at a time and everything will become much easier to understand.
 
Last edited:
Top