• 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.

[Solved] Buff & Ability

Status
Not open for further replies.
Level 24
Joined
May 15, 2013
Messages
3,782
Hey there Hive folks!

I have this annoying problem of a spell. I'll give the details,
The caster casts a taunt, which will give a buff to nearby enemy units, now the caster has another ability which is called Final Strike.
Which will instantly kill units below or equal to lvl 5 and deals 450 damage to heroes or units above lvl 5.
Now when the caster uses Final Strike on a hero while it has the taunt buff, and died, will give the caster a 1 bonus point of its strength. Stacks just up to 15.
-----------------
Here are the triggers:

  • FS Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ------------------------------- --------
      • -------- The ability that used in Finale Strike --------
      • Set FS_Ability = Final Strike (Varian)
      • -------- ------------------------------- --------
      • -------- The causing damage to the heroes and the level up higher in 6. --------
      • Set FS_Damage = 450.00
      • -------- ------------------------------- --------
      • -------- This is the instantly kill level of? --------
      • Set FS_InstantlyKillLevel = 5
      • -------- ------------------------------- --------
      • -------- What buff is used? --------
      • Set FS_Buff = Gladiator's Wrath
      • -------- ------------------------------- --------
      • -------- The attacktype of the damage. --------
      • Set FS_AttackType = Chaos
      • -------- ------------------------------- --------
      • -------- The damagetype of the damage. --------
      • Set FS_DamageType = Death
      • -------- ------------------------------- --------
      • -------- The special effects of the caster when the spell is cast and attachments of the special effects. --------
      • Set FS_CasterFx = Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdx
      • Set FS_CasterFxAttach = weapon
      • -------- ------------------------------- --------
      • -------- The special effects of the target when the spell is cast and attachments of the special effects. --------
      • Set FS_TargetFx = Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Set FS_TargetFxAttach = chest
      • -------- ------------------------------- --------
  • FS Execution
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to FS_Ability
    • Actions
      • Set FS_Caster = (Triggering unit)
      • Set FS_Target = (Target unit of ability being cast)
      • Set FS_TargetLevel = (Level of FS_Target)
      • Special Effect - Create a special effect attached to the FS_CasterFxAttach of FS_Caster using FS_CasterFx
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the FS_TargetFxAttach of FS_Target using FS_TargetFxAttach
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyEffect( AddSpecialEffect( udg_FS_TargetFx, GetUnitX( udg_FS_Target ), GetUnitY( udg_FS_Target ) ) )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (FS_Target is A Hero) Equal to True
              • FS_TargetLevel Greater than FS_InstantlyKillLevel
        • Then - Actions
          • Unit - Cause FS_Caster to damage FS_Target, dealing FS_Damage damage of attack type FS_AttackType and damage type FS_DamageType
          • -------- Bonus --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (FS_Target is A Hero) Equal to True
              • (FS_Target has buff FS_Buff) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (FS_Target is dead) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • FS_Bonus Not equal to 15
                    • Then - Actions
                      • Hero - Modify Strength of FS_Caster: Add 1
                      • Set FS_Bonus = (FS_Bonus + 1)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FS_TargetLevel Less than or equal to FS_InstantlyKillLevel
        • Then - Actions
          • Unit - Kill FS_Target
        • Else - Actions
-------------
The problem here is that when I put the condition which is just below the "Bonus" comment action,
  • (FS_Target has buff FS_Buff) Equal to True
it doesn't work, but when I remove it, it works. I really want this part of the spell to work,
any ideas on why this stuff doesn't happen?
 
When a unit dies, they don't have the buff anymore. With your current setup, the Then - Actions will never run because you need both of the conditions to be true, hence why it did work when you removed FS_Target has buff FS_Buff Equal to True.

What you can do is add targets to a group that have the buff, and after you deal damage, check if they are in the group instead of the buff.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
Try it yourself.
Make a periodic loop of 0.01 and loop 100 times inside that loop creating a new unit and removing it immediately.
Then do the same again but kill the unit first and then remove it.
Watch difference between 1 and 2.

You want proof... I am not the first one that has given it.

A function does not necessarily leak... it is the actions that are done inside that function that leak.
 
Status
Not open for further replies.
Top