• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] Faerie Fire Increase spell damage taken

Level 31
Joined
Dec 3, 2020
Messages
1,250
Hi, so I'm trying to make Faerie Fire make the target enemy unit take 15% more damage from spells, apart from the armor reduction and vision.
I have a unit called Troll Conjurer who uses it and as long as the buff is applied on the unit, I want the spell damage increase to be applied.
Here is what I've come up with so far but I'm pretty sure it's wrong since it's not "global".

1769713645133.png

FaerieFireInteger is set to 0 at start of map.

Any help would be appreciated. Would be great if it didn't use any new trigger related stuff past patch 1.29.2, since that's the version I am using on the editor and game.
 
Yea, that trigger is no good: It will work very inconsistently. You just need 3 units to see the issue: Units A, B and C. The "Pick every unit..." action processes those units in the order A, then B and finally C.

Case 1: A and B have Faerie Fire buff and C does not
Trigger is processing unit A, find out that A has the Buff and FaerieFireInteger is 0, so it adds "Spell Damage Increase (15%)" to unit A and sets FaerieFireInteger to 1. Next it processes unit B. Trigger detects that unit B also has the buff, but FaerieFireInteger is 1, so it skips this unit. Finally it processes unit C, detects it does not have the buff so it resets FaerieFireInteger to 0.

Case 2: A and C have Faerie Fire buff and B does not
Processing of unit A is same as in previous case, but this time trigger detects that unit B does not have the buff so it resets FaerieFireInteger to 0. When unit C is being processed, trigger detects it has the buff and FaerieFireInteger is now 0 (thanks to unit B), so trigger adds "Spell Damage Increase (15%)" to unit C and sets FaerieFireInteger to 1.

So depending on the order of units being processed, cases #1 and #2 provided different results. In case #1 only one unit got the spell damage ability, but it should be two units that got it. In case #2 two units got it (as they should) but the second unit got it only because there was a unit without the buff processed between the two units with the buff.

Some less relevant issues:
  • You are leaking unit group every run of that trigger. Considering this trigger seems like it will run for the entirety of the map (and if you have more similar trigger that also leak), it can ramp up a lot of leaked memory in later stages of the game, which will result in lowered FPS
  • Picking every unit in the entire map for this? Again, if you have more such triggers where you pick all units in map, it can lower FPS (especially if there are a ton of units in game).

As for how to fix it, the simplest way is to have a trigger with "Unit takes damage" event (or use DDS). In that trigger check if targeted unit has buff and attack type is spell and if so, just increase damage done by 15%. Something like this could work (though it requires to be on newer versions)
  • Takes damage
    • Events
      • Unit - A unit About to take damage
    • Conditions
      • (Damage From Normal Attack) Equal to False
      • ((Damage Target) has buff Faerie Fire) Equal to True
    • Actions
      • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 1.15)
DDS should also be able to achieve the same thing, although the trigger will look a bit different.

If you want to avoid DDS/above trigger, then you can solve your issue using two triggers:
  • Have a unit group variable specifically for this spell, e.g. FaerieFireGroup
  • Have a trigger with "Unit starts the effect of a an ability" event to detect when unit starts casting your spell. In that trigger add to target the "Spell Damage Increase (15%)" ability and add the target to FaerieFireGroup
  • Have a second trigger that periodically iterates over all units in the FaerieFireGroup. Check if each picked unit still has the FaerieFire buff. If unit does not have the buff or it is dead, just remove from it the spell damage ability and remove it from the unit group.
 
Like this:
  • Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Faerie Fire
    • Actions
      • Unit - Add Spell_Dmg_Increase to (Target unit of ability being cast)
      • Unit Group - Add (Target unit of ability being cast) to FaerieFireGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FaerieFireGroup) Equal to 1
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions
  • Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FaerieFireGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is dead) Equal to True
                  • ((Picked unit) has buff Faerie Fire) Equal to False
            • Then - Actions
              • Unit - Remove Spell_Dmg_Increase from (Picked unit)
              • Unit Group - Remove (Picked unit) from FaerieFireGroup.
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in FaerieFireGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Back
Top