HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Making Computer Rebuild Killed Buildings

06-25-2010, 12:00 AM#1
Zero
There is two triggers associated with the AI regarding this:

Trigger:
AI - Set the general rebuild count for player (Triggering player) Building to (Difficulty(0 / 2 / 14 / 14))
AI - Set the rebuild count for player (Triggering player) Unit Type to (Difficulty(0 / 2 / 14 / 14))

If you pre-place a building on the map and un-check the "initially created" option in the AI tab you have an option here to pick the rebuild count for that specific building as well.

There is these options:

Never / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 10 / 11 / 12 / 13 / Always / Default (Never/Never)

What I don't understand is how to get the computer to actually REBUILD these structures if they die. I have all the pre-placed buildings set to always and even have the triggers above enabled. I've tried changing all of those numbers and nothing gets the computer to rebuild them. There is a check mark under which difficulty they should re-build it under and the only one is very easy as that's all there is. Does someone know how to make another difficultly option that you could set that too?

Now since I couldn't figure out to get this crap to work, I decided to make a trigger system instead.

Here it is:

Trigger:
Building Dies
Collapse Events
Unit - Supply Depot (Lowered) [31.00, 52.00] dies
Unit - Supply Depot (Lowered) [31.00, 50.00] dies
Local Variables
Conditions
Collapse Actions
UI - Display "Building Died!" for (All players) to Subtitle area
Collapse General - If (Conditions) then do (Actions) else do (Actions)
Collapse If
Collapse Or
Collapse Conditions
(Unit type of (Triggering unit)) == Supply Depot
(Unit type of (Triggering unit)) == Supply Depot (Lowered)
Collapse Then
Collapse General - If (Conditions) then do (Actions) else do (Actions)
Collapse If
(Number of Living units in (Any units in (Region((Position of (Triggering unit)), 35.0)) owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount)) >= 1
Collapse Then
Variable - Set Position[1] = (Region((Position of (Triggering unit)), 1.0))
Variable - Set Structure[1] = (Triggering unit)
Collapse Else
Unit - Order (Random Living unit from Builders[1]) to (SCV - Build Supply Depot targeting (Center of (Region((Position of (Triggering unit)), 1.0)))) (Replace Existing Orders)
Else

The basic of this trigger pretty much says if a building is killed, and there is no enemy units withing a radius of 35, then rebuild. If there is units within that radius, store the unit and it's position into a variable so it can be rebuilt when there is no units within the area.

What I need help with, besides the questions I asked above this trigger, is how do I do the "THEN" conditions to where it stores the unit and it's position into a variable, not having to do an array value for each individual structure on the map?

Also, I already tired making the event be if ANY unit dies and setting a condition in an if statement to be the actualy pre-placed building on the map, but the trigger doesn't fire. It seems that in order for the map to register that building, it has to be in the event heading.

How do I simplify this, because I really do NOT want to have to make a array value for each building.