• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Units in region problem

Status
Not open for further replies.
Level 5
Joined
Oct 12, 2004
Messages
109
I'm trying to make it so when a unit enters a region it stops, checks to see if a unit is in region A. If there is a unit in region A then it is ordered to move to region B. If no unit is in region A then it is ordered to move to region A. When i use this trigger the unit moves to region A no matter what. Even if there is a unit in region A already. Any help is appreciated!

  • Events
    • Unit - A unit enters BankEnter <gen>
  • Conditions
    • (Owner of (Entering unit)) Not equal to Player 11 (Dark Green)
    • ((Unit-type of (Triggering unit)) Equal to SUV) or ((Unit-type of (Triggering unit)) Equal to Motorcycle)
  • Actions
    • Set CityPlayer = (Player group((Owner of (Entering unit))))
    • Unit - Order (Entering unit) to Stop
    • Cinematic - Disable user control for (Player group((Owner of (Entering unit))))
    • Wait 1.50 game-time seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in (Units in Bankpark1 <gen> owned by Player 11 (Dark Green))) Equal to 1
      • Then - Actions
        • Unit - Order (Entering unit) to Move To (Center of BankPark2 <gen>)
        • Game - Display to CityPlayer for 10.00 seconds the text: You have to park in...
        • Cinematic - Enable user control for (Player group((Owner of (Entering unit))))
      • Else - Actions
        • Unit - Order (Entering unit) to Move To (Center of Bankpark1 <gen>)
        • Game - Display to CityPlayer for 10.00 seconds the text: You have to park in...
        • Cinematic - Enable user control for (Player group((Owner of (Entering unit))))
 
Level 9
Joined
Jul 26, 2005
Messages
553
i think the problem is that the game cant read how many units are there by this script...
so if there are more then 2 it will send to area A

and there is probably some units in there that you didn't notice.
 
Level 15
Joined
Feb 9, 2006
Messages
1,598
If - Conditions (Number of units in (Units in Bankpark1 <gen> owned by Player 11 (Dark Green))) Equal to 1

it should be

If - Conditions (Number of units in (Units in Bankpark1 <gen> owned by Player 11 (Dark Green))) Equal to or greater than 1
 
Level 2
Joined
Feb 5, 2007
Messages
29
It'll check the units inside the region. In this case, the unit entering the region is considered a unit.

For Operator's solution, change "1" into "2".

Not sure if that'll work, but it should ...
 
Level 5
Joined
Oct 12, 2004
Messages
109
Thanks for the input so fast. I tried everything all of you guys said and the unit still moved to the region when there was already a unit in there. I know there are no extra units in the region because its about an inch big. :) So, im gunna keep working on it but im stumped for now..
 
Status
Not open for further replies.
Top