HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need help from expert triggerer makers!

10-15-2003, 06:33 PM#1
Loren_3000
I have a very complex question and was wondering if the best trigger makers could help me please.

Here is a description of the situation, which is a good idea to read as it will help you understand what it is I am trying to do. Below that is my question.

==============================================
I have three regions, A for a location, and B and C for where buildings will be created.

There are two teams of 4 players. If a hero unit from team 1 enters region A, then 30 seconds will pass. Each second the trigger will make a tick-tock sound and check to see if the entering hero is still there. If he isn't then nothing happens, but if he is, then at the end of that 30 seconds two buildings are created at locations B and C for team 1.

Simultaneously there is another trigger where if a player from team 2 enters region A, then 30 seconds will pass. Each second the trigger will make a tick-tock sound and check to see if the entering hero is still there. If he isn't then nothing happens, but if he is, then at the end of that 30 seconds two buildings are created at locations B and C for team 2.

Simultaneously, there are two triggers which state that during the time when one hero is waiting on region A, if a hero from the opposite team enters the region during this time, than nothing will happen (no buildings will be created).
==============================================
So far so good. Now, here is my question:

I want the buildings to be re-created for their origional owner after 60 seconds, but ONLY when both are destroyed. I have areas that have one location and one area for a building, two for a building and four for a building.

Origionally it was fairly easy to code up just ONE building respawning. That was because I could just do this:

Events:
a unit dies
Conditions:
dying unit owned by player 9
unit type of dying unit equal to (building1)
Actions:
Wait 30 sec
(Check variable)
Create 1 (building1) at B
Create 1 (building1) at C

But obviously this can't work with 2 or more buildings, because then a player will destroy 1 building1 and 2 more will be created, resulting in 1 dying but 2 being created, which makes 3, then 1 dying and 2 being created, which makes 4, which is BAD. :(

My problem is I can't figure out how to keep track of if there is more than 1 building.

:bgrun:

Please reply with possible solutions. I will post the exact code if necessary.
10-15-2003, 06:38 PM#2
Ligature
Could you make the building couples unit groups?

Then you could use the condition "all units of unit group are dead" to check.
10-15-2003, 06:41 PM#3
Loren_3000
How do I do unit groups when the buildings are not there when the map starts?
10-15-2003, 06:51 PM#4
Ligature
Have a variable GroupX (or whatever) of type Unit Group.

Then when you create each building - the FIRST time - put an action right after it like this:

A - This is my action that is creating the building
A - Add (last created unit) to GroupX
10-15-2003, 06:55 PM#5
ObsidianTitan
Make good use o conditions,

a unit dies

dying unit equal to building 1
dying unit belongs to player 9
region b contains unit of type building 1 equal to false
region c contains unit of type building 1 equal to false
10-15-2003, 06:57 PM#6
Loren_3000
Cool, if that works I'll put you in my credits

I try to stay away from doing unit groups only because I don't know very well how to use them. Oftentimes the units that die aren't really seen as being dead. I think it had to do with corpses so I don't think it will be a problem in my map.

If there are any tutorials on how unit groups work plz post it may save me a headache =)
10-15-2003, 07:01 PM#7
Ligature
What ObsidianTitan says might also work - it's a little more intuitive....
10-15-2003, 07:20 PM#8
Loren_3000
Where is the condition
"region b contains unit of type building 1 equal to false" located?

Or do I have to do that in the actions area with an if/then/else?
10-15-2003, 07:32 PM#9
ObsidianTitan
It is under booleon, unit in region.
10-15-2003, 08:37 PM#10
Loren_3000
Hrm thx guys, I'm using unit groups as they seem to work fine

Just an hour or two more and I'll have all the regions done =)

Once I'm ready I'll ask people if they want to help test it :)