HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Victory in Footwars

02-18-2004, 05:39 AM#1
Telamon
I'm making a footwars map from scratch. This is my first attempt at one, and I'm running into difficulty detecting when the game is over.

The basic idea is the it is a 12 player map (teams of 3) and each player has a barracks. When their barracks is destroyed, they are out of the game. The thing I'm having trouble with, is how can I tell when there is only one team left?

I've tried a couple of approaches, but they turn into a complicated mass of triggers that is going to be hell to debug. So I was wondering if there was a simple approach?
02-18-2004, 05:44 AM#2
RaeVanMorlock
Without getting into the exact GUI triggers of it all, I'll say this.

You'll want to make an integer variable used to count the number of enemies left. Then use a Player Group to loop through the enemies of whatever player has a chance at winning.

Some pseudo-code to help:

Events:
- A unit dies
Conditions:
- Unit-type of Dying unit Equal to Barracks
Actions:
- Loop through each player in the game
- - set enemy_count = 0
- - Loop through each enemy of picked player
- - - set enemy_count = enemy_count + 1
- - End Loop
- - If enemy_count = 0 then
- - - End game in Victory for Picked Player
- - End If
- End Loop