Chaosy
Tutorial Reviewer
- Joined
- Jun 9, 2011
- Messages
- 13,291
Could have sworn I saw another oil system but the one only I found was this [vJASS] Oil Resource System
Init Var

Events


Game - UnitIndexEvent becomes Equal to 3.00

Conditions

Actions


-------- Set Flexible Variables --------


Set VariableSet OilReturnAmount = 1


Set VariableSet OilReturnAmount = 300


-------- Preplaced Platforms and Shipyards --------


Unit Group - Pick every unit in (Units of type Human Oil Platform) and do (Actions)



Loop - Actions




Set VariableSet PlatformUnit = (Picked unit)




Unit Group - Add PlatformUnit to OilPlatformGroup




Set VariableSet PlatformIndex = (Custom value of PlatformUnit)




Set VariableSet OilPlatformAmount[PlatformIndex] = (Random integer number between 1000 and 5000)




Unit - Set Name of PlatformUnit to ((Name of PlatformUnit) + ( + ([ + ((String(OilPlatformAmount[PlatformIndex])) + ]))))


Unit Group - Pick every unit in (Units of type Human Shipyard) and do (Actions)



Loop - Actions




Unit Group - Add (Picked unit) to ShipyardGroup


-------- Oil Patches and Resource Amount --------


Unit Group - Pick every unit in (Units of type Oil Patch (medium)) and do (Actions)



Loop - Actions




Set VariableSet OilPatchUnit = (Picked unit)




Unit Group - Add OilPatchUnit to OilPatchGroup




Set VariableSet OilPatchIndex = (Custom value of OilPatchUnit)




Set VariableSet OilPatchAmount[OilPatchIndex] = (Random integer number between 1000 and 5000)




Unit - Set Name of OilPatchUnit to ((Name of OilPatchUnit) + ( + ([ + ((String(OilPatchAmount[OilPatchIndex])) + ]))))


-------- Enable Periodic/Time Triggers --------


Trigger - Turn on Oil Leaderboard <gen>


Trigger - Turn on Oil Platform Extraction Time <gen>


Trigger - Turn on Shipyard Return Time <gen>
Oil Leaderboard

Events


Time - Elapsed game time is 0.10 seconds

Conditions

Actions


-------- Oil Leaderboard --------


Set VariableSet OilPlayerGroup = (All players)


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



Loop - Actions




Set VariableSet CurrentPlayerNumber = (Player number of (Picked player))




Leaderboard - Create a leaderboard for OilPlayerGroup titled Oil




Set VariableSet OilLeaderboard = (Last created leaderboard)




Leaderboard - Show OilLeaderboard




Leaderboard - Add (Picked player) to OilLeaderboard with label Amount: and value (OilBoardValue[CurrentPlayerNumber] + 300)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 300)


-------- Oil Patch Hieght Test --------
Incude Built Shipyards n Platforms

Events


Unit - A unit Finishes construction


Unit - A unit Begins construction

Conditions

Actions


-------- Oil Platforms --------


-------- Finished Constructing --------


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



If - Conditions




(Unit-type of (Constructed structure)) Equal to Human Oil Platform




((Constructed structure) is in OilPlatformGroup.) Equal to True



Then - Actions




-------- Set Name Oil Amount --------




Set VariableSet PlatformUnit = (Constructed structure)




Unit - Remove Platform or Shipyard Occupied (Channel Dummy Ability) from PlatformUnit




Unit Group - Add PlatformUnit to OilPlatformGroup




Set VariableSet PlatformIndex = (Custom value of PlatformUnit)




Set VariableSet PlatformUnitPoint = (Position of PlatformUnit)




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





Loop - Actions






Set VariableSet OilPatchUnit = (Picked unit)






Set VariableSet OilPatchIndex = (Custom value of OilPatchUnit)






Set VariableSet OilPatchUnitPoint = (Position of OilPatchUnit)






-------- Check if Platform is in Oil Patch Region --------






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







If - Conditions








(Distance between PlatformUnitPoint and OilPatchUnitPoint) Less than or equal to 150.00







Then - Actions








Game - Display to (All players) the text: PLATFORM IN OIL PAT...








Set VariableSet OilPlatformAmount[PlatformIndex] = OilPatchAmount[OilPatchIndex]








Unit - Set Name of PlatformUnit to (Human Oil Platform + ( + ([ + ((String(OilPatchAmount[OilPatchIndex])) + ]))))








Unit Group - Remove OilPatchUnit from OilPatchGroup.








Game - Display to (All players) the text: (String(OilPlatformAmount[PlatformIndex]))







Else - Actions




Custom script: call RemoveLocation (udg_PlatformUnitPoint)




Custom script: call RemoveLocation (udg_OilPatchUnitPoint)



Else - Actions




-------- Shipyards --------




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





If - Conditions






(Unit-type of (Constructed structure)) Equal to Human Shipyard





Then - Actions






Unit Group - Add (Constructed structure) to ShipyardGroup





Else - Actions


-------- Begun Construction --------


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



If - Conditions




(Unit-type of (Constructing structure)) Equal to Human Oil Platform




((Constructing structure) is in OilPlatformGroup.) Equal to False



Then - Actions




-------- Set Name Oil Amount --------




Set VariableSet PlatformUnit = (Constructing structure)




Unit - Add Platform or Shipyard Occupied (Channel Dummy Ability) to PlatformUnit




Unit Group - Add PlatformUnit to OilPlatformGroup




Set VariableSet PlatformIndex = (Custom value of PlatformUnit)




Set VariableSet PlatformUnitPoint = (Position of PlatformUnit)




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





Loop - Actions






Set VariableSet OilPatchUnit = (Picked unit)






Set VariableSet OilPatchIndex = (Custom value of OilPatchUnit)






Set VariableSet OilPatchUnitPoint = (Position of OilPatchUnit)






-------- Check if Platform is in Oil Patch Region --------






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







If - Conditions








(Distance between PlatformUnitPoint and OilPatchUnitPoint) Less than or equal to 150.00







Then - Actions








Game - Display to (All players) the text: CONSTRUCTING PLATFO...








