Moderator
M
Updates
v1.0 - created;
v1.1 - fixed crashes;
v1.2 - some minor changes;
v1.3 - fixed some bugs;
added -accept and -reject commands to test the duel by your self;
v1.4 - cleared some leaks;
removed Food Cost and Point Value from dummy;
v1.5 - unit that lost the duel will be ressurected;
v1.6 - fixed two more leaks;
v1.7 - some few changes and more documentation;
- added option where you can change if duel heroes are allies you still can fight;
v1.8 - fixed the point locations of reviving;
- fixed the text;
v1.9 - added possibilty to invite friends for duels;
- all positive and negative buffs will be removed from units in CDS region.
CDS Settings

Events


Map initialization

Conditions

Actions


-------- ------------------------------------- --------


-------- SETTINGS FOR THE SYSTEM, FEEL FREE TO MODIFY AS YOU WANT --------


-------- ------------------------------------- --------


Set CDS_On = False


-------- ------------------------------------- --------


-------- Dummy is used as camera target, so later we lock camera to dummy. --------


-------- ------------------------------------- --------


Set CDS_Dummy = Dummy 1


-------- ------------------------------------- --------


-------- Region is the place where duel will be performed --------


-------- Don't forget to create region bigger in radius then 300 because in trigger CDS Create Duel i set the points in region offset by 300! --------


-------- ------------------------------------- --------


Set CDS_Region = Duel Region <gen>


Set CDS_Point[3] = (Center of CDS_Region)


-------- ------------------------------------- --------


-------- Now we set the point where units will be moved during duel --------


-------- ------------------------------------- --------


Set CDS_Point[1] = (CDS_Point[3] offset by 300.00 towards 300.00 degrees)


Set CDS_Point[2] = (CDS_Point[3] offset by 300.00 towards 150.00 degrees)


-------- ------------------------------------- --------


-------- DS_Seconds is the time in which oponent has to answer if he'll go to duel or not. --------


-------- ------------------------------------- --------


Set CDS_Seconds = 15.00


-------- ------------------------------------- --------


-------- Now we create dummy at center of region, where camera will be locked. --------


-------- ------------------------------------- --------


Unit - Create 1 CDS_Dummy for Neutral Passive at CDS_Point[3] facing Default building facing degrees


Set CDS_LockPoint = (Last created unit)


-------- ------------------------------------- --------


-------- If you want to call allied units to duel set next variable to true --------


-------- ------------------------------------- --------


Set CDS_AliiesCanFight = True


-------- ------------------------------------- --------


-------- Create some effects --------


-------- ------------------------------------- --------


Set CDS_Point2[1] = (Point((Max X of CDS_Region), (Max Y of CDS_Region)))


Set CDS_Point2[2] = (Point((Max X of CDS_Region), (Min Y of CDS_Region)))


Set CDS_Point2[3] = (Point((Min X of CDS_Region), (Min Y of CDS_Region)))


Set CDS_Point2[4] = (Point((Min X of CDS_Region), (Max Y of CDS_Region)))


Lightning - Create a Chain Lightning - Primary lightning effect from source CDS_Point2[1] to target CDS_Point2[2]


Lightning - Create a Chain Lightning - Primary lightning effect from source CDS_Point2[2] to target CDS_Point2[3]


Lightning - Create a Chain Lightning - Primary lightning effect from source CDS_Point2[3] to target CDS_Point2[4]


Lightning - Create a Chain Lightning - Primary lightning effect from source CDS_Point2[4] to target CDS_Point2[1]


For each (Integer A) from 1 to 4, do (Actions)



Loop - Actions




Custom script: call RemoveLocation(udg_CDS_Point2[GetForLoopIndexA()])
CDS Ask for Duel

Events


Player - Player 1 (Red) types a chat message containing -duel as A substring


Player - Player 2 (Blue) types a chat message containing -duel as A substring


Player - Player 3 (Teal) types a chat message containing -duel as A substring


Player - Player 4 (Purple) types a chat message containing -duel as A substring


Player - Player 5 (Yellow) types a chat message containing -duel as A substring


Player - Player 6 (Orange) types a chat message containing -duel as A substring


