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

[Trigger] Help with Triggered damage over time effect

Status
Not open for further replies.
Level 4
Joined
Sep 22, 2011
Messages
70
Hey, i'm trying to make a triggered DOT effect for a spell i'm making, based off how much Lumber the player that owns the unit casting the spell has.
I'm using Bladestorm (Orc hero ability) as the base for the units ability, which lasts 1 second, and deals x amount of damage, the trigger is as follows:
  • Divine Storm DOT
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (150.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 2
            • Then - Actions
              • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (285.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 3
                • Then - Actions
                  • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (329.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 4
                    • Then - Actions
                      • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (429.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 5
                        • Then - Actions
                          • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (586.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 6
                            • Then - Actions
                              • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (697.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 7
                                • Then - Actions
                                  • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (754.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 8
                                    • Then - Actions
                                      • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (812.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 9
                                        • Then - Actions
                                          • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (934.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Level of Divine Storm (Hero) for DivineStorm_Caster) Equal to 10
                                            • Then - Actions
                                              • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (1251.00 x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
                                            • Else - Actions
and the trigger to turn this one on is:
  • Divine Storm Damage Increase
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divine Storm (Hero)
    • Actions
      • Set DivineStorm_DmgTargets = (Units within 50.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current lumber) Greater than 0
        • Then - Actions
          • Countdown Timer - Start DivineStorm_Dot as a One-shot timer that will expire in 3.00 seconds
          • Trigger - Turn on Divine Storm DOT <gen>
        • Else - Actions
          • Custom script: call DestroyGroup(udg_DivineStorm_DmgTargets)
And for some reason this isnt working.

and even when I removed the If/Then/Else condition functions from the trigger, and simply do
  • Unit Group - Pick every unit in DivineStorm_DmgTargets and do Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 150.00
It STILL doesnt work, so my only guess is maybe i messed up in a trigger somewhere that I havent caught so could someone plz halp :D
 
Level 8
Joined
Dec 9, 2009
Messages
397
Well before we fix your trigger as it is,
How many players in your map? and how many people will be able to use this skill?

Because as it stands, if more than 1 person uses the skill within the duration, it'll be messed up.

You never assigned the variable DivineStorm_Caster

I think your
  • Set DivineStorm_DmgTargets = (Units within 50.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))
Leaks

Your loop would go on forever, you don't have anything timing how many times it should go through the loop

You don't have anything removing units from the loop group after time

and nothing turning off your loop if group is empty
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Read this about leaks: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

I don't see you setting the caster variable.

I recommend you use an equation for the damage:

Like
  • Unit Group - Pick every unit in DivineStorm_DmgTargets and do (Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (50xlevel of ability for caster x (0.05 x (Real(((Owner of DivineStorm_Caster) Current lumber)))))))
Then you don't have to use the huge if/then/else monstrosity and the damage is more convenient to edit.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
(Just in case) leaks are bad, you need to fix/remove them.

Whenever you use "Position of" or "Center of" or any action using a "Point", you need to declare that point into a variable, call the variable un the function, and then remove the point. Almost the same goes for groups.

Also, if you're using the same function/unit/handle several times, it's better to declare it into a variable and use the variable. Reduce as much as you can the parentheses, at least in functions that uses Unit values (these aren't really that bad in math functions).

Example: You're using (Picked Unit) like 42 times. You can set "u = (Picked Unit)" and use "u" instead of (Picked Unit).

Same goes for "Owner of(Unit)" If you're using it several times, create a Player variable and use that instead.

BTW, doing one damage formula based on the values you have (Unit level, Player Lumber, Skill level, etc.) you can work most skills in a extremely efficient way, as Maker said (He thaugh me that when I did something almost exactly as you're doing now, and now is just 1 line)
 
Status
Not open for further replies.
Top