Set VariableSet OilPlatformAmount[PlatformIndex] = OilPatchAmount[OilPatchIndex]








Unit - Set Name of PlatformUnit to (Human Oil Platform + ( + ([ + ((String(OilPatchAmount[OilPatchIndex])) + ]))))








Unit Group - Remove OilPatchUnit from OilPatchGroup.








Game - Display to (All players) the text: (String(OilPlatformAmount[PlatformIndex]))







Else - Actions




Custom script: call RemoveLocation (udg_PlatformUnitPoint)




Custom script: call RemoveLocation (udg_OilPatchUnitPoint)



Else - Actions
Exclude Destroyed Platforms Shipyards Patches

Events


Unit - A unit Dies

Conditions

Actions


-------- Oil Platforms --------


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



If - Conditions




(Unit-type of (Dying unit)) Equal to Human Oil Platform



Then - Actions




Unit Group - Remove (Dying unit) from OilPlatformGroup.



Else - Actions




-------- Shipyards --------




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





If - Conditions






(Unit-type of (Dying unit)) Equal to Human Shipyard





Then - Actions






Unit Group - Remove (Dying unit) from ShipyardGroup.





Else - Actions






-------- Oil Patches --------






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







If - Conditions








(Unit-type of (Dying unit)) Equal to Oil Patch (medium)







Then - Actions








Unit Group - Remove (Dying unit) from OilPatchGroup.








Game - Display to (All players) the text: OIL PATCH DIED







Else - Actions
Tanker Platform Build Point Track

Events


Unit - A unit Is issued an order targeting an object

Conditions


(Issued order) Equal to (Order(custom_h000))

Actions


-------- Indexing Tanker --------


