- Joined
- Oct 12, 2011
- Messages
- 3,450
Only create one dummy caster at map init then never remove or kill it. Just use that unit and never create the another one.
LF Variables

Events


Map initialization

Conditions

Actions


-------- Setting the units --------


Set LF_CastingDummy = Casting Dummy


Set LF_FlareType[1] = Flare (Level 1)


Set LF_FlareType[2] = Flare (Level 2)


Set LF_FlareType[3] = Flare (Level 3)


Set LF_FlareType[4] = Flare (Level 4)


-------- Setting the units --------


-------- ---==========--- --------


-------- Setting Values --------


Set LF_MaxNumberofStrikes = 6


Set LF_StrikeTime = 1.50


Set LF_GroupAoE = 550.00


Set LF_NumberOfRandomUnits = 1


Set LF_GroupInteger = 0


-------- Setting Values --------


-------- ---==========--- --------


-------- Setting Abilities --------


Set LF_MainAbility = Lightning Flare


Set LF_DummyAbility = Chain Lightning (LF)


-------- Setting Abilities --------


-------- ---==========--- --------


-------- Adding Event --------


Trigger - Add to LF Loop <gen> the event (Time - Every 0.05 seconds of game time)
LF Cast

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to LF_MainAbility

Actions


Set LF_Index = (LF_Index + 1)


Set LF_Caster[LF_Index] = (Triggering unit)


Set LF_OwnerOfCaster[LF_Index] = (Owner of LF_Caster[LF_Index])


Set LF_Level[LF_Index] = (Level of LF_MainAbility for LF_Caster[LF_Index])


Set tempPoint = (Target point of ability being cast)


Set LF_NumberOfStrikes[LF_Index] = 0


Set LF_Interval[LF_Index] = 0.00


Unit - Create 1 LF_FlareType[LF_Level[LF_Index]] for LF_OwnerOfCaster[LF_Index] at tempPoint facing Default building facing degrees


Set LF_Flare[LF_Index] = (Last created unit)


Animation - Play LF_Flare[LF_Index]'s birth animation


Animation - Queue LF_Flare[LF_Index]'s stand animation


Custom script: call RemoveLocation (udg_tempPoint)


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



If - Conditions




LF_Index Equal to 1



Then - Actions




Trigger - Turn on LF Loop <gen>



Else - Actions
LF Loop

Events

Conditions

Actions


For each (Integer tempInt) from 1 to LF_Index, do (Actions)



Loop - Actions




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





If - Conditions






(LF_Flare[tempInt] is alive) Equal to True





Then - Actions






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







If - Conditions








LF_NumberOfStrikes[tempInt] Equal to LF_MaxNumberofStrikes







Then - Actions








Unit - Kill LF_Flare[tempInt]








Set LF_Caster[tempInt] = LF_Caster[LF_Index]








Set LF_Flare[tempInt] = LF_Flare[LF_Index]








Set LF_Interval[tempInt] = LF_Interval[LF_Index]








Set LF_Level[tempInt] = LF_Level[LF_Index]








Set LF_OwnerOfCaster[tempInt] = LF_OwnerOfCaster[LF_Index]








Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]








Set LF_Caster[LF_Index] = No unit








Set LF_Flare[LF_Index] = No unit








Set LF_Index = (LF_Index - 1)








Set tempInt = (tempInt - 1)








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









If - Conditions










LF_Index Equal to 0









Then - Actions










Trigger - Turn off (This trigger)









Else - Actions







Else - Actions








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









If - Conditions










LF_Interval[tempInt] Equal to LF_StrikeTime









Then - Actions










Set tempPoint = (Position of LF_Flare[tempInt])










Set tempGroup = (Units within LF_GroupAoE of tempPoint matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of LF_OwnerOfCaster[tempInt]) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) i










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











If - Conditions












(Number of units in tempGroup) Greater than LF_GroupInteger











Then - Actions












Set tempGroup2 = (Random LF_NumberOfRandomUnits units from tempGroup)












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













Loop - Actions














Set tempUnit = (Picked unit)














Unit - Create 1 LF_CastingDummy for LF_OwnerOfCaster[tempInt] at tempPoint facing Default building facing degrees














Set tempUnit2 = (Last created unit)














Unit - Add a 1.00 second Generic expiration timer to tempUnit2














Unit - Add LF_DummyAbility to tempUnit2














Unit - Set level of LF_DummyAbility for tempUnit2 to LF_Level[tempInt]














Unit - Order tempUnit2 to Orc Far Seer - Chain Lightning tempUnit














Set tempUnit = No unit














Set tempUnit2 = No unit














Custom script: call DestroyGroup(udg_tempGroup2)











Else - Actions










Custom script: call DestroyGroup(udg_tempGroup)










Custom script: call RemoveLocation (udg_tempPoint)










Set LF_NumberOfStrikes[tempInt] = (LF_NumberOfStrikes[tempInt] + 1)










Set LF_Interval[tempInt] = 0.00









Else - Actions










Set LF_Interval[tempInt] = (LF_Interval[tempInt] + 0.05)





Else - Actions






Unit - Kill LF_Flare[tempInt]






Set LF_Caster[tempInt] = LF_Caster[LF_Index]






Set LF_Flare[tempInt] = LF_Flare[LF_Index]






Set LF_Interval[tempInt] = LF_Interval[LF_Index]






Set LF_Level[tempInt] = LF_Level[LF_Index]






Set LF_OwnerOfCaster[tempInt] = LF_OwnerOfCaster[LF_Index]






Set LF_NumberOfStrikes[tempInt] = LF_NumberOfStrikes[LF_Index]






Set LF_Caster[LF_Index] = No unit






Set LF_Flare[LF_Index] = No unit






Set LF_Index = (LF_Index - 1)






Set tempInt = (tempInt - 1)






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







If - Conditions








LF_Index Equal to 0







Then - Actions








Trigger - Turn off (This trigger)







Else - Actions