Player - Player 7 (Green) types a chat message containing -duel as A substring


Player - Player 8 (Pink) types a chat message containing -duel as A substring


Player - Player 9 (Gray) types a chat message containing -duel as A substring


Player - Player 10 (Light Blue) types a chat message containing -duel as A substring


Player - Player 11 (Dark Green) types a chat message containing -duel as A substring


Player - Player 12 (Brown) types a chat message containing -duel as A substring

Conditions

Actions


-------- If duel is in progress inform the player --------


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



If - Conditions




CDS_On Equal to True



Then - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312Duel is i...



Else - Actions


-------- Setting variables --------


-------- Turn on triggers where we can accept or reject the duel. --------


Trigger - Turn on CDS Vote Yes <gen>


Trigger - Turn on CDS Vote No <gen>


-------- Now we set the player that was entered in massage --------


Set CDS_Player_Number = (Integer((Substring((Entered chat string), 7, (Length of (Entered chat string))))))


-------- Check if that player is the right one --------


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



If - Conditions




And - All (Conditions) are true





Conditions






CDS_Player_Number Greater than or equal to 1






CDS_Player_Number Less than or equal to 12






CDS_Player_Number Equal to (Integer((Substring((Entered chat string), 7, (Integer((Entered chat string)))))))



Then - Actions




-------- First player is the player that has been asked for duel or entered in massage --------




Set CDS_Player[1] = CDS_Player_Number




-------- Second player is the one who asked for duel --------




Set CDS_Player[2] = (Player number of (Triggering player))




-------- Check if asking player didn't type duel with himself --------




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





If - Conditions






(Player(CDS_Player[2])) Equal to (Player(CDS_Player[1]))





Then - Actions






Game - Display to (Player group((Triggering player))) the text: |cfffed312You canno...






Skip remaining actions





Else - Actions




-------- Chek if duel isn't already in progress --------




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





If - Conditions






CDS_On Equal to False





Then - Actions






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







If - Conditions








CDS_AliiesCanFight Equal to True







Then - Actions








-------- Start the timer --------








Countdown Timer - Start CDS_Timer as a One-shot timer that will expire in CDS_Seconds seconds








Set CDS_On = True