Set VariableSet TankerUnit = (Ordered unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


-------- Remove Potential Leaks --------


Unit Group - Remove TankerUnit from TankerBuildTrackGroup.


Custom script: call RemoveLocation (udg_NewPlatformPoint[udg_OilIndex])


-------- Continue Indexing --------


Set VariableSet NewPlatformPoint[OilIndex] = (Position of (Target unit of issued order))


Unit Group - Add TankerUnit to TankerBuildTrackGroup


Game - Display to (All players) the text: TRACKING TANKER ORD...
Tanker Auto Extract Order on Platform Finish

Events


Unit - A unit Finishes construction

Conditions

Actions


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



If - Conditions




(Unit-type of (Constructed structure)) Equal to Human Oil Platform



Then - Actions




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





Loop - Actions






Set VariableSet TankerUnit = (Picked unit)






Set VariableSet OilIndex = (Custom value of TankerUnit)






Set VariableSet NewPlatformUnit[OilIndex] = (Constructed structure)






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







If - Conditions








((Region centered at NewPlatformPoint[OilIndex] with size (300.00, 500.00)) contains NewPlatformUnit[OilIndex]) Equal to True







Then - Actions








Unit - Order TankerUnit to Right-Click NewPlatformUnit[OilIndex]








Unit Group - Remove TankerUnit from TankerBuildTrackGroup.








Custom script: call RemoveLocation (udg_NewPlatformPoint[udg_OilIndex])








Game - Display to (All players) the text: TANKER EXTRACT NEW ...







Else - Actions



Else - Actions
Tanker Extract Order

Events


Unit - A unit Is issued an order targeting an object

Conditions


(Unit-type of (Ordered unit)) Equal to Human Transport Ship


(Unit-type of (Target unit of issued order)) Equal to Human Oil Platform


(Owner of (Ordered unit)) Equal to (Owner of (Target unit of issued order))


(Issued order) Not equal to (Order(harvest))


(Level of Extract (Channel) for (Ordered unit)) Equal to 1

Actions


Set VariableSet TankerUnit = (Ordered unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


Set VariableSet TankerPlatform[OilIndex] = (Target unit of issued order)


Unit - Order TankerUnit to Harvest TankerPlatform[OilIndex]


Unit Group - Remove TankerUnit from ReturnOrderGroup.


Unit Group - Add TankerUnit to ExtractionOrderGroup


-------- Index Tanker to Platform --------


Set VariableSet PlatformExtractionIndex[OilIndex] = (Custom value of TankerPlatform[OilIndex])


Set VariableSet TankerPlatformMatch[OilIndex] = PlatformExtractionIndex[OilIndex]


Game - Display to (All players) the text: (matching indices - + (String(TankerPlatformMatch[OilIndex])))


Game - Display to (All players) the text: PLATFORM CHANNEL OR...
Tanker Extract Ability

Events


Unit - A unit Starts the effect of an ability

Conditions


(Unit-type of (Casting unit)) Equal to Human Transport Ship


(Ability being cast) Equal to Extract (Channel)


(Unit-type of (Target unit of ability being cast)) Equal to Human Oil Platform


(Level of Platform or Shipyard Occupied (Channel Dummy Ability) for (Target unit of ability being cast)) Equal to 0

Actions


-------- Platform and Tanker Indexing --------


Set VariableSet TankerUnit = (Casting unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


Set VariableSet TankerPlatform[OilIndex] = (Target unit of ability being cast)


-------- Platform Occupied True --------


Unit - Add Platform or Shipyard Occupied (Channel Dummy Ability) to TankerPlatform[OilIndex]


-------- Index Tanker to Platform --------


Set VariableSet PlatformExtractionIndex[OilIndex] = (Custom value of TankerPlatform[OilIndex])


Set VariableSet TankerPlatformMatch[OilIndex] = PlatformExtractionIndex[OilIndex]


-------- Extraction Time Indexing --------


Set VariableSet OilExtractionTime[OilIndex] = 20


-------- Add Tanker to Oil Extraction Group --------


Unit Group - Add TankerUnit to OilExtractionGroup


-------- Stop Tanker from Channeling / Using the Ability --------


Unit - Order TankerUnit to Stop.


-------- Hide Tanker --------


Unit - Hide TankerUnit


Game - Display to (All players) the text: PLATFORM CHANNEL FX
Oil Platform Destroyed Ship Stop

Events


Unit - A unit Dies

Conditions


(Unit-type of (Dying unit)) Equal to Human Oil Platform

Actions


-------- Tanker Extraction Order Stop --------


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



Loop - Actions




-------- Tanker Indexing --------




Set VariableSet TankerUnit = (Picked unit)




Set VariableSet OilIndex = (Custom value of TankerUnit)




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





If - Conditions






(TankerPlatform[OilIndex] is alive) Equal to False





Then - Actions






-------- Order Tanker to Stop --------






Unit - Order TankerUnit to Stop.






Game - Display to (All players) the text: PLATFORM DEAD - STOP





Else - Actions


-------- Recreate Oil Patch if Oil > 0 --------


Set VariableSet PlatformUnit = (Dying unit)


Unit Group - Remove PlatformUnit from OilPlatformGroup.


Set VariableSet PlatformIndex = (Custom value of PlatformUnit)


Set VariableSet PlatformUnitPoint = (Position of PlatformUnit)


Set VariableSet OilPlatformAmount[PlatformIndex] = OilPlatformAmount[PlatformIndex]


Game - Display to (All players) the text: (String(OilPlatformAmount[PlatformIndex]))


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



If - Conditions




OilPlatformAmount[PlatformIndex] Greater than 0



Then - Actions




Unit - Create 1 Oil Patch (medium) for Neutral Passive at PlatformUnitPoint facing Default building facing degrees




Set VariableSet OilPatchUnit = (Last created unit)




Unit Group - Add OilPatchUnit to OilPatchGroup




Set VariableSet OilPatchIndex = (Custom value of OilPatchUnit)




Set VariableSet OilPatchAmount[OilPatchIndex] = OilPlatformAmount[PlatformIndex]




Unit - Set Name of OilPatchUnit to ((Name of OilPatchUnit) + ( + ([ + ((String(OilPatchAmount[OilPatchIndex])) + ]))))




Game - Display to (All players) the text: OIL PATCH REMAKE




Game - Display to (All players) the text: (String(OilPatchAmount[OilPatchIndex]))



Else - Actions


Custom script: call RemoveLocation (udg_PlatformUnitPoint)
Oil Platform Extraction Time

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


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



Loop - Actions




-------- Tanker Indexing --------




Set VariableSet TankerUnit = (Picked unit)




Set VariableSet OilIndex = (Custom value of TankerUnit)




Set VariableSet TankerPositionPlatf = (Position of TankerUnit)




-------- Mining Time Decrease --------




Set VariableSet OilExtractionTime[OilIndex] = (OilExtractionTime[OilIndex] - 1)




-------- Mining Finished --------




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





If - Conditions






OilExtractionTime[OilIndex] Equal to 0






(TankerPlatform[OilIndex] is alive) Equal to True





Then - Actions






-------- Remove Tanker from Oil Extraction Group --------






Unit Group - Remove TankerUnit from OilExtractionGroup.






-------- Remove Extract Add Return Oil --------






Unit - Remove Extract (Channel) from TankerUnit






Unit - Add Return Resources (Channel) to TankerUnit






Unit - Add Return Resources - Targeting Hidden (Channel) to TankerUnit






-------- Unhide Tanker --------






Unit - Unhide TankerUnit






-------- Platform Occupied False --------






Unit - Remove Platform or Shipyard Occupied (Channel Dummy Ability) from TankerPlatform[OilIndex]






-------- Order Tanker to Return / Set Distances and Positions --------






Set VariableSet TankerShipyardPlatformDistance = 99999.00






Set VariableSet TankerPositionPlatf = (Position of TankerUnit)






Set VariableSet ClosestShipyardPlatform = No unit






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







Loop - Actions








-------- Compare Distances --------








Set VariableSet TankerShipyard[OilIndex] = (Picked unit)








Set VariableSet ShipyardPlatformPosition = (Position of TankerShipyard[OilIndex])








Set VariableSet TankerSPCompareDistance = (Distance between TankerPositionPlatf and ShipyardPlatformPosition)








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









If - Conditions










TankerSPCompareDistance Less than or equal to TankerShipyardPlatformDistance









Then - Actions










Set VariableSet ClosestShipyardPlatform = TankerShipyard[OilIndex]










Set VariableSet TankerShipyardPlatformDistance = TankerSPCompareDistance









Else - Actions








Set VariableSet TankerShipyard[OilIndex] = ClosestShipyardPlatform








Unit - Order TankerUnit to Right-Click ClosestShipyardPlatform








Custom script: call RemoveLocation (udg_ShipyardPlatformPosition)






-------- Subtract Oil from Platform --------






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







Loop - Actions








Set VariableSet PlatformUnit = (Picked unit)








Set VariableSet PlatformIndex = (Custom value of PlatformUnit)








Set VariableSet PlatformUnitPoint = (Position of PlatformUnit)








Set VariableSet OilPlatformAmount[PlatformIndex] = OilPlatformAmount[PlatformIndex]








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









If - Conditions










(Distance between TankerPositionPlatf and PlatformUnitPoint) Less than or equal to 300.00









Then - Actions










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











If - Conditions












OilPlatformAmount[PlatformIndex] Greater than or equal to OilReturnAmount











Then - Actions












Set VariableSet OilPlatformAmount[PlatformIndex] = (OilPlatformAmount[PlatformIndex] - OilReturnAmount)












Set VariableSet OilReturnAmountCurrent[OilIndex] = OilReturnAmount











Else - Actions












Set VariableSet OilReturnAmountCurrent[OilIndex] = OilPlatformAmount[PlatformIndex]












Set VariableSet OilPlatformAmount[PlatformIndex] = 0










Unit - Set Name of TankerPlatform[OilIndex] to (Human Oil Platform + ( + ([ + ((String(OilPlatformAmount[PlatformIndex])) + ]))))










Game - Display to (All players) the text: RIGHT PLATFORM










Game - Display to (All players) the text: (String(OilPlatformAmount[PlatformIndex]))









Else - Actions








-------- Destroy Platform on 0 Oil --------








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









If - Conditions










OilPlatformAmount[PlatformIndex] Less than 1









Then - Actions










Unit - Kill PlatformUnit










Unit Group - Remove PlatformUnit from OilPlatformGroup.









Else - Actions






Custom script: call RemoveLocation (udg_PlatformUnitPoint)






Custom script: call RemoveLocation (udg_OilPatchUnitPoint)






Custom script: call RemoveLocation (udg_TankerPositionPlatf)





Else - Actions






-------- Kill and Exclude Interior Ships if Platform Destroyed --------






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







If - Conditions








OilExtractionTime[OilIndex] Equal to 0








(TankerPlatform[OilIndex] is alive) Equal to False







Then - Actions








-------- Remove Tanker from Oil Extraction Group --------








Unit Group - Remove TankerUnit from OilExtractionGroup.








-------- Kill Ship Inside --------








Unit - Kill TankerUnit







Else - Actions




-------- Order Queuing Tankers --------




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





If - Conditions






(TankerPlatform[OilIndex] is alive) Equal to True





Then - Actions






Set VariableSet PlatformUnitPoint = (Position of TankerPlatform[OilIndex])






Set VariableSet PlatformQueuingTankerGroup = (Units within 300.00 of PlatformUnitPoint matching ((((Matching unit) belongs to an enemy of (Owner of TankerPlatform[OilIndex]).) Equal to False) and ((Unit-type of (Matching unit)) Equal to Human Transport Ship)).)






Custom script: set bj_wantDestroyGroup = true






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







Loop - Actions








Set VariableSet TankerUnit = (Picked unit)








Set VariableSet OilIndex = (Custom value of TankerUnit)








-------- Avoiding the Pain of Matching Condition(s) --------








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









If - Conditions










(Level of Extract (Channel) for (Picked unit)) Equal to 1










((Picked unit) is in ExtractionOrderGroup.) Equal to True










TankerPlatformMatch[OilIndex] Equal to PlatformExtractionIndex[OilIndex]









Then - Actions










Game - Display to (All players) the text: (matching indices 2 - + (String(TankerPlatformMatch[OilIndex])))










Unit - Order (Picked unit) to Right-Click TankerPlatform[OilIndex]










Game - Display to (All players) the text: TANKER AWAITING EXT...









Else - Actions






Custom script: call RemoveLocation (udg_PlatformUnitPoint)





Else - Actions
Tanker Return Order

Events


Unit - A unit Is issued an order targeting an object

Conditions


(Unit-type of (Ordered unit)) Equal to Human Transport Ship


(Unit-type of (Target unit of issued order)) Equal to Human Shipyard


(Owner of (Ordered unit)) Equal to (Owner of (Target unit of issued order))


(Issued order) Not equal to (Order(attack))


(Level of Return Resources - Targeting Hidden (Channel) for (Ordered unit)) Equal to 1

Actions


Set VariableSet TankerUnit = (Ordered unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


Set VariableSet TankerShipyard[OilIndex] = (Target unit of issued order)


Unit - Order TankerUnit to Attack TankerShipyard[OilIndex]


Unit Group - Remove TankerUnit from ExtractionOrderGroup.


Unit Group - Add TankerUnit to ReturnOrderGroup


-------- Index Tanker to Platform --------


Set VariableSet ShipyardReturnIndex[OilIndex] = (Custom value of TankerShipyard[OilIndex])


Set VariableSet TankerShipyardMatch[OilIndex] = ShipyardReturnIndex[OilIndex]


Game - Display to (All players) the text: SHIPYARD CHANNEL OR...
Tanker Hidden Return Ability

Events


Unit - A unit Starts the effect of an ability

Conditions


(Unit-type of (Casting unit)) Equal to Human Transport Ship


(Ability being cast) Equal to Return Resources - Targeting Hidden (Channel)


(Unit-type of (Target unit of ability being cast)) Equal to Human Shipyard


(Level of Platform or Shipyard Occupied (Channel Dummy Ability) for (Target unit of ability being cast)) Equal to 0

Actions


-------- Shipyard and Tanker Indexing --------


Set VariableSet TankerUnit = (Casting unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


Set VariableSet TankerShipyard[OilIndex] = (Target unit of ability being cast)


Set VariableSet ShipyardReturnIndex[OilIndex] = (Custom value of TankerShipyard[OilIndex])


-------- Shipyard Occupied True --------


Unit - Add Platform or Shipyard Occupied (Channel Dummy Ability) to TankerShipyard[OilIndex]


-------- Return Time Indexing --------


Set VariableSet OilReturnTime[OilIndex] = 20


-------- Add Tanker to Oil Return Group --------


Unit Group - Add TankerUnit to OilReturnGroup


-------- Stop Tanker from Channeling / Using the Ability --------


Unit - Order TankerUnit to Stop.


-------- Hide Tanker --------


Unit - Hide TankerUnit


-------- Index Tanker to Platform --------


Set VariableSet ShipyardReturnIndex[OilIndex] = (Custom value of TankerShipyard[OilIndex])


Set VariableSet TankerShipyardMatch[OilIndex] = ShipyardReturnIndex[OilIndex]


Game - Display to (All players) the text: SHIPYARD CHANNEL FX
Tanker Visible Return Ability

Events


Unit - A unit Starts the effect of an ability

Conditions


(Unit-type of (Casting unit)) Equal to Human Transport Ship


(Ability being cast) Equal to Return Resources (Channel)

Actions


-------- Tanker Indexing --------


Set VariableSet TankerUnit = (Casting unit)


Set VariableSet OilIndex = (Custom value of TankerUnit)


-------- Order Tanker to Return / Set Distances and Positions --------


Set VariableSet TankerShipyardPlatformDistance = 99999.00


Set VariableSet TankerPositionShipy = (Position of TankerUnit)


Set VariableSet ClosestShipyardPlatform = No unit


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



Loop - Actions




-------- Compare Distances --------




Set VariableSet TankerShipyard[OilIndex] = (Picked unit)




Set VariableSet ShipyardPlatformPosition = (Position of TankerShipyard[OilIndex])




Set VariableSet TankerSPCompareDistance = (Distance between TankerPositionPlatf and ShipyardPlatformPosition)




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





If - Conditions






TankerSPCompareDistance Less than or equal to TankerShipyardPlatformDistance





Then - Actions






Set VariableSet ClosestShipyardPlatform = TankerShipyard[OilIndex]






Set VariableSet TankerShipyardPlatformDistance = TankerSPCompareDistance





Else - Actions




Set VariableSet TankerShipyard[OilIndex] = ClosestShipyardPlatform




Unit - Order TankerUnit to Attack ClosestShipyardPlatform




Custom script: call RemoveLocation (udg_ShipyardPlatformPosition)




Game - Display to (All players) the text: RETURN RESOURCES CL...


Custom script: call RemoveLocation (udg_TankerPositionShipy)
Oil Shipyard Destroyed Ship Reorder

Events


Unit - A unit Dies

Conditions


(Unit-type of (Dying unit)) Equal to Human Shipyard

Actions


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



Loop - Actions




-------- Tanker Indexing --------




Set VariableSet TankerUnit = (Picked unit)




Set VariableSet OilIndex = (Custom value of TankerUnit)




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





If - Conditions






(TankerShipyard[OilIndex] is alive) Equal to False






(Number of units in ShipyardGroup) Greater than 0






(Current order of TankerUnit) Equal to (Order(attack))





Then - Actions






-------- Order Tanker to Return / Set Distances and Positions --------






Set VariableSet TankerShipyardPlatformDistance = 99999.00






Set VariableSet TankerPositionPlatf = (Position of TankerUnit)






Set VariableSet ClosestShipyardPlatform = No unit






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







Loop - Actions








-------- Compare Distances --------








Set VariableSet TankerShipyard[OilIndex] = (Picked unit)








Set VariableSet ShipyardPlatformPosition = (Position of TankerShipyard[OilIndex])








Set VariableSet TankerSPCompareDistance = (Distance between TankerPositionPlatf and ShipyardPlatformPosition)








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









If - Conditions










TankerSPCompareDistance Less than or equal to TankerShipyardPlatformDistance









Then - Actions










Set VariableSet ClosestShipyardPlatform = TankerShipyard[OilIndex]










Set VariableSet TankerShipyardPlatformDistance = TankerSPCompareDistance









Else - Actions








Set VariableSet TankerShipyard[OilIndex] = ClosestShipyardPlatform








Unit - Order TankerUnit to Attack ClosestShipyardPlatform








Custom script: call RemoveLocation (udg_ShipyardPlatformPosition)








Game - Display to (All players) the text: RETURN RESOURCES CL...






Game - Display to (All players) the text: SHIPYARD DEAD - REO...





Else - Actions






-------- Tanker Stop if no Shipyards when Returning --------






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







If - Conditions








(TankerShipyard[OilIndex] is alive) Equal to False








(Number of units in ShipyardGroup) Equal to 0








(Current order of TankerUnit) Equal to (Order(attack))







Then - Actions








Unit - Order TankerUnit to Stop.







Else - Actions
Shipyard Return Time

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


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



Loop - Actions




-------- Tanker Indexing --------




Set VariableSet TankerUnit = (Picked unit)




Set VariableSet OilIndex = (Custom value of TankerUnit)




-------- Return Time Decrease --------




Set VariableSet OilReturnTime[OilIndex] = (OilReturnTime[OilIndex] - 1)




-------- Return Finished --------




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





If - Conditions






OilReturnTime[OilIndex] Equal to 0






(TankerShipyard[OilIndex] is alive) Equal to True





Then - Actions






-------- Remove Tanker from Shipyard Return Group --------






Unit Group - Remove TankerUnit from OilReturnGroup.






-------- Remove Return Oil Add Extract --------






Unit - Remove Return Resources - Targeting Hidden (Channel) from TankerUnit






Unit - Remove Return Resources (Channel) from TankerUnit






Unit - Add Extract (Channel) to TankerUnit






-------- Unhide Tanker --------






Unit - Unhide TankerUnit






-------- Add Oil to Player --------






Leaderboard - Change the value for (Owner of TankerUnit) in OilLeaderboard to (OilBoardValue[(Player number of (Owner of TankerUnit))] + OilReturnAmountCurrent[OilIndex])






Set VariableSet OilBoardValue[(Player number of (Owner of TankerUnit))] = (OilBoardValue[(Player number of (Owner of TankerUnit))] + OilReturnAmountCurrent[OilIndex])






-------- Oil Floating Text --------






Floating Text - Create floating text that reads (|cff808080+|r + (String(OilReturnAmountCurrent[OilIndex]))) above TankerShipyard[OilIndex] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency






Set VariableSet OilText[OilIndex] = (Last created floating text)






Floating Text - Set the velocity of OilText[OilIndex] to 64.00 towards 90.00 degrees






Floating Text - Show OilText[OilIndex] for (Player group((Owner of TankerUnit)))






Floating Text - Change OilText[OilIndex]: Disable permanence






Floating Text - Change the fading age of OilText[OilIndex] to 1.00 seconds






Floating Text - Change the lifespan of OilText[OilIndex] to 2.00 seconds






-------- Shipyard Occupied False --------






Unit - Remove Platform or Shipyard Occupied (Channel Dummy Ability) from TankerShipyard[OilIndex]






-------- Order Tanker to Resume Extracting / Set Distances and Positions --------






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







If - Conditions








(TankerPlatform[OilIndex] is alive) Equal to True







Then - Actions








Unit - Order TankerUnit to Right-Click TankerPlatform[OilIndex]







Else - Actions





Else - Actions




-------- Order Queuing Tankers --------




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





If - Conditions






(TankerShipyard[OilIndex] is alive) Equal to True





Then - Actions






Set VariableSet ShipyardUnitPoint = (Position of TankerShipyard[OilIndex])






Set VariableSet ShipyardQueuingTankerGroup = (Units within 300.00 of ShipyardUnitPoint matching ((((Matching unit) belongs to an enemy of (Owner of TankerShipyard[OilIndex]).) Equal to False) and ((Unit-type of (Matching unit)) Equal to Human Transport Ship)).)






Custom script: set bj_wantDestroyGroup = true






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







Loop - Actions








Set VariableSet TankerUnit = (Picked unit)








Set VariableSet OilIndex = (Custom value of TankerUnit)








-------- Avoiding the Pain of Matching Condition(s) --------








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









If - Conditions










(Level of Return Resources - Targeting Hidden (Channel) for (Picked unit)) Equal to 1










((Picked unit) is in ReturnOrderGroup.) Equal to True










TankerShipyardMatch[OilIndex] Equal to ShipyardReturnIndex[OilIndex]









Then - Actions










Unit - Order (Picked unit) to Right-Click TankerShipyard[OilIndex]










Game - Display to (All players) the text: TANKER AWAITING RET...









Else - Actions






Custom script: call RemoveLocation (udg_ShipyardUnitPoint)





Else - Actions
Tanker Order Reset

Events


Unit - A unit Is issued an order targeting an object


Unit - A unit Is issued an order targeting a point


Unit - A unit Is issued an order with no target

Conditions


(Unit-type of (Ordered unit)) Equal to Human Transport Ship

Actions


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



If - Conditions




((Target unit of issued order) is in OilPlatformGroup.) Equal to False



Then - Actions




Unit Group - Remove (Ordered unit) from ExtractionOrderGroup.




Game - Display to (All players) the text: NOT IN PLATFORM GRO...



Else - Actions


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



If - Conditions




((Target unit of issued order) is in ShipyardGroup.) Equal to False



Then - Actions




Unit Group - Remove (Ordered unit) from ReturnOrderGroup.




Game - Display to (All players) the text: NOT IN SHIPYARD GRO...



Else - Actions
Advanced Building Menu On

Events


Unit - A unit Begins channeling an ability

Conditions


(Ability being cast) Equal to Advanced Building


Or - Any (Conditions) are true



Conditions




(Unit-type of (Casting unit)) Equal to Peasant




(Unit-type of (Casting unit)) Equal to Peasant (Advanced)

Actions


Set VariableSet AdvancedWorker = (Casting unit)


-------- Peasant --------


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



If - Conditions




(Unit-type of (Casting unit)) Equal to Peasant




(Ability being cast) Equal to Advanced Building



Then - Actions




Game - Display to (All players) the text: PEASANT ADVANCED BU...




-------- Remove Unneeded Buff --------




Unit - Remove Advanced Building buff from AdvancedWorker




-------- Change to Advanced Peasant --------




Unit - Add Advanced Peasant (Berserker Upgrade) to AdvancedWorker




-------- Open Up Regular Build Menu --------




Game - Force (Owner of AdvancedWorker) to press the key B.




-------- Add Advanced Peasant to Group --------




Unit Group - Add AdvancedWorker to AdvancedPeasantGroup[(Player number of (Owner of AdvancedWorker))]




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





If - Conditions






(Current order of AdvancedWorker) Not equal to (Order(move))






(Current order of AdvancedWorker) Not equal to (Order(smart))






(Current order of AdvancedWorker) Not equal to (Order(stop))





Then - Actions






Unit - Order AdvancedWorker to Stop.





Else - Actions



Else - Actions




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





If - Conditions






(Unit-type of (Casting unit)) Equal to Peasant (Advanced)






(Ability being cast) Equal to Advanced Building





Then - Actions






Game - Display to (All players) the text: ADVANCED PEASANT BU...






-------- Remove Unneeded Buff --------






Unit - Remove Advanced Building buff from AdvancedWorker






-------- Open Up Regular Build Menu --------






Game - Force (Owner of AdvancedWorker) to press the key B.





Else - Actions
Advanced Building Menu Off Order

Events


Unit - A unit Is issued an order targeting an object


Unit - A unit Is issued an order targeting a point

Conditions


(Issued order) Not equal to (Order(move))


(Issued order) Not equal to (Order(smart))


Or - Any (Conditions) are true



Conditions




(Unit-type of (Ordered unit)) Equal to Peasant (Advanced)

Actions


Set VariableSet AdvancedWorker = (Ordered unit)


-------- Peasant --------


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



If - Conditions




(Number of units in AdvancedPeasantGroup[(Player number of (Owner of AdvancedWorker))]) Greater than 0



Then - Actions




Unit Group - Pick every unit in AdvancedPeasantGroup[(Player number of (Owner of AdvancedWorker))] and do (Actions)





Loop - Actions






Game - Display to (All players) the text: ADVANCED PEASANT OR...






Set VariableSet AdvancedWorker = (Picked unit)






-------- Remove Advanced Peasant from Group --------






Unit Group - Remove AdvancedWorker from AdvancedPeasantGroup[(Player number of (Owner of AdvancedWorker))].






-------- Change Back to Normal Peasant --------






Unit - Add Peasant (Berserker Upgrade) to AdvancedWorker



Else - Actions
Advanced Building Menu Cancel on Select

Events


Player - Player 1 (Red) Selects a unit


Player - Player 2 (Blue) Selects a unit


Player - Player 3 (Teal) Selects a unit


Player - Player 4 (Purple) Selects a unit


Player - Player 5 (Yellow) Selects a unit


Player - Player 6 (Orange) Selects a unit


Player - Player 7 (Green) Selects a unit


Player - Player 8 (Pink) Selects a unit


Player - Player 9 (Gray) Selects a unit


Player - Player 10 (Light Blue) Selects a unit


Player - Player 11 (Dark Green) Selects a unit


Player - Player 12 (Brown) Selects a unit


Player - Player 13 (Maroon) Selects a unit


Player - Player 14 (Navy) Selects a unit


Player - Player 15 (Turquoise) Selects a unit


Player - Player 16 (Violet) Selects a unit


Player - Player 17 (Wheat) Selects a unit


Player - Player 18 (Peach) Selects a unit


Player - Player 19 (Mint) Selects a unit


Player - Player 20 (Lavender) Selects a unit


Player - Player 21 (Coal) Selects a unit


Player - Player 22 (Snow) Selects a unit


Player - Player 23 (Emerald) Selects a unit


Player - Player 24 (Peanut) Selects a unit

Conditions

Actions


-------- Peasant --------


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



If - Conditions




(Number of units in AdvancedPeasantGroup[(Player number of (Triggering player))]) Greater than 0



Then - Actions




Unit Group - Pick every unit in AdvancedPeasantGroup[(Player number of (Triggering player))] and do (Actions)





Loop - Actions






Game - Display to (All players) the text: ADVANCED PEASANT UN...






Set VariableSet AdvancedWorker = (Picked unit)






Unit Group - Remove AdvancedWorker from AdvancedPeasantGroup[(Player number of (Triggering player))].






Unit - Add Peasant (Berserker Upgrade) to AdvancedWorker



Else - Actions
Advanced Building Menu Cancel ESC

Events


Player - Player 1 (Red) skips a cinematic sequence


Player - Player 2 (Blue) skips a cinematic sequence


Player - Player 3 (Teal) skips a cinematic sequence


Player - Player 4 (Purple) skips a cinematic sequence


Player - Player 5 (Yellow) skips a cinematic sequence


Player - Player 6 (Orange) skips a cinematic sequence


Player - Player 7 (Green) skips a cinematic sequence


Player - Player 8 (Pink) skips a cinematic sequence


Player - Player 9 (Gray) skips a cinematic sequence


Player - Player 10 (Light Blue) skips a cinematic sequence


Player - Player 11 (Dark Green) skips a cinematic sequence


Player - Player 12 (Brown) skips a cinematic sequence


Player - Player 13 (Maroon) skips a cinematic sequence


Player - Player 14 (Navy) skips a cinematic sequence


Player - Player 15 (Turquoise) skips a cinematic sequence


Player - Player 16 (Violet) skips a cinematic sequence


Player - Player 17 (Wheat) skips a cinematic sequence


Player - Player 18 (Peach) skips a cinematic sequence


Player - Player 19 (Mint) skips a cinematic sequence


Player - Player 20 (Lavender) skips a cinematic sequence


Player - Player 21 (Coal) skips a cinematic sequence


Player - Player 22 (Snow) skips a cinematic sequence


Player - Player 23 (Emerald) skips a cinematic sequence


Player - Player 24 (Peanut) skips a cinematic sequence

Conditions

Actions


-------- Peasant --------


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



If - Conditions




(Number of units in AdvancedPeasantGroup[(Player number of (Triggering player))]) Greater than 0



Then - Actions




Unit Group - Pick every unit in AdvancedPeasantGroup[(Player number of (Triggering player))] and do (Actions)





Loop - Actions






Game - Display to (All players) the text: ADVANCED PEASANT ESC






Set VariableSet AdvancedWorker = (Picked unit)






Unit Group - Remove AdvancedWorker from AdvancedPeasantGroup[(Player number of (Triggering player))].






Unit - Add Peasant (Berserker Upgrade) to AdvancedWorker



Else - Actions
Foundry Hotkey Not Enough Oil

Events


Game - Button for build Foundry pressed.

Conditions

Actions


Set VariableSet CurrentPlayerNumber = (Player number of (Triggering player))


Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Less than 150




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 200




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 100



Then - Actions




Game - Force (Player(CurrentPlayerNumber)) to press Escape/Cancel




Set VariableSet OilWorkersGroup = (Units currently selected by (Player(CurrentPlayerNumber)))




Custom script: set bj_wantDestroyGroup = true




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





Loop - Actions






Unit - Order (Picked unit) to Stop.






Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")



Else - Actions
Building Start Take Oil Cancel on Insufficient Oil

Events


Unit - A unit Begins construction

Conditions

Actions


-------- Foundry --------


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



If - Conditions




(Unit-type of (Constructing structure)) Equal to Foundry



Then - Actions




Set VariableSet AdvancedConstruction = (Constructing structure)




Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Constructing structure)))




Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))




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





