Auto-Spawn Rally Point

Status
Not open for further replies.
Level 7
Joined
May 30, 2018
Messages
290
I made this auto-spawn trigger:

  • Footman
    • Events
      • Time - SpawnTimer expires
    • Conditions
    • Actions
      • Set VariableSet SpawnUnitGroup = (Units of type Barracks)
      • Unit Group - Pick every unit in SpawnUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) Food used) Less than ((Owner of (Picked unit)) Food cap)
            • Then - Actions
              • Set VariableSet TempPoint = (Position of (Picked unit))
              • Unit - Create 1 Footman for (Owner of (Picked unit)) at TempPoint facing Default building facing degrees
              • Unit - Order (Last created unit) to Attack-Move To (Random point in Region 001 <gen>)
            • Else - Actions
              • Do nothing
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call DestroyGroup (udg_SpawnUnitGroup)
Would it be possible to set the point, where the unit attack-moves to, to being the rally point of the building it spawns from?

Second Problem:

  • uncontrollable
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Unit-type of (Target unit of issued order)) Not equal to Peasant
    • Actions
      • Trigger - Turn off (This trigger)
      • Unit - Order (Triggering unit) to Attack-Move To (Center of Region 001 <gen>)
      • Trigger - Turn on (This trigger)
I made this to stop the player from being able to give orders to the units...as follow up to the upper question: How do I make it, that the units keep moving to said rally point, despite being given orders by the player?


Thanks in advance!
 
