• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Spell] Repel ability

Level 27
Joined
Sep 7, 2018
Messages
592
I made an ability but i don't know that i have made it correctly, can you guys please take a look at it?
  • Repel
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Repel
    • Actions
      • -------- Config --------
      • Custom script: local unit r = GetSpellTargetUnit()
      • Custom script: local location rp = GetSpellTargetLoc()
      • Custom script: set udg_Repel_Target = r
      • Custom script: set udg_Repel_Point = rp
      • Unit - Create 1 Dummy for (Owner of Repel_Target) at Repel_Point facing Default building facing degrees
      • Set Repel_Dummy = (Last created unit)
      • Unit - Add Abolish Magic (Repel) to Repel_Dummy
      • Unit - Order Repel_Dummy to Night Elf Dryad - Abolish Magic Repel_Target
      • Unit - Add a 0.20 second Generic expiration timer to Dummy
      • Unit - Add Repel (Resistant) to Repel_Target
      • Unit - For Repel_Target, Ability Repel (Resistant), Hide ability: True
      • -------- Regenerates hit points over time --------
      • If ((Level of Repel for (Triggering unit)) Equal to 1) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 8.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 2) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 12.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 3) then do (Unit - Set life of Repel_Target to ((Life of Repel
      • Wait 1.12 game-time seconds
      • Custom script: set udg_Repel_Target = r
      • If ((Level of Repel for (Triggering unit)) Equal to 1) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 8.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 2) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 12.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 3) then do (Unit - Set life of Repel_Target to ((Life of Repel
      • Wait 1.12 game-time seconds
      • Custom script: set udg_Repel_Target = r
      • If ((Level of Repel for (Triggering unit)) Equal to 1) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 8.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 2) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 12.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 3) then do (Unit - Set life of Repel_Target to ((Life of Repel
      • Wait 1.12 game-time seconds
      • Custom script: set udg_Repel_Target = r
      • If ((Level of Repel for (Triggering unit)) Equal to 1) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 8.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 2) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 12.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 3) then do (Unit - Set life of Repel_Target to ((Life of Repel
      • Wait 1.12 game-time seconds
      • Custom script: set udg_Repel_Target = r
      • If ((Level of Repel for (Triggering unit)) Equal to 1) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 8.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 2) then do (Unit - Set life of Repel_Target to ((Life of Repel_Target) + 12.00)) else do (If ((Level of Repel for (Triggering unit)) Equal to 3) then do (Unit - Set life of Repel_Target to ((Life of Repel
      • Unit - Remove Repel (Resistant) from Repel_Target
      • -------- Remove leak --------
      • Custom script: call RemoveLocation(udg_Repel_Point)
      • Custom script: set rp = null
      • Custom script: set r = null
      • Custom script: set udg_Repel_Caster = null
      • Custom script: set udg_Repel_Target = null
      • Custom script: set udg_Repel_Dummy = null
      • Custom script: set udg_Repel_Point = null
Also do you know how to use local unit in this system?
 
Dynamic indexing exists as an option to not use locals or jass for that matter. If the given trigger achieves what u want, i'd suggest using Dynamic indexing and periodic events for better performance. And is there a reason why health must be set through the trigger, can it not be done through abilities like Item life regeneration or Inner fire?
 
Dynamic indexing exists as an option to not use locals or jass for that matter. If the given trigger achieves what u want, i'd suggest using Dynamic indexing and periodic events for better performance. And is there a reason why health must be set through the trigger, can it not be done through abilities like Item life regeneration or Inner fire?
thanks for your help.

  • Repel
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Repel
    • Actions
      • -------- Config --------
      • Set Repel_Max = (Repel_Max + 1)
      • Set Repel_Target[Repel_Max] = (Target unit of ability being cast)
      • Set Repel_Level[Repel_Max] = (Level of Repel for (Triggering unit))
      • Set Repel_Time[Repel_Max] = 5
      • Set Repel_Point = (Position of Repel_Target[Repel_Max])
      • -------- Create Dummy --------
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Repel_Point facing Default building facing degrees
      • Set Repel_Dummy[Repel_Max] = (Last created unit)
      • Custom script: call RemoveLocation(udg_Repel_Point)
      • -------- Dummy Cast --------
      • Unit - Add Abolish Magic (Repel) to Repel_Dummy[Repel_Max]
      • Unit - Order Repel_Dummy[Repel_Max] to Night Elf Dryad - Abolish Magic Repel_Target[Repel_Max]
      • Unit - Add a 0.50 second Generic expiration timer to Repel_Dummy[Repel_Max]
      • -------- Add Resistant --------
      • Unit - Add Repel (Resistant) to Repel_Target[Repel_Max]
      • Unit - For Repel_Target[Repel_Max], Ability Repel (Resistant), Hide ability: True
      • -------- Start Loop --------
      • If (Repel_Max Equal to 1) then do (Trigger - Turn on Repel heal loop <gen>) else do (Do nothing)
  • Repel heal loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempInteger = 0
      • For each (Integer Repel_Loop) from 1 to Repel_Max, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Repel_Target[Repel_Loop] Not equal to No unit
              • (Repel_Target[Repel_Loop] is alive) Equal to True
            • Then - Actions
              • Set TempInteger = (TempInteger + 1)
              • Set Repel_Heal = (4.00 + ((Real(Repel_Level[Repel_Loop])) x 4.00))
              • Unit - Set life of Repel_Target[Repel_Loop] to ((Life of Repel_Target[Repel_Loop]) + Repel_Heal)
              • Set Repel_Time[Repel_Loop] = (Repel_Time[Repel_Loop] - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Repel_Time[Repel_Loop] Less than or equal to 0
                • Then - Actions
                  • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
                  • Set Repel_Target[Repel_Loop] = No unit
                  • Set Repel_Level[Repel_Loop] = 0
                  • Set Repel_Time[Repel_Loop] = 0
                  • Set TempInteger = (TempInteger - 1)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Repel_Target[Repel_Loop] Not equal to No unit
                • Then - Actions
                  • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
                  • Set Repel_Target[Repel_Loop] = No unit
                  • Set Repel_Level[Repel_Loop] = 0
                  • Set Repel_Time[Repel_Loop] = 0
                • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInteger Equal to 0
        • Then - Actions
          • Set Repel_Max = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
I think these triggers are my final versions.
 
Last edited:
try this insted

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Repel
  • Actions
    • Set Repel_Max = Repel_Max + 1
    • Set Repel_Target[Repel_Max] = (Target unit of ability being cast)
    • Set Repel_Level[Repel_Max] = (Level of Repel for (Triggering unit))
    • Set Repel_Time[Repel_Max] = 5
    • Set Repel_Heal[Repel_Max] = 4.00 + ((Real(Repel_Level[Repel_Max])) * 4.00)
    • Set Repel_Point = (Position of Repel_Target[Repel_Max])
    • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Repel_Point facing Default building facing degrees
    • Set Repel_Dummy[Repel_Max] = (Last created unit)
    • Custom script: call RemoveLocation(udg_Repel_Point)
    • Unit - Add Abolish Magic (Repel) to Repel_Dummy[Repel_Max]
    • Unit - Order Repel_Dummy[Repel_Max] to Night Elf Dryad - Abolish Magic Repel_Target[Repel_Max]
    • Unit - Add a 0.50 second Generic expiration timer to Repel_Dummy[Repel_Max]
    • Unit - Add Repel (Resistant) to Repel_Target[Repel_Max]
    • Unit - For Repel_Target[Repel_Max], Ability Repel (Resistant), ( make it a Hide ability )
    • If Repel_Max Equal to 1 then Trigger - Turn on Repel Loop <gen>
and loob

  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
  • Set Repel_Loop = Repel_Max
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Loop Equal to 0
      • Then - Actions
        • Skip remaining actions
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Target[Repel_Loop] Equal to No unit
      • Then - Actions
        • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
        • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
        • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
        • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
        • Set Repel_Target[Repel_Max] = No unit
        • Set Repel_Max = Repel_Max - 1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Repel_Target[Repel_Loop] is alive Equal to True
          • Then - Actions
            • Unit - Set life of Repel_Target[Repel_Loop] to
            • ((Life of Repel_Target[Repel_Loop]) + Repel_Heal[Repel_Loop])
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Loop] - 1
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Repel_Time[Repel_Loop] Less than or equal to 0
              • Then - Actions
                • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
                • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
                • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
                • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
                • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
                • Set Repel_Target[Repel_Max] = No unit
                • Set Repel_Max = Repel_Max - 1
              • Else - Actions
                • Do nothing
          • Else - Actions
            • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
            • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
            • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
            • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
            • Set Repel_Target[Repel_Max] = No unit
            • Set Repel_Max = Repel_Max - 1
    • Set Repel_Loop = Repel_Loop - 1
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Repel_Max Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
      • Do nothing
 
Last edited:
try this insted

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Repel
  • Actions
    • Set Repel_Max = Repel_Max + 1
    • Set Repel_Target[Repel_Max] = (Target unit of ability being cast)
    • Set Repel_Level[Repel_Max] = (Level of Repel for (Triggering unit))
    • Set Repel_Time[Repel_Max] = 5
    • Set Repel_Heal[Repel_Max] = 4.00 + ((Real(Repel_Level[Repel_Max])) * 4.00)
    • Set Repel_Point = (Position of Repel_Target[Repel_Max])
    • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Repel_Point facing Default building facing degrees
    • Set Repel_Dummy[Repel_Max] = (Last created unit)
    • Custom script: call RemoveLocation(udg_Repel_Point)
    • Unit - Add Abolish Magic (Repel) to Repel_Dummy[Repel_Max]
    • Unit - Order Repel_Dummy[Repel_Max] to Night Elf Dryad - Abolish Magic Repel_Target[Repel_Max]
    • Unit - Add a 0.50 second Generic expiration timer to Repel_Dummy[Repel_Max]
    • Unit - Add Repel (Resistant) to Repel_Target[Repel_Max]
    • Unit - For Repel_Target[Repel_Max], Ability Repel (Resistant), ( make it a Hide ability )
    • If Repel_Max Equal to 1 then Trigger - Turn on Repel Loop <gen>

Aren't they same?
 
Aren't they same?
close i was also about to add the loob


  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
  • Set Repel_Loop = Repel_Max
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Loop Equal to 0
      • Then - Actions
        • Skip remaining actions
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Target[Repel_Loop] Equal to No unit
      • Then - Actions
        • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
        • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
        • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
        • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
        • Set Repel_Target[Repel_Max] = No unit
        • Set Repel_Max = Repel_Max - 1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Repel_Target[Repel_Loop] is alive Equal to True
          • Then - Actions
            • Unit - Set life of Repel_Target[Repel_Loop] to
            • ((Life of Repel_Target[Repel_Loop]) + Repel_Heal[Repel_Loop])
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Loop] - 1
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Repel_Time[Repel_Loop] Less than or equal to 0
              • Then - Actions
                • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
                • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
                • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
                • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
                • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
                • Set Repel_Target[Repel_Max] = No unit
                • Set Repel_Max = Repel_Max - 1
              • Else - Actions
                • Do nothing
          • Else - Actions
            • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
            • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
            • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
            • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
            • Set Repel_Target[Repel_Max] = No unit
            • Set Repel_Max = Repel_Max - 1
    • Set Repel_Loop = Repel_Loop - 1
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Repel_Max Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
      • Do nothing
in your trigger you are use reple_max in both your array size and your active instance count with,
 
close i was also about to add the loob


  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
  • Set Repel_Loop = Repel_Max
  • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Loop Equal to 0
      • Then - Actions
        • Skip remaining actions
      • Else - Actions
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Repel_Target[Repel_Loop] Equal to No unit
      • Then - Actions
        • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
        • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
        • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
        • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
        • Set Repel_Target[Repel_Max] = No unit
        • Set Repel_Max = Repel_Max - 1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Repel_Target[Repel_Loop] is alive Equal to True
          • Then - Actions
            • Unit - Set life of Repel_Target[Repel_Loop] to
            • ((Life of Repel_Target[Repel_Loop]) + Repel_Heal[Repel_Loop])
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Loop] - 1
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Repel_Time[Repel_Loop] Less than or equal to 0
              • Then - Actions
                • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
                • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
                • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
                • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
                • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
                • Set Repel_Target[Repel_Max] = No unit
                • Set Repel_Max = Repel_Max - 1
              • Else - Actions
                • Do nothing
          • Else - Actions
            • Unit - Remove Repel (Resistant) from Repel_Target[Repel_Loop]
            • Set Repel_Target[Repel_Loop] = Repel_Target[Repel_Max]
            • Set Repel_Level[Repel_Loop] = Repel_Level[Repel_Max]
            • Set Repel_Time[Repel_Loop] = Repel_Time[Repel_Max]
            • Set Repel_Heal[Repel_Loop] = Repel_Heal[Repel_Max]
            • Set Repel_Target[Repel_Max] = No unit
            • Set Repel_Max = Repel_Max - 1
    • Set Repel_Loop = Repel_Loop - 1
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Repel_Max Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
      • Do nothing
Thanks for your help, dose it cause problems?
 
Back
Top