If - Conditions






OilBoardValue[CurrentPlayerNumber] Greater than or equal to 150





Then - Actions






Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 150)






Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 150)





Else - Actions






Unit - Kill AdvancedConstruction






Player - Add 200 to CurrentPlayer.Current gold






Player - Add 100 to CurrentPlayer.Current lumber






Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")



Else - Actions
Building Cancel Return Oil

Events


Unit - A unit Cancels construction

Conditions

Actions


-------- Foundry --------


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



If - Conditions




(Unit-type of (Cancelled structure)) Equal to Foundry



Then - Actions




Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Cancelled structure)))




Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 150)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 150)



Else - Actions
Unit Cancel on Insufficient Oil

Events


Unit - A unit Begins training a unit

Conditions


Or - Any (Conditions) are true



Conditions




(Trained unit-type) Equal to Human Frigate




(Trained unit-type) Equal to Human Battleship

Actions


Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Triggering unit)))


Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))


-------- Frigate --------


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Less than 200




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 250




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 100




(Issued order) Equal to (Order(humandestroyer))



Then - Actions




Game - Display to (All players) the text: FRIGATE TRAINING




Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")




-------- Cancel Doesn't Work Properly without the Dummy Wait --------




Wait 0.00 seconds




Custom script: call IssueImmediateOrderById(GetOrderedUnit(), 851976)



