• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Magic resistance

Status
Not open for further replies.
You have to trigger it.
  • Actions
    • Unit - Add Magic Resistance (Temp) to (Triggering unit)
    • Wait 5.00 game-time seconds
    • Unit - Remove Magic Resistance (Temp) from (Triggering unit)
This will work fine assuming your Unit cannot gain the ability again during the 5.00 second Wait.

If that's going to be a problem then you can use Unit Indexing and a Unit Group to fix the issue. That or a Hashtable and Timers, or some combination of these methods. That's assuming you want to do things in GUI.

Edit: Threw this map together real quick. You can use this same design for any type of timed spell.

Note that Dispels/Control Magic will need to be accounted for if you're using Buffs with your custom spell. Dispels can be solved by checking if the Unit still has the Buff in the Loop trigger's Conditions (next to the Is Unit Alive condition). But Control Magic won't transfer any of the custom bonuses like the Magic Resistance to the casting unit which may be a problem.
 

Attachments

Last edited:
You have to trigger it.
  • Actions
    • Unit - Add Magic Resistance (Temp) to (Triggering unit)
    • Wait 5.00 game-time seconds
    • Unit - Remove Magic Resistance (Temp) from (Triggering unit)
This will work fine assuming your Unit cannot gain the ability again during the 5.00 second Wait.

If that's going to be a problem then you can use Unit Indexing and a Unit Group to fix the issue. That or a Hashtable and Timers, or some combination of these methods. That's assuming you want to do things in GUI.
Alright, this is what I had too. Was just wondering if there is a better ability to get this working.
Thanks
 
Easiest, and most efficient way to do this is to use a damage detection engine.
Give caster a buff.
When the caster takes damage, do a trigger which first checks if damage is of magical type.
If it is, reduce it by what you want.

If you need help getting into Damage Engine, let me know. You can find it here : Damage Engine 5.9.0.0

Using Waits in a trigger is not only not multiplayer available, but it can also cause big issues.
Using DE makes it so:
-When buff is dispelled, so is magic resistance
-Can change or stack values accordingly
-Multiple units can use this without issues
 
Last edited:
Easiest, and most efficient way to do this is to use a damage detection engine.
Give caster a buff.
When the caster is hit, do a trigger which first checks if damage is magical type.
If it is, reduce it by what you want.

If you need help getting into Damage Engine, let me know. You can find it here : Damage Engine 5.9.0.0
That is definitly no the easiest way. But I give you efficient.
 
It's as easy as copying the system, making a trigger which checks when unit takes damage, then checking if unit has buff, then checking if damage type is magical.

If you have no knowledge of coding it's probably the hardest thing in the world for you.
If you're any decent with triggering, even GUI, it takes maximum of 5 minutes to set this up.
 
I'm curious, since I can't find a single downside to using DE, what do you think it is? It doesn't slow down FPS/game. It doesn't cost much map size. It can even help in the long run by making non-armor based damage reduction spells. What's the downside?
I feel like it must slow the game down, there's 1000 lines of code running every time a unit takes damage, which can happen 1000s of times per second. Maybe it's not too noticeable on modern hardware and/or on less action packed maps but I know of people intentionally avoiding such a system in their map because of performance issues. Also, Bribe's system in particular introduces a lot of variables which bloat the editor.

That being said, it's not that big of a deal. I use the system in all of my non-Lua maps and have helped many people on here figure out how to use it as well. The downsides are there, although you may not care about them since the upsides are so great.
 
Last edited:
Status
Not open for further replies.
Back
Top