• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Guardian v1.2 [GUI]

Full Description:
Summons an eagle guardian that will follow and heals the target when it takes damage. When the eagle heals 5 times, it will cast a healing wave which bounces to nearby friendly units, each wave deals less healing.
The main duty of the eagle is to heal the target and helps attack enemy units whenever applicable. Eagle lasts for 60 seconds.

|cffffcc00Level 1|r - Heals 5, Wave heals 100 to primary target and deals 60% less for 2 targets.
|cffffcc00Level 2|r - Heals 7, Wave heals 150 to primary target and deals 50% less for 3 targets.
|cffffcc00Level 3|r - Heals 9, Wave heals 200 to primary target and deals 40% less for 4 targets.
|cffffcc00Level 4|r - Heals 11, Wave heals 250 to primary target and deals 30% less for 5 targets.
|cffffcc00Level 5|r - Heals 13, Wave heals 300 to primary target and deals 20% less for 6 targets.

Instructions:
- Be sure to check the 'Automatically create unknown variables...', via File>Preferences>General tab.
- In the object editor, copy all the custom Unit and Abilities to your map.
- Copy all that is written from the 'Guardian' folder editor to your map.
- Be sure to input the right configutation from the 'Setup' trigger


  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- These are the configurables, adjust when necessary --------
      • -------- The main ability of the hero --------
      • Set GU_AbilHero = Guardian
      • -------- The main ability of the Guardian, heals target --------
      • Set GU_AbilHealing = Guardian [Healing]
      • -------- The secondary ability of the Guardian, multi heal --------
      • Set GU_AbilMultiHealing = Guardian [Multi Healing - for dummy]
      • -------- The Guardian UnitType --------
      • Set GU_GuardianTy = Guardian (Level 2)
      • -------- The max distance to follow the caster hero --------
      • Set GU_DistMax = 300.00
      • -------- The effect of the eagle summoned --------
      • Set GU_Sfx = Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
      • -------- Setting the BASE damage multiplier and add --------
      • Set GU_DamageMultiplier = 3.00
      • Set GU_DamageAdd = 3.00
      • -------- The life duration of the eagle, set to ZERO if you wish to have unlimited life --------
      • Set GU_EaglesLife = 60.00
      • -------- Preloading; You may NEVER touch this! --------
      • Custom script: set bj_lastCreatedUnit = CreateUnit(Player(15), udg_GU_GuardianTy, 0,0,0)
      • Custom script: call UnitAddAbility(bj_lastCreatedUnit, udg_GU_AbilHealing)
      • Custom script: call UnitAddAbility(bj_lastCreatedUnit, udg_GU_AbilMultiHealing)
      • Custom script: call ShowUnit(bj_lastCreatedUnit, false)
      • Custom script: call RemoveUnit(bj_lastCreatedUnit)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Trigger - Add to GuardianUnpick <gen> the event (Player - (Player((Integer A))) Selects a unit)
  • Guardian
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to GU_AbilHero
    • Actions
      • Custom script: call ExecuteFunc("GU_Cast")
      • Custom script: endfunction
      • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
      • Custom script: function GU_OrderId takes unit u returns boolean
      • Unit - Order GU_Guardian[GU_Index2] to Undead Necromancer - Unholy Frenzy GU_Target[GU_Index2]
      • Custom script: return GetUnitCurrentOrder(u)==852209
      • Custom script: endfunction
      • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
      • Custom script: function GU_Loop takes nothing returns nothing
      • For each (Integer GU_IndexL) from 1 to GU_Index1, do (Actions)
        • Loop - Actions
          • Set GU_Index2 = GU_IndexAr[GU_IndexL]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (GU_Target[GU_Index2] is alive) Equal to True
              • (GU_Guardian[GU_Index2] is alive) Equal to True
            • Then - Actions
              • Set GU_Loc1 = (Position of GU_Guardian[GU_Index2])
              • Set GU_Loc2 = (Position of GU_Target[GU_Index2])
              • Set GU_Distance = (Distance between GU_Loc1 and GU_Loc2)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GU_Distance Greater than or equal to GU_DistMax
                • Then - Actions
                  • Set GU_Loc3 = (GU_Loc2 offset by 250.00 towards (Random real number between 0.00 and 270.00) degrees)
                  • Unit - Order GU_Guardian[GU_Index2] to Move To GU_Loc3
                  • Custom script: call RemoveLocation(udg_GU_Loc3)
                • Else - Actions
              • Set GU_TargetMaxLife = (Max life of GU_Target[GU_Index2])
              • Set GU_TargetLife = (Life of GU_Target[GU_Index2])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GU_TargetLife Less than GU_TargetMaxLife
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • GU_Counter[GU_Index2] Greater than or equal to 5
                    • Then - Actions
                      • Unit - Order GU_Guardian[GU_Index2] to Orc Shadow Hunter - Healing Wave GU_Target[GU_Index2]
                      • Set GU_Counter[GU_Index2] = 0
                    • Else - Actions
                      • -------- OrderID==852209 --------
                      • Custom script: if GU_OrderId(udg_GU_Guardian[udg_GU_Index2]) then
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • GU_Counter[GU_Index2] Less than 6
                        • Then - Actions
                          • Set GU_Counter[GU_Index2] = (GU_Counter[GU_Index2] + 1)
                          • Unit - Set life of GU_Target[GU_Index2] to ((Life of GU_Target[GU_Index2]) + GU_Heal[GU_Index2])
                        • Else - Actions
                      • Custom script: endif
                • Else - Actions
              • Custom script: call RemoveLocation(udg_GU_Loc1)
              • Custom script: call RemoveLocation(udg_GU_Loc2)
            • Else - Actions
              • Unit Group - Remove GU_Guardian[GU_Index2] from GU_Grp
              • Unit - Kill GU_Guardian[GU_Index2]
              • Set GU_IndexAr[GU_IndexL] = GU_IndexAr[GU_Index1]
              • Set GU_IndexAr[GU_Index1] = GU_Index2
              • Set GU_Index1 = (GU_Index1 - 1)
              • Set GU_IndexL = (GU_IndexL - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GU_Index1 Equal to 0
                • Then - Actions
                  • Custom script: call PauseTimer(udg_GU_Timer)
                • Else - Actions
      • Custom script: endfunction
      • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
      • Custom script: function GU_Cast takes nothing returns nothing
      • Custom script: if GetUnitTypeId(GetSpellTargetUnit())==udg_GU_GuardianTy then
      • Unit - Order (Triggering unit) to Stop
      • Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Triggering player))) the text: You cant cast this ...
      • Custom script: else
      • Set GU_Level = (Level of GU_AbilHero for (Triggering unit))
      • Set GU_Loc1 = (Position of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GU_Index1 Equal to 0
        • Then - Actions
          • Custom script: call TimerStart(udg_GU_Timer, 1.0, true, function GU_Loop)
        • Else - Actions
      • Set GU_Index1 = (GU_Index1 + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GU_Index1 Greater than GU_IndexMAX
        • Then - Actions
          • Set GU_IndexAr[GU_Index1] = GU_Index1
          • Set GU_IndexMAX = GU_Index1
        • Else - Actions
      • Set GU_Index2 = GU_IndexAr[GU_Index1]
      • Set GU_Target[GU_Index2] = (Target unit of ability being cast)
      • Set GU_Counter[GU_Index2] = 0
      • Set GU_Heal[GU_Index2] = (((Real(GU_Level)) x GU_DamageMultiplier) + GU_DamageAdd)
      • Unit - Create 1 GU_GuardianTy for (Triggering player) at GU_Loc1 facing Default building facing degrees
      • Set GU_Guardian[GU_Index2] = (Last created unit)
      • Unit Group - Add GU_Guardian[GU_Index2] to GU_Grp
      • Special Effect - Create a special effect attached to the origin of (Last created unit) using GU_Sfx
      • Special Effect - Destroy (Last created special effect)
      • -------- adding the 2 abilities --------
      • Unit - Add GU_AbilHealing to GU_Guardian[GU_Index2]
      • Unit - Set level of GU_AbilHealing for GU_Guardian[GU_Index2] to GU_Level
      • Unit - Add GU_AbilMultiHealing to GU_Guardian[GU_Index2]
      • Unit - Set level of GU_AbilMultiHealing for GU_Guardian[GU_Index2] to GU_Level
      • Unit - Add a GU_EaglesLife second Generic expiration timer to GU_Guardian[GU_Index2]
      • Custom script: call RemoveLocation(udg_GU_Loc1)
      • Custom script: endif
      • -------- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --------
  • GuardianUnpick
    • Events
    • Conditions
      • ((Triggering unit) is in GU_Grp) Equal to True
    • Actions
      • Selection - Remove (Triggering unit) from selection for (Triggering player)



CREDITS:
- Magtheridom96 (for suggesting GuardianUnpick event registration)

CHANGELOGS:
v1.2
- Description changed
- Code optimized as suggested by the moderator

v1.1
- Trigger loop replaced by TimerLoop
- Code and variables greatly reduced and optimized
- Description changes



Keywords:
guard, fly, eagle, hawk, air, anti, heal, priest, wave, elite, ultimate, healing, ally, dota
Contents

Guardian v1.2 (Map)

Reviews
22nd July 2012 Magtheridon96: Approved. This is scripted well enough.

Moderator

M

Moderator

22nd July 2012
Magtheridon96: Approved.

This is scripted well enough.
 
Level 10
Joined
Aug 21, 2010
Messages
316
again guys, the user can adjust the food/mana/cooldown to 0 from the object editor, the
model can be changed as well, it maybe walking/running etc...it's all pretty much
configurable...

As for configuration, all is fine.
Comments related to that in general it is not good for AOS maps,and not the configuration.
Which means that there is no question about that configuration is not good.

As for me this is not a problem
I already rewrote the code in the JASS version and throw that part

Otherwise my map use the SLK files and not the OE,so I hate to bother with it.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
The GU_Index1 is the MAX index, so it's changing everytime and the unit that will be recalled is only the LAST unit created, the rest, no...
why GU_Index2 = GU_IndexAr[GU_IndexL]? why not directly use <GU_IndexL> from the for loop?

coz it will not be recycled properly if I derecly put GU_IndexL, GU_Index2 = GU_IndexAr[GU_IndexL] is there coz values are changing during the loop...

Also, why don't you add to the dummy unit <locust> ability instead of making a <GuardianUnpick> trigger?
coz I want the enemy to attack the eagle also...
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
thanks Mags, how could I ever forgot that I can set it up in the Setup part using TriggerRegisterPlayerUnitEvent...

Pharaoh_ said:
The spell doesn't do what the tooltip says. The eagle attacks normally, not when the hero's life is full.
I dont get it as I've tested it many times, I used paladin as target, when takes damage, I use divine shield, now eagle attacks enemies...
 
Top