Else - Actions




Trigger - Run Unit Disabler Enabler Checker <gen> (checking conditions)


-------- Battleship --------


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Less than 400




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 500




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 200




(Issued order) Equal to (Order(humanbattleship))



Then - Actions




Game - Display to (All players) the text: BATTLESHIP TRAINING




Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")




-------- Cancel Doesn't Work Properly without the Dummy Wait --------




Wait 0.00 seconds




Custom script: call IssueImmediateOrderById(GetOrderedUnit(), 851976)



Else - Actions




Trigger - Run Unit Disabler Enabler Checker <gen> (checking conditions)
Unit Train Oil Take

Events


Unit - A unit Is issued an order with no target

Conditions


Or - Any (Conditions) are true



Conditions




(Issued order) Equal to (Order(humandestroyer))




(Issued order) Equal to (Order(humanbattleship))

Actions


Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Triggering unit)))


Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))


-------- Frigate --------


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Greater than or equal to 200




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 250




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 100




(Issued order) Equal to (Order(humandestroyer))



Then - Actions




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 200)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 200)



Else - Actions


-------- Battleship --------


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Greater than or equal to 400




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 500




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 200




(Issued order) Equal to (Order(humanbattleship))



Then - Actions




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 400)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 400)



Else - Actions
Unit Cancel Oil Back

