• 🏆 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 Damage Reduction Items- Apply Strongest, Not Newest

Status
Not open for further replies.
Level 8
Joined
Jul 8, 2013
Messages
249
I have a category of items (shields) in a game which use the item ability Spell Damage Reduction to decrease damage taken from spells.

Some shields are better at this than others.


As many of you may know, multiple items with Spell Damage Reduction do not stack. (That's perfect, I don't want people benefiting from more than 1 shield at a time!). Instead, only the most recently acquired source of Spell Damage Reduction applies.

So if a character picks up a good shield (say, 40% damage reduction) and then later picks up a bad shield (20% damage reduction), only the BAD shield will apply!

What I would prefer is that instead of only the most recent shield applying, the best shield applies. So if you pick up a good shield and then a bad shield, the good shield applies.

Is there a straightforward way to do that or would it require a time-consuming workaround?
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
a basic way to do this -

choose one of the fields in the object editor for the items, that you will hijack as your priority index. you could use the field "priority"(I believe that is for the AI) or hp (changing this amount of hp will not really affect gameplay) for example.

then change the items so that field is cascading in order of priority for all of your shields. (so for the best one hp = 75, the next one is 76 etc').

then when a character picks up a shield - check it's integer field (of the previously mentioned field) and only apply the shield it if it's Priority value is lower than the one already applied.

If you don't already have a way to track the shield currently applied, you could create a hidden ability that all of the heroes have, and change it's level to the relevant level each time they get a shield. and then just compare that integer level to the above. (don't forget to reset it when the effect wares off)
 
Last edited:
Level 8
Joined
Jul 8, 2013
Messages
249
I'm noticing a new problem:

I have a unit which has an ability based on Elune's Grace, to reduce magic damage by a %. I want this to stack with having a shield. However, I am noticing that the shield supercedes that ability rather than stacking with it.

Is there a way to make this unit's passsive magic resistance stack with that granted by an item?
 
Level 8
Joined
Jul 8, 2013
Messages
249
I found a solution!


As a reminder, what I wanted is for items which grant spell resistance to not stack with one another, but I did want them to stack with the passive spell resistance of some units.

That's not possible with either Elune's Grace or Spell Damage Reduction.


But what I realized is that WC3 has several armor types built into the game which are never used anywhere (such as 'Normal' and 'Unknown') and others which are very rarely used (such as 'Divine').

I just edited one of those unused armor types in the gameplay constants and game interface to look and function exactly the same as one of the real armor types, but have spell damage resistance built in!

Now the unit can just have a dummy ability SAYING that it grants spell resistance, but the real spell resistance can secretly come from the armor type! And this stacks in exactly the way I want.
 
Status
Not open for further replies.
Top