I used the following method in a few maps.
I used the flags to create a pulse for the generic scripts otherwise they will not work properly.
Ok here we go, i will take a bunker as an example.
First make a init script in which you set the flags:
[ns A D][E N H]Garrisons_Init
***IF***
True
***THEN***
Set Flag named 'Bunker-1_Garrisoned' to FALSE
Set Flag named 'Bunker-1_Go Garrison' to FALSE
BEHAVIOR_Team build conditions:
[S A nd][E N H]Bunker-1_Team_Build
*** IF ***
Unit 'Bunker-1' Health IS Greater Than or Equal To 70 percent.
*AND* Counter 'Defcon' IS Greater Than or Equal To 3
*** THEN ***
Team '<This Team>' begins guarding.
BEHAVIOR_Team on create:
[S A nd][E N H]Bunker-1_Team_On Create
*** IF ***
True.
*** THEN ***
Set Flag named 'Bunker-1_Go Garrison' to TRUE
BEHAVIOR_Team KIA:
[S A nd][E N H]Bunker-1_Team_KIA
*** IF ***
True.
*** THEN ***
Disable Script 'Bunker-1_Garrisoned'.
Set Flag named 'Bunker-1_Garrisoned' to FALSE
Set Flag named 'Bunker-1_Go Garrison' to FALSE
GENERIC_Team enter bunker:
[S A nd][E N H]Bunker-1_Team_Enter
*** IF ***
Flag named 'Bunker-1_Go Garrison' IS TRUE
*AND* Unit 'Bunker-1' Health IS Greater Than or Equal To 70 percent.
*AND* Team '<This Team>' has one or more units.
*** THEN ***
Team '<This Team>' enters into building named Unit 'Bunker-1'
Enable Script 'Bunker-1_Garrisoned'.
Set Flag named 'Bunker-1_Go Garrison' to FALSE
GENERIC_Team exit bunker:
[S A nd][E N H]Bunker-1_Team_Exit
*** IF ***
Flag named 'Bunker-1_Garrisoned' IS TRUE
*AND* Unit 'Bunker-1' Health IS Less Than 40 percent.
*AND* Team '<This Team>' has one or more units.
*** THEN ***
Team '<This Team>' exits all buildings.
Team '<This Team>' begins guarding.
Set Flag named 'Bunker-1_Go Garrison' to TRUE
Set Flag named 'Bunker-1_Garrisoned' to FALSE
GENERIC_Team guard:
[S A nd][E N H]Bunker-1_Team_Guard
*** IF ***
Flag named 'Bunker-1_Go Garrison' IS FALSE
*AND* Unit 'Bunker-1' has been destroyed.
*AND* Team '<This Team>' has one or more units.
*** THEN ***
Team '<This Team>' begins guarding.
Set Flag named 'Bunker-1_Go Garrison' to TRUE
Bunker-1 garrisoned:
[ns na nd][E N H]Bunker-1_Garrisoned
*** IF ***
Unit 'Bunker-1' is empty.
*** THEN ***
Null operation. (Does nothing.)
*** ELSE ***
Set Flag named 'Bunker-1_Garrisoned' to TRUE
Disable Script 'Bunker-1_Garrisoned'.
It works just fine but maybe it can be scripted better, im no scripting master.
Just try it.
Use this method only for bunkers, towers and such in the Inner and Outer Perimeter from the AI, the Bunker-1_Garrisoned script is a bit of a risc, you can add some conditions to prevent that, this is just an example.
Greetz
Edited by user
12 years ago |
Reason: Not specified