Trigger to train units that protects area

Progesterone

New Member
Reaction score
0
Hi all, I need to create a trigger(for the computer-controlled player) that goes like this : when the human-controlled player has at least 1 unit in a particular region (eg. region 1), the computer will train a unit, eg. raider, from a particular barracks every x seconds, then send that unit to region 1.
Once the trigger is activated, new units will be trained even when the human-controlled player no longer has any units in region 1. The training will stop if there are more than 8 raiders(belonging to the computer-controlled player) in region 1, and it will start again once there are fewer than 8 raiders in region 1, regardless of whether the human-controlled player has any units in region 1.
May i know how to create such a trigger ? Thanks !!
 

denmax

You can change this now in User CP.
Reaction score
155
Code:
Events
    Unit - A unit enters <Region>
Conditions
    (Owner of (Entering unit)) Equal to (Player)
    (Player controller) Equal to User
Actions
    If (Player controller) Equal to Computer then do Trigger - Run (Train Raiders) (checking conditions) Else do Do Nothing
    Trigger - Turn off (this Trigger)

Train Raiders (Initially On)
Code:
Events
Conditions
    (Units of type Raider owned by (Player) Less than 8
Actions
    Unit - Order (Trainer) to train/upgrade Raider
 

Progesterone

New Member
Reaction score
0
Thanks for the replies ! But the first trigger (that activates the "raider training trigger") actually have "player owns x units in an area". Does this mean that after having activated the first trigger, WHEN THE PLAYER SUBSEQUENTLY removed all its units in that area, that trigger would shut off ? If that's the case then trigger 2 would be permanently on...I need trigger one to be on permanently AFTER the initial activation...
 

Progesterone

New Member
Reaction score
0
Code:
Events
    Unit - A unit enters <Region>
Conditions
    (Owner of (Entering unit)) Equal to (Player)
    (Player controller) Equal to User
Actions
    If (Player controller) Equal to Computer then do Trigger - Run (Train Raiders) (checking conditions) Else do Do Nothing
    Trigger - Turn off (this Trigger)

Train Raiders (Initially On)
Code:
Events
Conditions
    (Units of type Raider owned by (Player) Less than 8
Actions
    Unit - Order (Trainer) to train/upgrade Raider

My second question would be that, I need to train one raider every x seconds (eg. every 10 seconds). Do I have to put the "wait 10 seconds" ACTION in the second trigger ? What about "loop" in either trigger ? Is that necessary ?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top