• 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] periodic damage and healing

Status
Not open for further replies.
Level 2
Joined
Jul 9, 2008
Messages
25
I tried two methods, neither of which worked.

First, I tried damaging the target for a real, then a one-second wait, then damaging the target for the same real, then another wait, etc.

The next method I tried was setting two variables (let's call them x and y), and setting x to the amount that would be damaged or healed, and y to the target's current health. Then I had an action to set the target's health to
y - x (or y + x for healing), resetting y to the target's new health, waiting one second, and repeating.

What do I have to do to make this work?
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
its hard to understand what you mean...

you want to heal or damage the unit of your choice periodicly?
So why dont you use for example "immolation" with target "self".

To heal your unit, you could try to add an immolation with negative damage
 
Level 2
Joined
Jul 9, 2008
Messages
25
Sorry.

I'm trying to figure out how to make periodic damage through triggers. I can't use a self-targeting Immolation because the periodic damage is based on the caster's Intelligence.

I get how to damage a target based on the caster's Intelligence, but when I put that action, followed by a wait action, and then the same damage, it only does the first damage. I think it has something to do with the wait action.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Post your trigger. If you use something like (Triggering Unit) or (Casting Unit) then those values get reset if you wait.

Casting Unit and all the other event-response units BESIDE Triggering Unit are globals and therefore get overwritten whenever you use them AND they don't work after waits (I have no idea why, don't know how the waits work).

Triggering Unit however is a local to a trigger and therefore it works fine for everything. That's the reason I have about 300 posts saying to use Triggering Unit whenever you can (beside the fact that it's also faster then the other event response units).
 
Level 5
Joined
Nov 14, 2007
Messages
161
are u just wanting a simple trigger that does this to one unit? or all units of type, or all units if they are in the area.. we can help make a trigger for you but personally i need more info cus there are a few ways to do that.

EDIT: maybe?

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (REGION)) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is A Hero) Equal to True
            • ((Picked unit) has buff YOUR_HEAL_BUFF) Equal to True
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Life of (Picked unit)) Less than ((Max life of (Picked unit)) - VAR_REAL)
              • Then - Actions
                • Unit - Set life of (Picked unit) to 100.00%
              • Else - Actions
                • Set VAR_REAL = ((Real((Intelligence of (Picked unit) (Exclude bonuses)))) x 3.00)
                • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + VAR_REAL)
          • Else - Actions
(not sure what happens when you + an amount of life to greater than the units max life so i added that if/then, try without it cus u might not even need it)

i still dont know exactly what you want but that might give you an idea. if you really want to loop it then there are gui and jass ways to fix all your problems.
 
Last edited:
Level 2
Joined
Jul 9, 2008
Messages
25
The druid class in my RPG casts spells by combining the effects of "signs", buffs placed on a target that have no effect alone, but have an effect when combined with a different sign. The signs of earth and water combine to make an effect that heals the target for the caster's intelligence x 2, every 2 seconds, for 20 seconds.

  • sign of earth
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sign of Earth
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) has buff Sign of Water ) Equal to True
        • Then - Actions
          • Wait 1.00 seconds
          • Unit - Remove Sign of Water buff from (Triggering unit)
          • Unit - Remove Sign of Earth buff from (Triggering unit)
          • Set druid_earth_and_water = (((Real((Intelligence of (Casting unit) (Include bonuses)))) x 2.00) + 0.00)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Set druid_target = (Target unit of ability being cast)
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
          • Set druid_earth_and_water_target = (Life of (Target unit of ability being cast))
          • Wait 2.00 seconds
          • Unit - Set life of druid_target to (druid_earth_and_water + druid_earth_and_water_target)
        • Else - Actions
 
Level 2
Joined
Jul 9, 2008
Messages
25
To put it simply, I need to do the Druid of the Claw's Rejuvenation spell, but with triggers. Can someone show me how to make this work?
 
Level 3
Joined
Jun 6, 2007
Messages
48
try using loops?

  • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sign of Earth
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) has buff Sign of Water ) Equal to True
        • Then - Actions
          • Loop - Actions
            • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + (((Real((Intelligence of (Casting Unit) (Include bonuses)))) x 2.00) + 0.00))
            • Wait 2.00 seconds
        • Else - Actions
          • Check if unit has a different sign to use for a combination?