Game - Display to (Player group((Player(CDS_Player[1])))) the text: (|cfffed312 + ((Name of (Player(CDS_Player[2]))) + wants to fight with you in duel. If you want to fight type "-accept" or "-reject' to give up.))








Game - Display to (Player group((Player(CDS_Player[2])))) the text: (|cfffed312You asked for duel with player + (Name of (Player(CDS_Player[1]))))








-------- Now we must wait until second player accepts the duel offer or rejects --------







Else - Actions








-------- If they are enemies we turn on the duel --------








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









If - Conditions










((Player(CDS_Player[1])) is an enemy of (Player(CDS_Player[2]))) Equal to True









Then - Actions










-------- Start the timer --------










Countdown Timer - Start CDS_Timer as a One-shot timer that will expire in CDS_Seconds seconds










Set CDS_On = True










Game - Display to (Player group((Player(CDS_Player[1])))) the text: (|cfffed312 + ((String(CDS_Player[1])) + wants to fight with you in duel. If you want to fight type "-accept" or "-reject' to give up.))










Game - Display to (Player group((Player(CDS_Player[2])))) the text: (|cfffed312You asked for duel with player + (Name of (Player(CDS_Player[1]))))










-------- Now we must wait until second player accepts the duel offer or rejects --------









Else - Actions










-------- If the player picked fight with ally he won't be able to fight with him. --------










Game - Display to (Player group((Player(CDS_Player[2])))) the text: |cfffed312You can o...





Else - Actions



Else - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312You can o...
CDS Invite

Events


Player - Player 1 (Red) types a chat message containing -invite as A substring


Player - Player 2 (Blue) types a chat message containing -invite as A substring


Player - Player 3 (Teal) types a chat message containing -invite as A substring


Player - Player 4 (Purple) types a chat message containing -invite as A substring


Player - Player 5 (Yellow) types a chat message containing -invite as A substring


Player - Player 6 (Orange) types a chat message containing -invite as A substring


Player - Player 7 (Green) types a chat message containing -invite as A substring


Player - Player 8 (Pink) types a chat message containing -invite as A substring


Player - Player 9 (Gray) types a chat message containing -invite as A substring


Player - Player 10 (Light Blue) types a chat message containing -invite as A substring


Player - Player 12 (Brown) types a chat message containing -invite as A substring

Conditions

Actions


-------- Checking if right player invites --------


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



If - Conditions




(Triggering player) Equal to (Player(CDS_Player[2]))



Then - Actions




-------- Settings index +1 to detect if the player wont invite anymore --------




Set CDS_Index[1] = (CDS_Index[1] + 1)




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





If - Conditions






CDS_Index[1] Equal to 1





Then - Actions






-------- Setting invited player --------






Set CDS_Player[3] = (Integer((Substring((Entered chat string), 9, (Length of (Entered chat string))))))






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







If - Conditions








CDS_Player[3] Greater than or equal to 1








CDS_Player[3] Less than or equal to 12








CDS_Player[3] Equal to (Integer((Substring((Entered chat string), 9, (Integer((Entered chat string)))))))








CDS_Player[3] Not equal to CDS_Player[1]








CDS_Player[3] Not equal to CDS_Player[2]







Then - Actions








Game - Display to (All players) the text: (|cfffed312 + ((Name of (Triggering player)) + ( has invited + ((Name of (Player(CDS_Player[3]))) + for a duel.))))








-------- Cheking if invited unit is an ally to inviting player --------








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









If - Conditions










((Player(CDS_Player[3])) is an ally of (Triggering player)) Equal to True









Then - Actions










-------- Settings old mana, hit points, point e.t.c --------










Set CDS_UnitGroup[3] = (Units owned by (Player(CDS_Player[3])) matching (((Matching unit) is A Hero) Equal to True))










Unit Group - Pick every unit in CDS_UnitGroup[3] and do (Actions)











Loop - Actions












Set CDS_Unit[3] = (Picked unit)












Set CDS_Unit_Life[3] = (Life of CDS_Unit[3])












Set CDS_Unit_Mana[3] = (Mana of CDS_Unit[3])












Set CDS_Positions[3] = (Position of (Picked unit))












Unit - Move CDS_Unit[3] instantly to CDS_Point[2]









Else - Actions







Else - Actions








Game - Display to (Player group((Triggering player))) the text: |cfffed312You can o...





Else - Actions






Game - Display to (Player group((Triggering player))) the text: |cfffed312You alrea...



Else - Actions


-------- Checking if right player invites --------


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



If - Conditions




(Triggering player) Equal to (Player(CDS_Player[1]))



Then - Actions




-------- Settings index +1 to detect if the player wont invite anymore --------




Set CDS_Index[2] = (CDS_Index[2] + 1)




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





If - Conditions






CDS_Index[2] Equal to 1





Then - Actions






-------- Setting invited player --------






Set CDS_Player[4] = (Integer((Substring((Entered chat string), 9, (Length of (Entered chat string))))))






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







If - Conditions








CDS_Player[4] Greater than or equal to 1








CDS_Player[4] Less than or equal to 12








CDS_Player[4] Equal to (Integer((Substring((Entered chat string), 9, (Integer((Entered chat string)))))))








CDS_Player[4] Not equal to CDS_Player[1]








CDS_Player[4] Not equal to CDS_Player[2]







Then - Actions








Game - Display to (All players) the text: (|cfffed312 + ((Name of (Triggering player)) + ( has invited + ((Name of (Player(CDS_Player[4]))) + for a duel.))))








-------- Cheking if invited unit is an ally to inviting player --------








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









If - Conditions










((Player(CDS_Player[4])) is an ally of (Triggering player)) Equal to True









Then - Actions










-------- Settings old mana, hit points, point e.t.c --------










Set CDS_UnitGroup[4] = (Units owned by (Player(CDS_Player[3])) matching (((Matching unit) is A Hero) Equal to True))










Unit Group - Pick every unit in CDS_UnitGroup[4] and do (Actions)











Loop - Actions












Set CDS_Unit[4] = (Picked unit)












Set CDS_Unit_Life[4] = (Life of CDS_Unit[4])












Set CDS_Unit_Mana[4] = (Mana of CDS_Unit[4])












Set CDS_Positions[4] = (Position of (Picked unit))












Unit - Move CDS_Unit[4] instantly to CDS_Point[1]









Else - Actions







Else - Actions








Game - Display to (Player group((Triggering player))) the text: |cfffed312You can o...





Else - Actions






Game - Display to (Player group((Triggering player))) the text: |cfffed312You alrea...



Else - Actions


-------- If players have invited their teammates, we start the battle --------


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



If - Conditions




And - All (Conditions) are true





Conditions






CDS_Index[1] Equal to 1






CDS_Index[2] Equal to 1



Then - Actions




Set CDS_Invited = True




Trigger - Run CDS Run Duel <gen> (checking conditions)




Trigger - Turn off CDS Start <gen>




Trigger - Turn off (This trigger)



Else - Actions
CDS Start

Events


Player - Player 1 (Red) types a chat message containing -start as An exact match


Player - Player 2 (Blue) types a chat message containing -start as An exact match


Player - Player 3 (Teal) types a chat message containing -start as An exact match


Player - Player 4 (Purple) types a chat message containing -start as An exact match


Player - Player 5 (Yellow) types a chat message containing -start as An exact match


Player - Player 6 (Orange) types a chat message containing -start as An exact match


Player - Player 7 (Green) types a chat message containing -start as An exact match


Player - Player 8 (Pink) types a chat message containing -start as An exact match


Player - Player 9 (Gray) types a chat message containing -start as An exact match


Player - Player 10 (Light Blue) types a chat message containing -start as An exact match


Player - Player 11 (Dark Green) types a chat message containing -start as An exact match


Player - Player 12 (Brown) types a chat message containing -start as An exact match

Conditions

Actions


-------- If someone doesn't want to invite we run the duel --------


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



If - Conditions




Or - Any (Conditions) are true





Conditions






(Triggering player) Equal to (Player(CDS_Player[1]))






(Triggering player) Equal to (Player(CDS_Player[2]))



Then - Actions




Game - Display to (Player group((Player(CDS_Player[1])))) the text: |cfffed312No teamma...




Game - Display to (Player group((Player(CDS_Player[2])))) the text: |cfffed312No teamma...




Trigger - Run CDS Run Duel <gen> (checking conditions)




Trigger - Turn off CDS Invite <gen>




Trigger - Turn off (This trigger)



Else - Actions
CDS Create Duel

Events

Conditions

Actions


Trigger - Turn on CDS Invite <gen>


Trigger - Turn on CDS Start <gen>


Game - Display to (Player group((Player(CDS_Player[1])))) the text: |cfffed312If you wi...


Game - Display to (Player group((Player(CDS_Player[2])))) the text: |cfffed312If you wi...


-------- If he accepted we set both units and move them to the Duel region. --------


-------- We also set the life and mana before duel, so the winner will come out with previous life and mana. --------


Set CDS_UnitGroup[1] = (Units owned by (Player(CDS_Player[1])) matching (((Matching unit) is A Hero) Equal to True))


Unit Group - Pick every unit in CDS_UnitGroup[1] and do (Actions)



Loop - Actions




Set CDS_Unit[1] = (Picked unit)




Set CDS_Unit_Life[1] = (Life of CDS_Unit[1])




Set CDS_Unit_Mana[1] = (Mana of CDS_Unit[1])




Set CDS_Positions[1] = (Position of (Picked unit))




Unit - Move CDS_Unit[1] instantly to CDS_Point[1]


Set CDS_UnitGroup[2] = (Units owned by (Player(CDS_Player[2])) matching (((Matching unit) is A Hero) Equal to True))


Unit Group - Pick every unit in CDS_UnitGroup[2] and do (Actions)



Loop - Actions




Set CDS_Unit[2] = (Picked unit)




Set CDS_Unit_Life[2] = (Life of CDS_Unit[2])




Set CDS_Unit_Mana[2] = (Mana of CDS_Unit[2])




Set CDS_Positions[2] = (Position of (Picked unit))




Unit - Move CDS_Unit[2] instantly to CDS_Point[2]


Player Group - Pick every player in (All players) and do (Actions)



Loop - Actions




-------- Now we make other players to watch the duel so no one will cheat. --------




Camera - Pan camera for (Picked player) to CDS_Point[3] over 0.00 seconds




Camera - Lock camera target for (Picked player) to CDS_LockPoint, offset by (0.00, 0.00) using Default rotation




Custom script: call RemoveLocation(udg_CDS_Point[3])




Unit - Pause all units


-------- If allied units can fight then we make those players enemies --------


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



If - Conditions




((Player(CDS_Player[1])) is an ally of (Player(CDS_Player[2]))) Equal to True



Then - Actions




Set CDS_AllyCheck = True




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





If - Conditions






CDS_AliiesCanFight Equal to True





Then - Actions






Player - Make (Owner of CDS_Unit[1]) treat (Owner of CDS_Unit[2]) as an Enemy






Player - Make (Owner of CDS_Unit[2]) treat (Owner of CDS_Unit[1]) as an Enemy





Else - Actions



Else - Actions
CDS Run Duel

Events

Conditions

Actions


Set CDS_UnitGroup[5] = (Units in CDS_Region)


Unit Group - Pick every unit in CDS_UnitGroup[5] and do (Actions)



Loop - Actions




Unit - Remove Positive buffs from (Picked unit)




Unit - Remove Negative buffs from (Picked unit)


Custom script: call DestroyGroup(udg_CDS_UnitGroup[5])


Unit - Unpause CDS_Unit[1]


Unit - Unpause CDS_Unit[2]


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



If - Conditions




CDS_Invited Equal to True



Then - Actions




Unit - Unpause CDS_Unit[3]




Unit - Unpause CDS_Unit[4]



Else - Actions


Game - Display to (All players) the text: (|cfffed312The duel between + ((Name of (Owner of CDS_Unit[1])) + ( and + ((Name of (Owner of CDS_Unit[2])) + has started.))))
CDS Vote Yes

Events


Player - Player 1 (Red) types a chat message containing -accept as An exact match


Player - Player 2 (Blue) types a chat message containing -accept as An exact match


Player - Player 3 (Teal) types a chat message containing -accept as An exact match


Player - Player 4 (Purple) types a chat message containing -accept as An exact match


Player - Player 5 (Yellow) types a chat message containing -accept as An exact match


Player - Player 6 (Orange) types a chat message containing -accept as An exact match


Player - Player 7 (Green) types a chat message containing -accept as An exact match


Player - Player 8 (Pink) types a chat message containing -accept as An exact match


Player - Player 9 (Gray) types a chat message containing -accept as An exact match


Player - Player 10 (Light Blue) types a chat message containing -accept as An exact match


Player - Player 11 (Dark Green) types a chat message containing -accept as An exact match


Player - Player 12 (Brown) types a chat message containing -accept as An exact match

Conditions

Actions


-------- Chek if the right player will answer --------


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



If - Conditions




(Player(CDS_Player[1])) Equal to (Triggering player)



Then - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312You accep...




Game - Display to (Player group((Player(CDS_Player[2])))) the text: (|cfffed312 + ((Name of (Triggering player)) + has accepted duel offer.))




Set CDS_Accept = True




Set CDS_On = True




Trigger - Run CDS Create Duel <gen> (checking conditions)



Else - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312You canno...


Trigger - Turn off (This trigger)
CDS Vote No

Events


Player - Player 1 (Red) types a chat message containing -reject as An exact match


Player - Player 2 (Blue) types a chat message containing -reject as An exact match


Player - Player 3 (Teal) types a chat message containing -reject as An exact match


Player - Player 4 (Purple) types a chat message containing -reject as An exact match


Player - Player 5 (Yellow) types a chat message containing -reject as An exact match


Player - Player 6 (Orange) types a chat message containing -reject as An exact match


Player - Player 7 (Green) types a chat message containing -reject as An exact match


Player - Player 8 (Pink) types a chat message containing -reject as An exact match


Player - Player 9 (Gray) types a chat message containing -reject as An exact match


Player - Player 10 (Light Blue) types a chat message containing -reject as An exact match


Player - Player 11 (Dark Green) types a chat message containing -reject as An exact match


Player - Player 12 (Brown) types a chat message containing -reject as An exact match

Conditions

Actions


-------- Chek if the right player will answer --------


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



If - Conditions




(Player(CDS_Player[1])) Equal to (Triggering player)



Then - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312You rejec...




Game - Display to (Player group((Player(CDS_Player[2])))) the text: (|cfffed312 + ((Name of (Triggering player)) + has rejected duel offer.))




Set CDS_Accept = False




Set CDS_On = False




Set CDS_AllyCheck = False



Else - Actions




Game - Display to (Player group((Triggering player))) the text: |cfffed312You canno...


Trigger - Turn off (This trigger)
CDS Turn Off

Events


Time - CDS_Timer expires

Conditions

Actions


-------- Check if duel is in progress --------


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



If - Conditions




CDS_On Equal to True



Then - Actions




-------- Check if duel region contains both heroes --------




-------- If yes we do nothing, because duel is in progress --------




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





If - Conditions






And - All (Conditions) are true







Conditions








(CDS_Region contains CDS_Unit[1]) Equal to True








(CDS_Region contains CDS_Unit[2]) Equal to True





Then - Actions






Skip remaining actions





Else - Actions






-------- If the ask timer expires we reject the duel. --------






Game - Display to (Player group((Player(CDS_Player[1])))) the text: |cfffed312Duel time...






Game - Display to (Player group((Player(CDS_Player[2])))) the text: |cfffed312Duel time...






-------- Remove leaks --------






Custom script: call DestroyGroup(udg_CDS_UnitGroup[1])






Custom script: call DestroyGroup(udg_CDS_UnitGroup[2])






Custom script: call RemoveLocation(udg_CDS_Positions[1])






Custom script: call RemoveLocation(udg_CDS_Positions[2])






Set CDS_Accept = False






Set CDS_On = False






Set CDS_AllyCheck = False






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







If - Conditions








CDS_Invited Equal to True







Then - Actions








Set CDS_Index[1] = 0








Set CDS_Index[2] = 0








Custom script: call DestroyGroup(udg_CDS_UnitGroup[3])








Custom script: call DestroyGroup(udg_CDS_UnitGroup[4])








Custom script: call RemoveLocation(udg_CDS_Positions[3])








Custom script: call RemoveLocation(udg_CDS_Positions[4])








Set CDS_Invited = False







Else - Actions



Else - Actions
CDS Duel Is Over

Events


Unit - A unit Dies

Conditions

Actions


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



If - Conditions




CDS_Invited Equal to True



Then - Actions




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





If - Conditions






((Dying unit) is in CDS_UnitGroup[3]) Equal to True





Then - Actions






Hero - Instantly revive CDS_Unit[3] at CDS_Positions[3], Hide revival graphics






Unit - Move CDS_Unit[3] instantly to CDS_Positions[3]






Unit - Set life of CDS_Unit[3] to CDS_Unit_Life[3]






Unit - Set mana of CDS_Unit[3] to CDS_Unit_Mana[3]






Camera - Pan camera for (Owner of CDS_Unit[3]) to CDS_Positions[3] over 0.00 seconds





Else - Actions




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





If - Conditions






((Dying unit) is in CDS_UnitGroup[4]) Equal to True





Then - Actions






Hero - Instantly revive CDS_Unit[4] at CDS_Positions[4], Hide revival graphics






Unit - Set life of CDS_Unit[4] to CDS_Unit_Life[4]






Unit - Set mana of CDS_Unit[4] to CDS_Unit_Mana[4]






Camera - Pan camera for (Owner of CDS_Unit[4]) to CDS_Positions[4] over 0.00 seconds





Else - Actions



Else - Actions


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



If - Conditions




Or - Any (Conditions) are true





Conditions






((Dying unit) is in CDS_UnitGroup[1]) Equal to True






((Dying unit) is in CDS_UnitGroup[2]) Equal to True



Then - Actions




-------- If they where enemies in duel but before aliied, we make them allied again --------




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





If - Conditions






CDS_AllyCheck Equal to True





Then - Actions






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







If - Conditions








CDS_AliiesCanFight Equal to True







Then - Actions








Player - Make (Owner of CDS_Unit[1]) treat (Owner of CDS_Unit[2]) as an Ally with shared vision








Player - Make (Owner of CDS_Unit[2]) treat (Owner of CDS_Unit[1]) as an Ally with shared vision







Else - Actions





Else - Actions




-------- If one of the duel heroes dies. Duel will be over and winner will be moved to hist old position with old hp and mp. --------




-------- Reward the winner. (not needed) --------




Player - Add 250 to (Owner of (Killing unit)) Current gold




Unit - Unpause all units




Game - Display to (All players) the text: (|cfffed312 + ((Name of (Owner of (Killing unit))) + has won the duel.))




-------- Reset all cameras to normal. --------




Player Group - Pick every player in (All players) and do (Actions)





Loop - Actions






Camera - Reset camera for (Picked player) to standard game-view over 0.00 seconds




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





If - Conditions






(Triggering unit) Equal to CDS_Unit[1]





Then - Actions






Unit - Move CDS_Unit[2] instantly to CDS_Positions[2]






Unit - Set life of CDS_Unit[2] to CDS_Unit_Life[2]






Unit - Set mana of CDS_Unit[2] to CDS_Unit_Mana[2]






Camera - Pan camera for (Owner of CDS_Unit[2]) to CDS_Positions[2] over 0.00 seconds






Hero - Instantly revive CDS_Unit[1] at CDS_Positions[1], Hide revival graphics






Unit - Set life of CDS_Unit[1] to CDS_Unit_Life[1]






Unit - Set mana of CDS_Unit[1] to CDS_Unit_Mana[1]






Camera - Pan camera for (Owner of CDS_Unit[1]) to CDS_Positions[1] over 0.00 seconds





Else - Actions






Unit - Move CDS_Unit[1] instantly to CDS_Positions[1]






Unit - Set life of CDS_Unit[1] to CDS_Unit_Life[1]






Unit - Set mana of CDS_Unit[1] to CDS_Unit_Mana[1]






Camera - Pan camera for (Owner of CDS_Unit[1]) to CDS_Positions[1] over 0.00 seconds






Hero - Instantly revive CDS_Unit[2] at CDS_Positions[2], Hide revival graphics






Unit - Set life of CDS_Unit[2] to CDS_Unit_Life[2]






Unit - Set mana of CDS_Unit[2] to CDS_Unit_Mana[2]






Camera - Pan camera for (Owner of CDS_Unit[2]) to CDS_Positions[2] over 0.00 seconds




-------- Remove leaks --------




Custom script: call DestroyGroup(udg_CDS_UnitGroup[1])




Custom script: call DestroyGroup(udg_CDS_UnitGroup[2])




Custom script: call RemoveLocation(udg_CDS_Positions[1])




Custom script: call RemoveLocation(udg_CDS_Positions[2])




Set CDS_Accept = False




Set CDS_On = False




Set CDS_AllyCheck = False



Else - Actions


-------- If units where invited to the duel we set everything back to normal fot them and remove additional leaks --------


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



If - Conditions




CDS_Invited Equal to True



Then - Actions




Unit - Move CDS_Unit[3] instantly to CDS_Positions[3]




Unit - Set life of CDS_Unit[3] to CDS_Unit_Life[3]




Unit - Set mana of CDS_Unit[3] to CDS_Unit_Mana[3]




Camera - Pan camera for (Owner of CDS_Unit[3]) to CDS_Positions[3] over 0.00 seconds




Unit - Move CDS_Unit[4] instantly to CDS_Positions[4]




Unit - Set life of CDS_Unit[4] to CDS_Unit_Life[4]




Unit - Set mana of CDS_Unit[4] to CDS_Unit_Mana[4]




Camera - Pan camera for (Owner of CDS_Unit[4]) to CDS_Positions[4] over 0.00 seconds




Set CDS_Index[1] = 0




Set CDS_Index[2] = 0




Custom script: call DestroyGroup(udg_CDS_UnitGroup[3])




Custom script: call DestroyGroup(udg_CDS_UnitGroup[4])




Custom script: call RemoveLocation(udg_CDS_Positions[3])




Custom script: call RemoveLocation(udg_CDS_Positions[4])




Set CDS_Invited = False



Else - Actions