• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Help me Help me Help me MEOW (Trigger Prob.)

Status
Not open for further replies.
Level 8
Joined
Mar 5, 2011
Messages
199
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 29
Joined
Oct 24, 2012
Messages
6,543
u should make this into one trigger. there is no need for 2 triggers.
u then store the unit into a temp variable and the ability lvl to a temp variable. then u make an ITE and check the units life to the lvl of the ability. in the then block u then store all units in Aoe of 800 and in the pick all unit group action u damage picked unit.
 
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