//TESH.scrollpos=0
//TESH.alwaysfold=0
Name | Type | is_array | initial_value |
GU_AbilHealing | abilcode | No | |
GU_AbilHero | abilcode | No | |
GU_AbilMultiHealing | abilcode | No | |
GU_Counter | integer | Yes | |
GU_DamageAdd | real | No | |
GU_DamageMultiplier | real | No | |
GU_Distance | real | No | |
GU_DistMax | real | No | |
GU_EaglesLife | real | No | |
GU_Grp | group | No | |
GU_Guardian | unit | Yes | |
GU_GuardianTy | unitcode | No | |
GU_Heal | real | Yes | |
GU_Index1 | integer | No | |
GU_Index2 | integer | No | |
GU_IndexAr | integer | Yes | |
GU_IndexL | integer | No | |
GU_IndexMAX | integer | No | |
GU_Level | integer | No | |
GU_Loc1 | location | No | |
GU_Loc2 | location | No | |
GU_Loc3 | location | No | |
GU_Sfx | string | No | |
GU_Target | unit | Yes | |
GU_TargetLife | real | No | |
GU_TargetMaxLife | real | No | |
GU_Timer | timer | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
[COLOR="Yellow"][SIZE="3"]Full Description:[/SIZE][/COLOR]
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.
[COLOR="Yellow"][SIZE="3"]Instructions:[/SIZE][/COLOR]
- Be sure to check the [COLOR="Yellow"]'Automatically create unknown variables...'[/COLOR], 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 [COLOR="yellow"]'Guardian'[/COLOR] folder editor to your map.
- Be sure to input the right configutation from the [COLOR="yellow"]'Setup'[/COLOR] trigger
[hidden=Triggers (Yes in GUI!)]
[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)
[/trigger]
[trigger]
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 --------
[/trigger]
[trigger]
GuardianUnpick
Events
Conditions
((Triggering unit) is in GU_Grp) Equal to True
Actions
Selection - Remove (Triggering unit) from selection for (Triggering player)
[/trigger]
[/hidden]
[hidden=Credits and Changelogs]
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
[/hidden]
[youtube=]http://www.youtube.com/watch?v=i1kdKE__jfY&feature=youtu.be[/youtube]