• 🏆 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] Selective Spell Immunity?

Status
Not open for further replies.
Level 3
Joined
Sep 9, 2009
Messages
658
That's just for targeted spells, though. For AOE and other affects you'll probably have to check on a per-spell basis.

Sorry, but can you elaborate on that a bit more? This is the first time I'm trying to make a spell like this so I don't really know how to go about it without detailed instructions.

Oh, and I have a question about the first trigger...if you were playing against the AI, wouldn't that make it stop periodically or something like that? Because the AI wouldn't know you have a spell immunity passive and thus would just stop and then try to cast the spell again on you?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
If AI is an important part of your map, you'd have to re-order the AI to do something else.

Do you intend to use this more for standard abilities? My earlier statement was based on the assumption that almost all abilities would be custom.
If indeed so, maybe you can try this:
whenever a unit starts the effect of an ability targeting the immune unit, you temporarily give it the real Spell Immunity ability to negate the effects. Or a dummy unit that casts Anti-Magic Shell.

Basically, it's not really an easy thing to make. There are a lot of workarounds involved.
 
Level 3
Joined
Sep 9, 2009
Messages
658
Yeah, the AI is an important part of the map. The spell immunity would only apply to standard abilities. And yeah, making the spell isn't as easy as I first thought it would.

Anyway, would adding the magic immune classification to the unit work? If not then I'll add the real spell immunity to negate the effects.

As for non-target spells, what if I pick every unit within the playable map, or at least within a certain distance of the caster with the condition of having the selective immunity and add real spell immunity the moment an enemy casts a spell?

If that works, for how long should the spell immunity last? And what when multiple enemies cast a spell? Wouldn't that interfere with allies targeting the unit?

Edit: Actually, I think I found a better way. What if I put spell immunity in a disabled spellbook and every time an enemy unit casts a spell, I add it to the unit and every time an ally casts a spell, I remove the spellbook? Would that work?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I've just done some tests using variations of:
events - order, starts effect of ability, beings casting ability
actions - add/remove spell immunity (instantly), add/remove invulnerability (instantly), order caster to stop.

None of these work. I'm trying a few more things.

EDIT: here's a method that sort of works:
  • spell immune
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set writeIndex = (writeIndex + 1)
      • Set immuneUnit[writeIndex] = (Target unit of ability being cast)
      • Wait 1.00 seconds
      • Set readIndex = (readIndex + 1)
      • Unit - Add Spell Immunity to immuneUnit[readIndex]
      • Unit - Remove Spell Immunity from immuneUnit[readIndex]
It's a delayed spell immunity - 1 second after a spell is cast, the target receives spell immunity. The test map had banshees vs sorceresses, and both succeeded in losing the buffs. Then you'd have to work mana/cooldown refunds into it somehow.

The other problem we have is damage abilities.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
You could try a different route without any triggering but requires more object editor work.
Make all unit spells that can target allies be able to target magic immune units. This can be done by changing the ability to a hero spell, setting the required level to 2, and then changing the ability back to a unit spell.

This wouldn't really work well for hero abilities and wouldn't be appropriate for all abilities like those that can target allies and enemies.
 

Attachments

  • SelectiveMagicImmunity.w3x
    7.8 KB · Views: 47
Level 14
Joined
Nov 18, 2007
Messages
1,084
The troll is not supposed to be able to use Inner Fire on the spellbreaker like the spell tooltip says; only the priest can.

My above post stated the method to make an ability target a magic immune unit. If you didn't understand, this is the basic object editor work for a unit ability:

  1. Set Stats - Hero Ability to true.
  2. Set Stats - Required Level to 2.
  3. Set Stats - Hero Ability to false.
 
Status
Not open for further replies.
Top