Or maybe?

  • Events
    • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Sign of Water and (Picked unit) has buff Sign of Earth) Equal to True
            • Then - Actions
              • Set Druid_Heal = ((Real((Intelligence of (Picked unit) ((Include/Exclude) bonuses)))) x 2.00)
              • Unit - Set life of (Picked unit) to (Druid_Heal + (Life of (Picked unit))
 
Level 3
Joined
Feb 13, 2008
Messages
65
The issue with those above me is that you do not want an "every 2 second" periodic loop to constantly be going during the map, especially ones that has to check every unit on the map to see if they have a buff.

The way i usually handle this is to split it up into two triggers. The first one will be triggered by the actual spell cast (Unit starts the effect of). This is where you will set the variables equal to the casting unit's intelligence and all that fun stuff.

Here is an example:

Trigger 1:

  • Unit - A unit starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Your Spell
  • Actions
  • Set Your_CastingUnit to (Casting Unit)
  • Set Your_RealVariable to ((Intelligence of (Triggering Unit))
  • Trigger - Turn on Trigger 2
  • Wait - 15 seconds
  • Trigger - Turn off Trigger 2
Trigger 2:
  • Time - Every 1 second
  • Conditions
  • Actions
  • Unit Group - Pick Every unit in (Units in 3000 range of ((Your_CastingUnit) matching (Matching Unit) has buff YourSpell and do actions
    • Loop - Actions
      • Unit - Set Life of picked unit to (Life of (Picked unit) + (Your_RealVariable)
 
Level 2
Joined
Jul 9, 2008
Messages
25
Ok, here's the latest version of the trigger:
  • sign of earth
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sign of Earth
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Targeted unit) has buff Sign of Water ) Equal to True
        • Then - Actions
          • Set earth_water_caster = (Casting unit)
          • Set earth_water_int = ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 2.00)
          • Unit - Remove Sign of Water buff from (Target unit of ability being cast)
          • Unit - Remove Sign of Earth buff from (Target unit of ability being cast)
          • Trigger - Turn on earth and water <gen>
          • Wait 20.00 seconds
          • Trigger - Turn off earth and water <gen>
        • Else - Actions
          • Unit - Remove Earth and Water buff from (Triggering unit)
  • sign of water
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sign of Water
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Targeted unit) has buff Sign of Earth ) Equal to True
        • Then - Actions
          • Set earth_water_caster = (Casting unit)
          • Set earth_water_int = ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 2.00)
          • Unit - Remove Sign of Water buff from (Target unit of ability being cast)
          • Unit - Remove Sign of Earth buff from (Target unit of ability being cast)
          • Trigger - Turn on earth and water <gen>
          • Wait 20.00 seconds
          • Trigger - Turn off earth and water <gen>
        • Else - Actions
          • Unit - Remove Earth and Water buff from (Triggering unit)
  • earth and water
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 4000.00 of (Position of earth_water_caster) matching (((Triggering unit) has buff Earth and Water ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + earth_water_int)
It still isn't working, what am I doing wrong? Compared to what I usually do, this is some complex triggering, and any help would be much appreciated.
 
Level 3
Joined
Feb 13, 2008
Messages
65
Why are you removing the buffs off of the target unit of ability being cast? Remove those lines and it will work
 
Level 2
Joined
Jul 9, 2008
Messages
25
Ok, here is the latest version of my trigger. I simplified it by quite a bit, it is now just a slow heal, without the combining buffs. But, it still isn't working. What is broken here?

  • sign of water
    • 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
          • (Ability being cast) Equal to Sign of Water
        • Then - Actions
          • Set sign_water_caster = (Casting unit)
          • Set sign_water_int = ((Real((Intelligence of (Casting unit) (Include bonuses)))) x 1.00)
          • Trigger - Turn on sign of water 2 <gen>
          • Wait 20.00 seconds
          • Trigger - Turn off sign of water 2 <gen>
        • Else - Actions
  • sign of water 2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units within 4000.00 of (Position of sign_water_caster) matching (((Triggering unit) has buff Sign of Water ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + sign_water_int)
 
Status
Not open for further replies.
Top