Here's a Rally Point system using a Unit Indexer.

  • Spawn
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet SpawnGroup = (Units of type Barracks)
      • Unit Group - Pick every unit in SpawnGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet SpawnStructure = (Picked unit)
          • Set VariableSet UDex = (Custom value of SpawnStructure)
          • -------- --------
          • Set VariableSet TempPoints[1] = (Position of SpawnStructure)
          • Unit - Create 1 Footman for (Owner of SpawnStructure) at TempPoints[1] facing Default building facing degrees
          • Set VariableSet SpawnUnit = (Last created unit)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RallyPointHasBeenSet[UDex] Equal to True
            • Then - Actions
              • Set VariableSet TempPoints[2] = (Point(RallyX[UDex], RallyY[UDex]))
              • Trigger - Turn off Re Order Rally Point <gen>
              • Unit - Order SpawnUnit to Attack-Move To TempPoints[2]
              • Trigger - Turn on Re Order Rally Point <gen>
              • -------- --------
              • Set VariableSet UDex = (Custom value of SpawnUnit)
              • Set VariableSet RallyX[UDex] = (X of TempPoints[2])
              • Set VariableSet RallyY[UDex] = (Y of TempPoints[2])
            • Else - Actions
              • -------- If a Player hasn't set a Rally Point for their Structure then these ELSE Actions will run --------
              • Set VariableSet UDex = (Custom value of SpawnUnit)
              • Set VariableSet TempPoints[2] = (Position of SpawnUnit)
              • Set VariableSet RallyX[UDex] = (X of TempPoints[2])
              • Set VariableSet RallyY[UDex] = (Y of TempPoints[2])
          • -------- --------
          • -------- Clean Up Point Leaks --------
          • Custom script: call RemoveLocation (udg_TempPoints[1])
          • Custom script: call RemoveLocation (udg_TempPoints[2])
      • -------- --------
      • -------- Clean Up Group Leak --------
      • Custom script: call DestroyGroup (udg_SpawnGroup)
  • Set Rally Point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(setrally))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • Wait 0.00 seconds
      • Set VariableSet UDex = (Custom value of (Triggering unit))
      • Set VariableSet TempPoints[1] = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet RallyX[UDex] = (X of TempPoints[1])
      • Set VariableSet RallyY[UDex] = (Y of TempPoints[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RallyPointHasBeenSet[UDex] Equal to False
        • Then - Actions
          • -------- This informs the Spawn trigger that the Rally Point has been set so it should use it --------
          • Set VariableSet RallyPointHasBeenSet[UDex] = True
        • Else - Actions
      • -------- --------
      • -------- Clean Up Point Leaks --------
      • Custom script: call RemoveLocation (udg_TempPoints[1])
  • Re Order Rally Point
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
      • ((Triggering unit) is A peon-type unit) Equal to False
    • Actions
      • Trigger - Turn off (This trigger)
      • -------- --------
      • Set VariableSet UDex = (Custom value of (Triggering unit))
      • Set VariableSet TempPoints[1] = (Point(RallyX[UDex], RallyY[UDex]))
      • Unit - Order (Triggering unit) to Attack-Move To TempPoints[1]
      • -------- --------
      • -------- Clean Up Point Leaks --------
      • Custom script: call RemoveLocation (udg_TempPoints[1])
      • -------- --------
      • Trigger - Turn on (This trigger)

Edit: Uploaded a new version. Fixed a minor bug.
 

Attachments

Last edited:
Here's a Rally Point system using a Unit Indexer.

  • Spawn
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet SpawnGroup = (Units of type Barracks)
      • Unit Group - Pick every unit in SpawnGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet SpawnStructure = (Picked unit)
          • Set VariableSet UDex = (Custom value of SpawnStructure)
          • -------- --------
          • Set VariableSet TempPoints[1] = (Position of SpawnStructure)
          • Unit - Create 1 Footman for (Owner of SpawnStructure) at TempPoints[1] facing Default building facing degrees
          • Set VariableSet SpawnUnit = (Last created unit)
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RallyPointHasBeenSet[UDex] Equal to True
            • Then - Actions
              • Set VariableSet TempPoints[2] = (Point(RallyX[UDex], RallyY[UDex]))
              • Trigger - Turn off Re Order Rally Point <gen>
              • Unit - Order SpawnUnit to Attack-Move To TempPoints[2]
              • Trigger - Turn on Re Order Rally Point <gen>
              • -------- --------
              • Set VariableSet UDex = (Custom value of SpawnUnit)
              • Set VariableSet RallyX[UDex] = (X of TempPoints[2])
              • Set VariableSet RallyY[UDex] = (Y of TempPoints[2])
            • Else - Actions
              • -------- If a Player hasn't set a Rally Point for their Structure then these ELSE Actions will run --------
              • Set VariableSet UDex = (Custom value of SpawnUnit)
              • Set VariableSet TempPoints[2] = (Position of SpawnUnit)
              • Set VariableSet RallyX[UDex] = (X of TempPoints[2])
              • Set VariableSet RallyY[UDex] = (Y of TempPoints[2])
          • -------- --------
          • -------- Clean Up Point Leaks --------
          • Custom script: call RemoveLocation (udg_TempPoints[1])
          • Custom script: call RemoveLocation (udg_TempPoints[2])
      • -------- --------
      • -------- Clean Up Group Leak --------
      • Custom script: call DestroyGroup (udg_SpawnGroup)
  • Set Rally Point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(setrally))
          • (Issued order) Equal to (Order(smart))
    • Actions
      • Wait 0.00 seconds
      • Set VariableSet UDex = (Custom value of (Triggering unit))
      • Set VariableSet TempPoints[1] = (Rally-Point of (Triggering unit) as a point)
      • Set VariableSet RallyX[UDex] = (X of TempPoints[1])
      • Set VariableSet RallyY[UDex] = (Y of TempPoints[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RallyPointHasBeenSet[UDex] Equal to False
        • Then - Actions
          • -------- This informs the Spawn trigger that the Rally Point has been set so it should use it --------
          • Set VariableSet RallyPointHasBeenSet[UDex] = True
        • Else - Actions
      • -------- --------
      • -------- Clean Up Point Leaks --------
      • Custom script: call RemoveLocation (udg_TempPoints[1])
  • Re Order Rally Point
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order with no target
    • Conditions
      • ((Triggering unit) is A structure) Equal to False
      • ((Triggering unit) is A peon-type unit) Equal to False
    • Actions
      • Trigger - Turn off (This trigger)
      • -------- --------
      • Set VariableSet UDex = (Custom value of (Triggering unit))
      • Set VariableSet TempPoints[1] = (Point(RallyX[UDex], RallyY[UDex]))
      • Unit - Order (Triggering unit) to Attack-Move To TempPoints[1]
      • -------- --------
      • -------- Clean Up Point Leaks --------
      • Custom script: call RemoveLocation (udg_TempPoints[1])
      • -------- --------
      • Trigger - Turn on (This trigger)

Edit: Uploaded a new version. Fixed a minor bug.


Holy shit man! Thanks....I never expected such a detailed answer! Awesome. I'll try it out tomorrow :D Thanks man. Appreciated.
 
Status
Not open for further replies.
Back
Top