Moderator
M
Moderator
13:51, 7th Sep 2012
Magtheridon96:
Approved.
Magtheridon96:
Approved.
Features
Easy to use.
Easy to adjust to your needs.
Quite flexible and user-customizable.
MUI
Fully Commented, line by line.
TooltipThe Caster makes the target flee in terror, and run out of control for a duration of time.
Level 1 - 15 seconds
Level 2 - 17 seconds
Level 3 - 19 seconds
Level 4 - 21 seconds
If selected, the effect can be canceled with incoming damage.
Level 1 - 250 damage
Level 2 - 300 damage
Level 3 - 350 damage
Level 4 - 400 damage
Update DetailsAdded Bribe's GUI Unit Indexer as suggested by Magtheridon96.
Removed Dummies/Dummy abilities and Buffs
Added User Customization Functions. You can now choose, if you can target with the spell a target that is already under its effect, and you can choose if you want incoming damage (adjustable) to cancel the effect as Adiktuz suggested.
Eradicated leaks, spotted by Tank-Commander
Added level up effect varations, in duration and in damage (if selected) to cancel limit.
Various Code changes.
MF Settings

Events


Map initialization

Conditions

Actions


Set MF_EffectAdjustment = Abilities\Spells\Undead\Curse\CurseTarget.mdl


Set MF_AllowRepeatedCast = False


Set MF_DamageCancelBoolean = True


Set MF_FearAbility = Fear


Set MF_Damage_Limit = 250.00


Set MF_Damage_Limit_UP = 50.00


Set MF_Duration = 15


Set MF_Duration_Up = 2
MF Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to MF_FearAbility

Actions


-------- Setting the Indexes --------


Set MF_Key = (Custom value of (Target unit of ability being cast))


Set MF_Target[MF_Key] = (Target unit of ability being cast)


Set MF_Caster[MF_Key] = (Triggering unit)


-------- Setting the Points --------


Set MF_Target_TempLoc[MF_Key] = (Position of MF_Target[MF_Key])


Set MF_TargetMoveTo_TempLoc[MF_Key] = (MF_Target_TempLoc[MF_Key] offset by (Random real number between 200.00 and 400.00) towards (Random angle) degrees)


-------- Checking wether spell is allowed on the same target multiple times --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




MF_AllowRepeatedCast Equal to False



Then - Actions




-------- If not allowed, then it checks if the target is already affected. --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(MF_Target[MF_Key] is in MF_TargetsGroup) Equal to True





Then - Actions






-------- If he is already affected, then displays the message "Immune" --------






Floating Text - Create floating text that reads Immune above MF_Target[MF_Key] with Z offset 50.00, using font size 10.00, color (80.00%, 0.00%, 100.00%), and 20.00% transparency






Floating Text - Change (Last created floating text): Disable permanence






Floating Text - Change the lifespan of (Last created floating text) to 0.80 seconds






Floating Text - Change the fading age of (Last created floating text) to 0.50 seconds





Else - Actions






-------- If he is not affected, then does initial settings --------






-------- Destruction of Special Effect, so Special Effects Dont Stick arround if they are there from previous cast. --------






Special Effect - Destroy MF_SpecialEffect[MF_Key]






-------- Adding Target to Targets Group --------






Unit Group - Add MF_Target[MF_Key] to MF_TargetsGroup






-------- Creating and Setting of Special Effect --------






Special Effect - Create a special effect attached to the overhead of MF_Target[MF_Key] using MF_EffectAdjustment






Set MF_SpecialEffect[MF_Key] = (Last created special effect)






-------- HP Settings for later Check --------






Set MF_TargetHPInit[MF_Key] = (Life of MF_Target[MF_Key])






-------- Nulling the Tickers --------






Set MF_Ticker[MF_Key] = 0






Set MF_Ticking[MF_Key] = 0






-------- Opens Secondary Triggers --------






Trigger - Turn on MF Loop <gen>






Trigger - Turn on MF Order Interception NO TARGET <gen>






Trigger - Turn on MF Order Interception OBJECT <gen>



Else - Actions




-------- If allowed, does initial settings. --------




-------- Destruction of Special Effect, so Special Effects Dont Stick arround if they are there from previous cast. --------




Special Effect - Destroy MF_SpecialEffect[MF_Key]




-------- Adding Target to Targets Group --------




Unit Group - Add MF_Target[MF_Key] to MF_TargetsGroup




-------- Creating and Setting of Special Effect --------




Special Effect - Create a special effect attached to the overhead of MF_Target[MF_Key] using MF_EffectAdjustment




Set MF_SpecialEffect[MF_Key] = (Last created special effect)




-------- HP Settings for later Check --------




Set MF_TargetHPInit[MF_Key] = (Life of MF_Target[MF_Key])




-------- Nulling the Tickers --------




Set MF_Ticker[MF_Key] = 0




Set MF_Ticking[MF_Key] = 0




-------- Opens Secondary Triggers --------




Trigger - Turn on MF Loop <gen>




Trigger - Turn on MF Order Interception NO TARGET <gen>




Trigger - Turn on MF Order Interception OBJECT <gen>
MF Loop

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


-------- Picking every unit affected by the spell --------


Unit Group - Pick every unit in MF_TargetsGroup and do (Actions)



Loop - Actions




-------- Setting their index --------




Set MF_Key = (Custom value of (Picked unit))




