Summon Only if in region

Daicos

New Member
Reaction score
25
so i want it so that in a particular region so and so units are summoned every X seconds... but i want it so that it only happens when a player is in the region so that the spawns dont get overcrowed and are to many of them
thanks in advance +rep
 
A

Aida

Guest
For your second question, you can just add a check to see how many units are in the region and if there are a certain amount stop spawning.
 

tobbygnome

New Member
Reaction score
2
Well here is a trigger that i compiled.It's methods are simple.
When a unit enters REGIONX. It sets up a for do loop from 1 to your max food cap, if its 0 then problems may occur. So from 1 to max food cap it creates 1 UNITX for the person who entered the region at center of REGIONSPAWNX then it waits 2 seconds and repeats that UNTIL your food cap is reached.

Region Checker
Events
Unit - A unit enters REGIONX <gen>
Conditions
Actions
For each (Integer A) from 1 to ((Owner of (Triggering unit)) Food cap), do (Actions)
Loop - Actions
Unit - Create 1 UNITX for (Owner of (Triggering unit)) at (Center of REGIONSPAWNX <gen>) facing Default building facing degrees
Wait 2.00 seconds

If you just want to make it stop at a certain number change:
For each (Integer A) from 1 to ((Owner of (Triggering unit)) Food cap)
To:
For each (Integer A) from 1 to NUMBERX)
Then it will stop respawning at your desired number.
If your player leaves the region and re-enters it it will start looping the spawning UPTO that number AGAIN.
Hope i helped you understand a few things.
 
R

Rhaged

Guest
Could just add the last created uinit into a unit group, Then use a integer compasion, to count how many units are in the group, And if gets more then the ammount it does nothing

Just to give you a bit of a idea

Code:
Untitled Trigger 002
    Events
        Time - Every 2.00 seconds of game time
    Conditions
        (Testregion contains (Random unit from (Units owned by Player 1 (Red)))) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in UnitGroup1) Less than 10
            Then - Actions
                Unit - Create 1 Footman for Neutral Passive at (Center of Testregion) facing Default building facing degrees
                Unit Group - Add (Last created unit) to UnitGroup1
            Else - Actions
                Do nothing
 
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