[Trigger] False Promise in DOTA

Status
Not open for further replies.
Level 2
Joined
Nov 28, 2017
Messages
12
Hello, guys
I tried to make an ability that similar to 'False Promise' in DOTA, the ability can add a shield(with limited hit-point) to a target unit, reduces damage to the unit, if the shield broke, the unit die. So I create a new ability, based on Anti-magic Shell, set the duration time to 0.01. And created three triggers(see below) to reduce the damage and set the HP of the shield to 5000, if the target unit taken over 5000 damage, then kill the target unit.
This trigger sometimes work, but sometimes not, I don't know what's the problem, please help me complete this trigger. Thanks!

Here are the variables:
EnegyShield_Damage Real Array (1)
EnegyShield_DamageTotal Real Array (1)
EnegyShield_Effect Specail Effect Array (1)
EnegyShield_HP Real Array (1)
EnegyShield_Target Unit Array (1)

Here are the triggers:
  • Enegy Shield
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Enegy Shield
    • Actions
      • Set EnegyShield_Target[1] = No unit
      • Special Effect - Destroy EnegyShield_Effect[1]
      • Set EnegyShield_Target[1] = (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the origin of EnegyShield_Target[1] using war3mapImported\EnergyShield_Full.mdx
      • Set EnegyShield_Effect[1] = (Last created special effect)
      • Trigger - Turn on Enegy Shield Damage <gen>
      • Trigger - Add to Enegy Shield Damage <gen> the event (Unit - EnegyShield_Target[1] Takes damage)
      • Trigger - Turn on Enegy Shield Limit <gen>
      • Wait (30.00 x (Real((Level of Enegy Shield for (Triggering unit))))) seconds
      • Special Effect - Destroy EnegyShield_Effect[1]
      • Trigger - Turn off Enegy Shield Damage <gen>
      • Trigger - Turn off Enegy Shield Limit <gen>
  • Enegy Shield Damage
    • Events
    • Conditions
    • Actions
      • Set EnegyShield_HP[1] = (Life of EnegyShield_Target[1])
      • Set EnegyShield_Damage[1] = (Damage taken)
      • Unit - Set life of EnegyShield_Target[1] to (EnegyShield_HP[1] + EnegyShield_Damage[1])
      • Set EnegyShield_DamageTotal[1] = (EnegyShield_DamageTotal[1] + EnegyShield_Damage[1])
  • Enegy Shield Limit
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EnegyShield_DamageTotal[1] Greater than or equal to 5000.00
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of EnegyShield_Target[1] using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Destroy EnegyShield_Effect[1]
          • Unit - Kill EnegyShield_Target[1]
          • Set EnegyShield_DamageTotal[1] = 0.00
          • Trigger - Turn off Enegy Shield Damage <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
 
Last edited:
You shoud add an condition to your damage trigger, if the spell expired and you buff some other unit the old buffed unit can drain the shield by beeing damaged.

If this is casted multiple times on the same unit, the damage block will be apllied multiple times (means it heals & reduces shield amount by multiple of "damage taken"), you should register the damage taken Event only the first time that spell is used on an unit, you can do that by for example by beeing a group member.

I am a little bit confussed why you not do the shield limit stuff inside the take damage trigger.

This is not mui; means if you cast it twice at the same time the first spell's effect will stopp but not its wait = (disable Trigger see below).
If you rebuff this spell before the current instance expired the second one will only hold for the remaining time of the first cast
( pretty sure this can't happen in real game, cause of large cooldown, but in your tests it can, I' m pretty sure you are testing with no cooldown).​

If you plan to make this an only one target at the same time spell:
then change all variables to non array. The array only confuss you in this situation and make only additinal work.
Replace the wait with a timer which disables on expire the on damage trigger.
Remove the Shiled Limit Trigger and move its actions into the take damage trigger.​


Using Damage Engine + unit indexer would make this alot more easy (for the mui) spell.
in this case replace [1] with [custom value of unit] and everything is saved on the unit.
you don't need to register this damage taken stuff.
 
Level 2
Joined
Nov 28, 2017
Messages
12
You shoud add an condition to your damage trigger, if the spell expired and you buff some other unit the old buffed unit can drain the shield by beeing damaged.
Thanks for helping, I tried to make it mui, but it doesn't work, so I just made few changes, and come back for the mui after I learned how to do it.
Here is the new triggers:
  • Enegy Shield
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Enegy Shield (EX4)
    • Actions
      • Set EnegyShield_Integer = (EnegyShield_Integer + 1)
      • Set EnegyShield_Target[EnegyShield_Integer] = (Target unit of ability being cast)
      • Trigger - Add to Enegy Shield Damage <gen> the event (Unit - EnegyShield_Target[EnegyShield_Integer] Takes damage)
  • Enegy Shield Damage
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has buff Enegy Shield (EX4) ) Equal to True
        • Then - Actions
          • Set EnegyShield_HP[EnegyShield_Integer] = (Life of EnegyShield_Target[EnegyShield_Integer])
          • Set EnegyShield_Damage[EnegyShield_Integer] = (Damage taken)
          • Unit - Set life of EnegyShield_Target[EnegyShield_Integer] to (EnegyShield_HP[EnegyShield_Integer] + EnegyShield_Damage[EnegyShield_Integer])
          • Set EnegyShield_DamageTotal[EnegyShield_Integer] = (EnegyShield_DamageTotal[EnegyShield_Integer] + EnegyShield_Damage[EnegyShield_Integer])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EnegyShield_DamageTotal[EnegyShield_Integer] Greater than or equal to 20000.00
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of EnegyShield_Target[EnegyShield_Integer] using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Kill EnegyShield_Target[EnegyShield_Integer]
              • Set EnegyShield_DamageTotal[EnegyShield_Integer] = 0.00
              • Set EnegyShield_Target[EnegyShield_Integer] = No unit
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Set EnegyShield_Target[EnegyShield_Integer] = No unit
 
I would do something like this: to avoid registering the Event "unit takes damage" multiple times.
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in EnegyShield_Registered) Equal to False
        • Then - Actions
          • Trigger - Add to Damage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
          • Unit Group - Add (Target unit of ability being cast) to EnegyShield_Registered
        • Else - Actions
 
Status
Not open for further replies.
Top