brncao
  • brncao
  • 71% (Friendly)
  • Captain Topic Starter
12 years ago
Anyone know how to tell the AI to re-garrison a structure after the previous team is destroyed? They garrison once and stop. You can import SkirmishScripts.scb and look at several bunkers for examples.
Sponsor
acidbrain
12 years ago
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
Panem et kirkinses
brncao
  • brncao
  • 71% (Friendly)
  • Captain Topic Starter
12 years ago
So they'll keep sending in more if the previous team is destroyed? And you imported SkirmishScripts.scb and modified that, and not one you started from scratch? I'll give your scripts a try *crosses fingers*
acidbrain
12 years ago

So they'll keep sending in more if the previous team is destroyed? And you imported SkirmishScripts.scb and modified that, and not one you started from scratch? I'll give your scripts a try *crosses fingers*

Originally Posted by: brncao 



Nope, the ai checks if the building to be garrisoned exists and if the health of the building is greater than 70%, if so and the defcon condtion is greater than or equal to 3(no enemy in inner/outer perimeter) than a team is build.
If the team has garrisoned the building and the health of the building is less than 40% the team exits the building and starts guarding, if the health is greater than or equal to 70% the team enters the building again.
A faction building will be auto repaired, a civilian building has to be repaired by script.
If the team is killed the flags reset and the buildcondition is checked again.
It's just an example that i gave, if you want it in your skirmish scripts adjust and test it yourself, just showing you the way, not chewing it out, there are enough conditioned copycat monkeys in this world.

Good luck
Panem et kirkinses
brncao
  • brncao
  • 71% (Friendly)
  • Captain Topic Starter
12 years ago
No doubt your script might work if you start from scratch. Unfortunately the problem still remains in skirmish. They garrison once and never garrison again after the team is destroyed. I gave the team a very high priority over everything else; didn't work.

I just checked China's Internet Center logic. Everytime I kill the hackers or destroy the Internet Center , which is then rebuilt, the AI does rebuild the team of hackers and garrison them. Works everytime! Yet this is the same logic I tried to apply to other garrisonable structures and it only works once despite giving it the highest priority.

This is what I'm going to do. Create an entirely new Object (i.e. GLAInfantryRebel_Garrison) that will be dedicated to garrisoning only. I'll see if it works or not.

Edit: YES!!!!! It Worked!!! Anyone who wants the AI to garrison structures in skirmish, you'll need to create a copy of that object (i.e. GLAInfantryRebel). I've always wanted to try out some anti-garrison weapons in Shockwave.
brncao
  • brncao
  • 71% (Friendly)
  • Captain Topic Starter
12 years ago
Nevermind. They only garrison twice and stop...