[Trigger] Order-issued units returning to their origin point.

Level 3
Joined
May 16, 2024
Messages
13
Hello everyone!
I tried to make some little triggers which cause certain units (which are controlled by a computer player) to spawn at certain points on the map whilist adding those unit to a certain unit group.
After that, they are ordered (via trigger) to attack-move to other regions. That's where the problem begins...
They go to their specified regions, but right after that, the units just come back to their spawn point.

Here are the triggers:


  • EmitRandomEvent
    • Events
    • Conditions
    • Actions
      • Set RandomEventInteger = (Random integer number between 1 and 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomEventInteger Equal to 1
        • Then - Actions
          • Trigger - Turn on CaravanSpawn <gen>
          • Trigger - Run CaravanSpawn <gen> (checking conditions)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomEventInteger Equal to 2
        • Then - Actions
        • Else - Actions


  • CaravanSpawn
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Militia for Player 12 (Brown) at (Center of CaravanSpawn1 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Unit - Create 1 Pack Horse for Player 12 (Brown) at (Center of CaravanSpawn2 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Unit - Create 1 Pack Horse for Player 12 (Brown) at (Center of CaravanSpawn3 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Unit - Create 1 Militia Archer for Player 12 (Brown) at (Center of CaravanSpawn4 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Unit - Create 1 Militia Archer for Player 12 (Brown) at (Center of CaravanSpawn5 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Unit - Create 1 Militia for Player 12 (Brown) at (Center of CaravanSpawn6 <gen>) facing Default building facing degrees
      • Unit Group - Add (Last created unit) to CaravanGroup
      • Game - Display to (All players) the text: A Caravan from (ins...
      • Wait 10.00 seconds
      • Trigger - Run CaravanOrder1 <gen> (checking conditions)
      • Trigger - Turn off (This trigger)


  • CaravanGroupCleaning
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in CaravanGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from CaravanGroup


  • CaravanGroupCleaning
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in CaravanGroup) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from CaravanGroup


  • CaravanCheck2
    • Events
      • Unit - A unit enters CaravanCheckpoint1 <gen>
    • Conditions
      • ((Triggering unit) is in CaravanGroup) Equal to True
    • Actions
      • Trigger - Run CaravanOrder2 <gen> (checking conditions)
      • Trigger - Turn off (This trigger)


  • CaravanOrder2
    • Events
    • Conditions
    • Actions
      • Wait 5.00 seconds
      • Unit Group - Order CaravanGroup to Attack-Move To (Center of CaravanCheckpoint2 <gen>)


Thanks in advance!
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
This action usually solves the problem

  • AI - Ignore (Triggering unit)'s guard position
Even though it's mostly used for computer player with AI scripts attached, it should get the job done. Any time you preplace a computer unit, it creates a guard post that they are assigned to and are only willing to go that far before the computer says that's enough get back to your post, unless you tell them to ignore this unit. It will also prevent the computer from pulling this unit and send them in an attack wave, or replace them when killed, but again, that's only for AI scripts

You also have the bulk option if you want to affect the entire player

  • AI - Ignore the guard positions of all Player 1 (Red) units
 
Level 3
Joined
May 16, 2024
Messages
13
This action usually solves the problem

  • AI - Ignore (Triggering unit)'s guard position
Even though it's mostly used for computer player with AI scripts attached, it should get the job done. Any time you preplace a computer unit, it creates a guard post that they are assigned to and are only willing to go that far before the computer says that's enough get back to your post, unless you tell them to ignore this unit. It will also prevent the computer from pulling this unit and send them in an attack wave, or replace them when killed, but again, that's only for AI scripts

You also have the bulk option if you want to affect the entire player

  • AI - Ignore the guard positions of all Player 1 (Red) units
It worked! Guess I still have much to learn about various GUI functions :D
Thanks a lot! Have a great day!
 
Top