Events


Unit - A unit Cancels training a unit

Conditions

Actions


Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Triggering unit)))


-------- Frigate --------


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



If - Conditions




(Trained unit-type) Equal to Human Frigate



Then - Actions




Game - Display to (All players) the text: FRIGATE CANCELLED C...




-------- Oil Back --------




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 200)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 200)



Else - Actions


-------- Frigate --------


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



If - Conditions




(Trained unit-type) Equal to Human Battleship



Then - Actions




Game - Display to (All players) the text: BATTLESHIP CANCELLE...




-------- Oil Back --------




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 400)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 400)



Else - Actions
Unit Disabler Enabler Checker

Events


Time - Every 0.03 seconds of game time

Conditions

Actions


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



Loop - Actions




Set VariableSet CurrentPlayerNumber = (Player number of (Picked player))




-------- Frigate --------




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





If - Conditions






OilBoardValue[CurrentPlayerNumber] Less than 200





Then - Actions






Player - Set the current research level of 200 Oil (Frigate) to 0 for (Player(CurrentPlayerNumber))





Else - Actions






Player - Set the current research level of 200 Oil (Frigate) to 1 for (Player(CurrentPlayerNumber))




-------- Battleship --------




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





If - Conditions






OilBoardValue[CurrentPlayerNumber] Less than 400