-------- Increasing the Helping Timer --------




Set MF_Ticking[MF_Key] = (MF_Ticking[MF_Key] + 1)




-------- Checking with the help of Helping Timer, if 1 second has elapsed --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(MF_Ticking[MF_Key] mod 33) Equal to 0





Then - Actions






-------- If it does, then checks if the Duration Limit is reached. --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








MF_Ticker[MF_Key] Not equal to (MF_Duration + ((MF_Duration_Up x (Level of MF_FearAbility for MF_Caster[MF_Key])) - MF_Duration_Up))







Then - Actions








-------- If not then destroyes leaks from previous loops. --------








Custom script: call RemoveLocation(udg_MF_Target_TempLoc[udg_MF_Key])








Custom script: call RemoveLocation(udg_MF_TargetMoveTo_TempLoc[udg_MF_Key])








-------- Sets helping Timer to 0, for his next looping set --------








Set MF_Ticking[MF_Key] = 0








-------- Increases Main timer who is checking the if the Duration is reached --------








Set MF_Ticker[MF_Key] = (MF_Ticker[MF_Key] + 1)








-------- Sets the next random location at which the target is going to move --------








Set MF_Target_TempLoc[MF_Key] = (Position of MF_Target[MF_Key])








Set MF_TargetMoveTo_TempLoc[MF_Key] = (MF_Target_TempLoc[MF_Key] offset by (Random real number between 200.00 and 400.00) towards (Random angle) degrees)







Else - Actions








-------- If Duration is met, which ends the effect, the destroyes the last Point unit was ordered to Move to, which is leaking --------








Custom script: call RemoveLocation(udg_MF_Target_TempLoc[udg_MF_Key])








Custom script: call RemoveLocation(udg_MF_TargetMoveTo_TempLoc[udg_MF_Key])








-------- Orders target to Stop, in case the effect ends while he is on route. --------








Unit - Order MF_Target[MF_Key] to Stop








-------- Removes target from Targets Group --------








Unit Group - Remove MF_Target[MF_Key] from MF_TargetsGroup








-------- Special Effect Destruction --------








Special Effect - Destroy MF_SpecialEffect[MF_Key]








-------- Reseting the Timers --------





Else - Actions






-------- If 1 second hasnt elapsed then proceed below --------






-------- This checks if the effect has to be canceled by incoming damage --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






MF_DamageCancelBoolean Equal to True





Then - Actions






-------- If yes, then compares Current life, with Initial Life --------






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Life of MF_Target[MF_Key]) Less than (MF_TargetHPInit[MF_Key] - (MF_Damage_Limit + ((MF_Damage_Limit_UP x (Real((Level of MF_FearAbility for MF_Caster[MF_Key])))) - MF_Damage_Limit)))







Then - Actions








-------- If damage limit is met then, destroyes last assinged location that leaks --------








Custom script: call RemoveLocation(udg_MF_Target_TempLoc[udg_MF_Key])








Custom script: call RemoveLocation(udg_MF_TargetMoveTo_TempLoc[udg_MF_Key])








-------- Orders unit to stop, in case he was moving towards last assigned point --------








Unit - Order MF_Target[MF_Key] to Stop








-------- Removes unit from the Targets Group --------








Unit Group - Remove MF_Target[MF_Key] from MF_TargetsGroup








-------- Destroyes Special Effects --------








Special Effect - Destroy MF_SpecialEffect[MF_Key]








-------- Resets the Timers --------







Else - Actions








-------- If Damage Limit is not met, the proceed Below --------





Else - Actions






-------- If damage should't be a reason to cancel the effect then proceeds below --------




-------- Orders target to move to his assigned location --------




Unit - Order MF_Target[MF_Key] to Move To MF_TargetMoveTo_TempLoc[MF_Key]




-------- Checks if Targets Group is empty, thus no active targets --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(MF_TargetsGroup is empty) Equal to True





Then - Actions






-------- If so, then turns off Helping Triggers --------






Trigger - Turn off (This trigger)






Trigger - Turn off MF Order Interception NO TARGET <gen>






Trigger - Turn off MF Order Interception OBJECT <gen>





Else - Actions






-------- If not repeat --------
MF Order Interception

Events


Unit - A unit Is issued an order with no target

Conditions


((Triggering unit) is in MF_TargetsGroup) Equal to True

Actions


-------- This trigger is my "silence" effect towards instant/no animation spells (and items) --------


-------- When the target affected is issued an order with no target, then this trigger immediately orders him to move to his assigned location, this intercepting the previous order --------


Set MF_Key = (Custom value of (Triggering unit))


Unit - Order (Triggering unit) to Move To MF_TargetMoveTo_TempLoc[MF_Key]
MF Order Interception OBJECT

Events


Unit - A unit Is issued an order targeting an object

Conditions


((Triggering unit) is in MF_TargetsGroup) Equal to True

Actions


-------- Created to Debugg a small bug --------


Set MF_Key = (Custom value of (Triggering unit))


Unit - Order (Triggering unit) to Move To MF_TargetMoveTo_TempLoc[MF_Key]
Special ThanksSoD.GoDLike For inspiring me to do the spell and encourage me to upload it.
rulerofiron99 For being a good buddy, and for taking time to help me become better.
claptomanic For showing me a function i did not know.
Tank-Commander For spoting some leaks i missed.
Adiktuz for his suggestions in adding more user customizable functions.