Moderator
M
Moderator
13:25, 19th Jul 2013
PurgeandFire: Changes made! Approved. Cool system!
PurgeandFire: Changes made! Approved. Cool system!
TroopInit

Events


Map initialization

Conditions

Actions


-------- Configurables --------


Set MaxTroopDistance = 1280.00


Set MaxTroops = 6


Set TroopGetRange = 256.00


Set TroopStatusAbil = TroopStatus


Set CommanderStatusAbil = CommanderStatus


-------- Picking all previously placed units --------


Set TempPointA = (Point(0.00, 0.00))


Custom script: call DestroyGroup(udg_Troops)


Set Troops = (Units within 90000.00 of TempPointA matching ((Level of TroopStatus for (Matching unit)) Greater than 0))


Custom script: call DestroyGroup(udg_Commanders)


Set Commanders = (Units within 90000.00 of TempPointA matching ((Level of CommanderStatus for (Matching unit)) Greater than 0))


Custom script: call RemoveLocation(udg_TempPointA)


-------- All done. Display debug message to prove it. --------


Game - Display to (All players) the text: Commander System In...
TroopEnter

Events


Unit - A unit enters (Playable map area)

Conditions

Actions


Set TempUnitA = (Triggering unit)


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



If - Conditions




(TempUnitA is in Commanders) Equal to False




(Level of CommanderStatusAbil for TempUnitA) Greater than 0



Then - Actions




Unit Group - Add TempUnitA to Commanders



Else - Actions


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



If - Conditions




(TempUnitA is in Troops) Equal to False




(Level of TroopStatusAbil for TempUnitA) Greater than 0



Then - Actions




Unit Group - Add TempUnitA to Troops



Else - Actions


Set TempUnitA = No unit
TroopLeave

Events


Unit - A unit Dies

Conditions

Actions


Set TempUnitA = (Triggering unit)


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



If - Conditions




(TempUnitA is in Commanders) Equal to True



Then - Actions




Unit Group - Remove TempUnitA from Commanders



Else - Actions


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



If - Conditions




(TempUnitA is in Troops) Equal to True



Then - Actions




Unit Group - Remove TempUnitA from Troops



Else - Actions
CommanderCheck

Events


Time - Every 5.00 seconds of game time

Conditions

Actions


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



Loop - Actions




Set TempUnitA = (Picked unit)




Unit Group - Pick every unit in CommanderTroops[(Custom value of TempUnitA)] and do (Actions)





Loop - Actions






Set TempUnitB = (Picked unit)






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







If - Conditions








(Owner of TempUnitB) Not equal to (Owner of TempUnitA)







Then - Actions








Unit Group - Remove TempUnitB from CommanderTroops[(Custom value of TempUnitA)]








Set CommanderTroopCount[(Custom value of TempUnitA)] = (CommanderTroopCount[(Custom value of TempUnitA)] - 1)








Set UnitCommander[(Custom value of TempUnitB)] = No unit







Else - Actions
TroopGet

Events


Time - Every 0.59 seconds of game time

Conditions

Actions


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



Loop - Actions




Set TempUnitA = (Picked unit)




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





If - Conditions






(Number of units in CommanderTroops[(Custom value of TempUnitA)]) Less than MaxTroops





Then - Actions






Set TempPointA = (Position of TempUnitA)






Custom script: set bj_wantDestroyGroup = true






Unit Group - Pick every unit in (Units within TroopGetRange of TempPointA) and do (Actions)







Loop - Actions








Set TempUnitB = (Picked unit)








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









If - Conditions










CommanderTroopCount[(Custom value of TempUnitA)] Less than MaxTroops










UnitCommander[(Custom value of TempUnitB)] Equal to No unit










TempUnitB Not equal to TempUnitA










(Level of TroopStatusAbil for TempUnitB) Greater than 0









Then - Actions










Unit - Change ownership of TempUnitB to (Owner of TempUnitA) and Change color










Unit Group - Add TempUnitB to CommanderTroops[(Custom value of TempUnitA)]










Set CommanderTroopCount[(Custom value of TempUnitA)] = (CommanderTroopCount[(Custom value of TempUnitA)] + 1)










Set UnitCommander[(Custom value of TempUnitB)] = TempUnitA









Else - Actions






Custom script: call RemoveLocation(udg_TempPointA)





Else - Actions
CommanderDeath

Events


Unit - A unit Dies

Conditions


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

Actions


Set TempUnitA = (Triggering unit)


Unit Group - Remove TempUnitA from Commanders


Custom script: set bj_wantDestroyGroup = true


Unit Group - Pick every unit in CommanderTroops[(Custom value of TempUnitA)] and do (Actions)



Loop - Actions




Unit Group - Remove (Picked unit) from CommanderTroops[(Custom value of TempUnitA)]




Set CommanderTroopCount[(Custom value of TempUnitA)] = (CommanderTroopCount[(Custom value of TempUnitA)] - 1)
TroopCheck

Events


Time - Every 3.01 seconds of game time

Conditions

Actions


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



Loop - Actions




Set TempUnitA = (Picked unit)




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





If - Conditions






(Unit-type of UnitCommander[(Custom value of TempUnitA)]) Equal to No unit-type






UnitCommander[(Custom value of TempUnitA)] Not equal to No unit





Then - Actions






Unit - Change ownership of TempUnitA to Neutral Passive and Change color






Set UnitCommander[(Custom value of TempUnitA)] = No unit





Else - Actions




Set TempPointA = (Position of TempUnitA)




Set TempPointB = (Position of UnitCommander[(Custom value of TempUnitA)])




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





If - Conditions






(Distance between TempPointA and TempPointB) Greater than MaxTroopDistance





Then - Actions






Unit Group - Remove TempUnitA from CommanderTroops[(Custom value of UnitCommander[(Custom value of TempUnitA)])]






Set CommanderTroopCount[(Custom value of UnitCommander[(Custom value of TempUnitA)])] = ((Custom value of UnitCommander[(Custom value of TempUnitA)]) - 1)






Unit - Change ownership of TempUnitA to Neutral Passive and Change color






Set UnitCommander[(Custom value of TempUnitA)] = No unit





Else - Actions




Custom script: call RemoveLocation(udg_TempPointA)




Custom script: call RemoveLocation(udg_TempPointB)