Jump to content


Advanced Multi-team AI Attack Cycle Scripting


3 replies to this topic

#1 Genmotty

    Newbie

  • Member
  • 2 posts

Posted 27 August 2007 - 19:28

Hiya

I'm new to the forums. I have a detailed problem with a single player mission AI that is 'stuck'.

Now in ZeroHour not all the Generals where represented. Hence I dicided to embarke on a mission to create the General Challeges that EA missed out. For this I am trying to build a powerful AI that doesn't cheat on the player. However I hit a snag...

I got the Generals Powers working and all the basic setup scripts and I've even got the map designed. However I can't get the scripting right so that the computer attacks with a team.

What is most annoiying however is using an exactly the same logical cycle another team works.

The logic I am currently using which works for an Infantry Attack group is as follows;

***IF***
timer "Gen_TaoStartPlayTimer" has expired
***THEN***
set flag named "Gen_TaoBuildInfantryWave?" to TRUE

+++ +++ +++ +++

***IF***
flag named "Gen_TaoBuildInfantryWave?" IS TRUE
***THEN***
Start building team "Dynamic_InfantryWave"
set timer "Gen_TaoInfantryWavePrep4Attack" to expire in 10.00 seconds

+++ +++ +++ +++

***IF***
timer "Gen_TaoInfantryWavePrep4Attack" has expired
***THEN***
Recruit an instance of team "Dynamic_InfantryWave", maximum recruiting distance: "1000.00"
run subroutine "InfantryWaveMove"

+++ +++ +++ +++
(Subroutine)

***IF***
True
***THEN***
Have Team "Dynamic_InfantryWave" follow Waypoint Path "Gen_TaoMainAttackPath", as a teamFALSE

Now this works, however when I applied it again ONLY chaning the "Dynamic_" team perameter to a diffrent team it didn't work. The tanks pooled in the base, however they did counter attack if you hit them with airattacks (Due to other team scripting).

The trouble is they don't seem to do anything and no matter what I change the action to; movement, guard, auto kill on recruiting etc. they don't do it.

Now can anybody point out any flaw in my logic or scripting commands.

Also I understand that production conditions can be setup under the teams menue however whenever I try to use that system I have never been able to figure it out and can't make an AI produce units using it, thus I have been using manual logic in my maps.

Thankyou in advance,
Genmotty

#2 nip

    Grunze-Catz

  • Member
  • 608 posts

Posted 28 August 2007 - 03:16

A possible flaw could be the subroutine with the previous command run subroutine "InfantryWaveMove". Did you uncheck script flag Deactivate upon success? A subroutine is always active.

What's your goal of all the scripting? Do you wanna the AI build teams and move the teams along a waypoint path or to a location to attack/guard/hunt/whatever? Then it's much easier to use the Production Condition of Identity Tab in Edit Team window. Just add a subroutine with any condition you want (IF True; Player enters area; Timer expired; Flag is true/false etc.). When you add some actions to the condition subroutine, check Execute associated actions. By default the condition's actions are ignored. For a teams behavior use subroutines in the Bahavior Tab. On Create, On Enemy Sighted etc. are conditions, so leave the subroutine condition IF True and simply add some actions to the subroutine.

Tip: Make sure the AI got all upgrades etc. to be able to build the units.
Tip: Using the recruit action on teams could weaken other AI teams. Uncheck Team members are AI recruitable on important teams to avoid this.
Tip: Keep the scripting as easy as possible even when scripting difficult actions. The game engine is limited, too many timers running or too many trigger areas being checked will slow down the game.

An example of AI building teams and AI attacking.

Edited by nipthecat, 28 August 2007 - 03:52.


#3 Genmotty

    Newbie

  • Member
  • 2 posts

Posted 28 August 2007 - 13:17

Thankyou for the help but it didn't work.

I got the "Dynamic_TankStandard" team to activate by cycling the recruit script on a;

***IF***
"Team" has been created
***THEN***
Recruit an instance of "Team"

Rather than calling a subroutine script to do the recruiting.

I'm not sure why that team decided to 'lock up' as this logical cycle has never failed me before, I don't think it liked the team or some of the team scripting while 'in the field' so to speak.

+++ +++ +++ +++

The point of the scripting is to get the team to move out of the base in the first instance. Get the team 'in the field' so to speak. After then I have a number of IF senarios that controls how the team acts. For instance if the team comes under air attack from "OBJECT:Helicopters" (Object list function) then it will find the nearest AA base defense site. All this scripting works fine.

Another example is if the team comes under attack it will stop whatever it was doing and react to the threat. Before contining to move to the players base unless another senario is called.

The problem I had was that for some reason the Team "Dynamic_TankStandard" would not recruit and do my first step taking it out of the base for whatever reason. This has been fixed.

+++ +++ +++ +++

Identity Tab
I have never been able to get this to work. Even using the map you posted and copying the team and then changing the unit it built (To red guard) and giving the China player a barracks didn't work*. As I have always found the team if indeed it builds, just pools infront of the production building and won't even respond to other 'in the field' scripting. Hence I have forgon trying to use that system and built my own logical cycle (Above) to produce and activate attack teams.
*(See attachment)

If there is an in depth tutorail of how to create teams using the Identity tab I would love to know so I can finally understand that system and get it to work. As it stands I have been using the team option functions, but not the Production or Behavoir conditions. Instead I have been hard coding my own. Under Edit--->Scripts

As for the Tips they have been noted.

Thankyou for your help,
Genmotty

Attached File(s)



#4 nip

    Grunze-Catz

  • Member
  • 608 posts

Posted 28 August 2007 - 14:03

Try the official WB manual.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users