HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Player(X) has any units in region(Y)?

07-22-2002, 07:00 AM#1
Guest
Hopefully a simple question. (I apologise if this has already been covered, but I looked and couldn't find anything.)

I periodically want to check to see if a region contains *any* units owned by a player. Using a periodic event timer, how can I check for this?

I know this has to be possible becuase it seems like the core of most King-of-the-hill and capture-and-control based games.

Basically I want:

Set MyBoolVar = Player(X) has any units in region(Y)
07-22-2002, 07:07 AM#2
Guest
OK, this hack seems to work.
But *surely* there is something more elegant?

Set MyUnitVar = (Random unit from (Units in SomeRegion <gen> owned by Player 1 (Red)))

Set MyBoolVar = (SomeRegion <gen> contains MyUnitVar)
07-22-2002, 09:29 AM#3
Guest
This is an Integer Comparison

Then choose Count Units in Unit Group. For the "in" part choose Units in Region owned by Player.

You should get for a full comparison:

Number of units in (Units in [Region] owned by [Player]) greater than 0
07-23-2002, 05:53 PM#4
Guest
Thanks. I would never have thought to look there. I was trolling through all the unit-based struff.

This is a very useful forum I must say!