• 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 me Help me Help me MEOW (Trigger Prob.)

Status
Not open for further replies.
Hello!

I've been trying to do this spell:

Sacrifice

When the hero's life gets less than 10%/15%/20% of its max life, he can activate this spell to cause damage around units. The damage inflicted is per missing life of an enemy unit. The hero cannot activated this spell if his life is greater than 10%/15%/20%.

level 1 - when life gets less than 10%, damage all the units within 800 aoe
level 2 - " "
level 3 - " "

The problem is that my trigger isn't working and I assume that it leaks. Please help in improving this trigger. Thank you very very very very very/....

  • Sakripisyo
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Sakripisyo
    • Actions
      • Set Pnt_Message = Rizal's Life must be less than the required HP
      • Set Maxi_Life = (Max life of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Sakripisyo for (Triggering unit)) Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Triggering unit)) Less than (Maxi_Life x 0.10)
            • Then - Actions
              • Trigger - Run Sakripisyo Cast <gen> (checking conditions)
            • Else - Actions
              • Unit - Order (Triggering unit) to Stop
              • Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 15, "|cffffcc00" + udg_Pnt_Message)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Sakripisyo for (Triggering unit)) Equal to 2
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Triggering unit)) Less than (Maxi_Life x 0.15)
            • Then - Actions
              • Trigger - Run Sakripisyo Cast <gen> (checking conditions)
            • Else - Actions
              • Unit - Order (Triggering unit) to Stop
              • Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 15, "|cffffcc00" + udg_Pnt_Message)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Sakripisyo for (Triggering unit)) Equal to 3
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Triggering unit)) Less than (Maxi_Life x 0.20)
            • Then - Actions
              • Trigger - Run Sakripisyo Cast <gen> (checking conditions)
            • Else - Actions
              • Unit - Order (Triggering unit) to Stop
              • Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 15, "|cffffcc00" + udg_Pnt_Message)
        • Else - Actions
  • Sakripisyo Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sakripisyo
    • Actions
      • -------- Store position of caster --------
      • Set Caster_Pnt = (Position of (Triggering unit))
      • -------- Create cast target effect --------
      • Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- Load dummy --------
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Caster_Pnt facing 0.00 degrees
      • Custom script: call UnitAddAbility( bj_lastCreatedUnit, 'Aloc' ) // Makes unit unselectable
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit Group - Pick every unit in (Units within 99999.00 of Caster_Pnt) and do (Actions)
        • Loop - Actions
          • -------- Deal damage per point of life missing --------
          • Unit - Cause (Last created unit) to damage (Target unit of ability being cast), dealing (((Max life of (Target unit of ability being cast)) - (Life of (Target unit of ability being cast))) x (0.30 x (Real((Level of (Ability being cast) for (Triggering unit)))))) damage of attack type Chaos and damage type Normal
      • -------- Clear location leak --------
      • Custom script: call RemoveLocation( udg_Caster_Pnt )
      • Custom script: set udg_Caster_Pnt = null
 
Level 4
Joined
Oct 20, 2011
Messages
129
First of all, learn math. If you want to make this spell with 10+ lvl, it could be a pain.
  • Set Maxi_Life = (Max life of (Triggering unit))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Life of (Triggering unit)) Less than (Maxi_Life x (0.10 + (0.05 x (Level of Sakripisyo for (Triggering unit)))))
    • Then - Actions
      • Do Nothing.
    • Else - Actions
      • Unit - Order (Triggering unit) to Stop
      • Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 15, "|cffffcc00" + udg_Pnt_Message)
    • Else - Actions
Here is your current trigger, I'll fix it a bit~
  • Sakripisyo Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sakripisyo
    • Actions
      • -------- Store position of caster --------
      • Set Caster_Pnt = (Position of (Triggering unit))
      • -------- Create cast target effect --------
      • Special Effect - Create a special effect attached to the origin of (Target unit of ability being cast) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- Load dummy --------
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Caster_Pnt facing 0.00 degrees
      • Custom script: call UnitAddAbility( bj_lastCreatedUnit, 'Aloc' ) // Makes unit unselectable // Why not add it in object editor?
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit Group - Pick every unit in (Units within 99999.00 of Caster_Pnt) and do (Actions)
        • Loop - Actions
          • -------- Deal damage per point of life missing --------
          • Unit - Cause (Last created unit) to damage (Picked unit), dealing (((Max life of (Picked unit)) - (Life of (Picket unit))) x (0.30 x (Real((Level of (Ability being cast) for (Triggering unit)))))) damage of attack type Chaos and damage type Normal //WTF? (Target unit of ability being cast) = null for this spell, I think. (Picked unit) will do it.
      • -------- Clear location leak --------
      • Custom script: call RemoveLocation( udg_Caster_Pnt )
      • Custom script: set udg_Caster_Pnt = null
Things you did wrong:Trigger - Run Sakripisyo Cast <gen> (checking conditions) = Remove this
Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0, 0, 15, "|cffffcc00" + udg_Pnt_Message) => There is normal trigger for this.
(Target unit of ability being cast) => (Picked unit)
Comment: Global spell? :O Can't reflect back to caster?
 
Level 20
Joined
Jun 27, 2011
Messages
1,864
Cut the fight, seriously. Reporting for the mods to clean.

Anyway, to Steel0razor,
You could just use the percent condition instead of making math calculations.
Get rid of the leaks, it can cause serious lag if the gameplay lasts long. http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
You could just use the default GUI action Game - Display Text if you're having a hard time on Jass.
Also store those function calls (Triggering unit, Last created unit, etc... Those who have "()") into a variable to make it more efficient.
 
Last edited:
Status
Not open for further replies.
Top