Moderator
M
Moderator
22nd July 2012
Magtheridon96: Approved.
This is scripted well enough.
Magtheridon96: Approved.
This is scripted well enough.
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)