Then - Actions






Player - Set the current research level of 400 Oil (Battleship) to 0 for (Player(CurrentPlayerNumber))





Else - Actions






Player - Set the current research level of 400 Oil (Battleship) to 1 for (Player(CurrentPlayerNumber))
Upgrade Cancel on Insufficient Oil

Events


Unit - A unit Begins research

Conditions


Or - Any (Conditions) are true



Conditions




(Researched tech-type) Equal to Improved Cannons

Actions


Game - Display to (All players) the text: IMPROVED CANNONS ST...


Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Triggering unit)))


Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))


-------- Improved Cannons --------


-------- Level 1 --------


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



If - Conditions




OilBoardValue[CurrentPlayerNumber] Less than 100




((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 200




((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 100




(Current research level of Improved Cannons for CurrentPlayer) Equal to 0



Then - Actions




Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = True




Custom script: call IssueImmediateOrderById(GetTriggerUnit(), 851976)




Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")



Else - Actions




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





If - Conditions






OilBoardValue[CurrentPlayerNumber] Greater than or equal to 100






(Current research level of Improved Cannons for CurrentPlayer) Equal to 0





Then - Actions






Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 100)






Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 100)





Else - Actions




-------- Level2 --------




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





If - Conditions






OilBoardValue[CurrentPlayerNumber] Less than 200






((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 300






((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 200






(Current research level of Improved Cannons for CurrentPlayer) Equal to 1





Then - Actions






Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = True






Custom script: call IssueImmediateOrderById(GetTriggerUnit(), 851976)






Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")





Else - Actions






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







If - Conditions








OilBoardValue[CurrentPlayerNumber] Greater than or equal to 200








(Current research level of Improved Cannons for CurrentPlayer) Equal to 1







Then - Actions








Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 200)








Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 200)







Else - Actions






-------- Level 3 --------






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







If - Conditions








OilBoardValue[CurrentPlayerNumber] Less than 300








((Player(CurrentPlayerNumber)) Current gold) Greater than or equal to 400








((Player(CurrentPlayerNumber)) Current lumber) Greater than or equal to 300








(Current research level of Improved Cannons for CurrentPlayer) Equal to 2







Then - Actions








Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = True








Custom script: call IssueImmediateOrderById(GetTriggerUnit(), 851976)








Custom script: call DisplayTimedTextToPlayer(udg_CurrentPlayer, 1, 0, 5, "|cffffcc00Not enough oil.|r")







Else - Actions








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









If - Conditions










OilBoardValue[CurrentPlayerNumber] Greater than or equal to 300










(Current research level of Improved Cannons for CurrentPlayer) Equal to 2









Then - Actions










Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 300)










Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 300)









Else - Actions
Upgrade Cancel Resources Back

Events


Unit - A unit Cancels research

Conditions


Or - Any (Conditions) are true



Conditions




(Researched tech-type) Equal to Improved Cannons

Actions


Game - Display to (All players) the text: IMPROVED CANNONS CA...


Set VariableSet CurrentPlayerNumber = (Player number of (Owner of (Triggering unit)))


Set VariableSet CurrentPlayer = (Player(CurrentPlayerNumber))


-------- Improved Cannons --------


-------- Level 1 --------


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



If - Conditions




(Current research level of Improved Cannons for CurrentPlayer) Equal to 0



Then - Actions




Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 100)




Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 100)




-------- Oil Back on Low Oil Cancel --------




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





If - Conditions






ImprovedCannonsLowOil[CurrentPlayerNumber] Equal to True





Then - Actions






Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = False






Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 100)






Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 100)





Else - Actions



Else - Actions




-------- Level2 --------




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





If - Conditions






(Current research level of Improved Cannons for CurrentPlayer) Equal to 1





Then - Actions






Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 200)






Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 200)






-------- Oil Back on Low Oil Cancel --------






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







If - Conditions








ImprovedCannonsLowOil[CurrentPlayerNumber] Equal to True







Then - Actions








Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = False








Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 200)








Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 200)







Else - Actions





Else - Actions






-------- Level 3 --------






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







If - Conditions








(Current research level of Improved Cannons for CurrentPlayer) Equal to 2







Then - Actions








Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] + 300)








Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] + 300)








-------- Oil Back on Low Oil Cancel --------








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









If - Conditions










ImprovedCannonsLowOil[CurrentPlayerNumber] Equal to True









Then - Actions










Set VariableSet ImprovedCannonsLowOil[CurrentPlayerNumber] = False










Leaderboard - Change the value for CurrentPlayer in OilLeaderboard to (OilBoardValue[CurrentPlayerNumber] - 300)










Set VariableSet OilBoardValue[CurrentPlayerNumber] = (OilBoardValue[CurrentPlayerNumber] - 300)









Else - Actions







Else - Actions