» Current News
» Archive News
» View All Tips
27.RVMECH Says: The supply docks need to be within 20 tiles of the command center in order for the AI to start collecting.
» Contact Us
» Atomic Wiener Dog
» CNC Reneclips
» Project Perfect Mod
» The Finest Hour
» Warhammer40k: DoW SDI
» YR Argentina
Dynamic attack paths
Title: Dynamic attack paths
Difficulty: Basic AI Scripter
Author(s): SDI Team
Game Type: Both Regular Generals and Zero Hour
Usually, in both Zero Hour and regular Generals, the AI will build a number of teams which will attack from one of the three
attack paths in the map: Center, Flank or Backdoor. Now, the AI's enemy may have no defenses on its Flank, but lots of them on
its Front. Thus, if a team is sent to the Center path, it'll be destroyed by the heavy defenses. There is no script condition to
check where the enemy player has his defenses. There is a, however, a workaround.
First, you need a unit that can be built cheaply, quickly and in an early stage of a game. We'll use the Ranger for this example.
You have to make three new teams, each with one Ranger (or the quick and cheap equivalent). Name each of the teams accordingly with the three
paths, like USA Check Center, USA Check Flank and USA Check Backdoor. Set each of the teams to execute the following script On Create:
Script name: USA MoveToCenter
Have Team '' move to the start of enemy path 'Center'.
..and make the scripts for the other paths as well, setting the appropriate teams to execute the correct scripts On Create.
Now make three more scripts, set the according teams to execute the according scripts in the Generic tab. The scripts should look like this:
Script name: USA Check Center
Team '' has been attacked by a(n) 'Base Defenses'
*AND* [???]Team '' has reached the end of Waypoint Path 'Center'
Set Flag named 'USA EnemyCenterHasDefenses' to TRUE
..and make the scripts and the flags for the other paths as well.
You should now have three teams that each move to the start of each of the three paths, and check if they are attacked by base defences
with a script in the Generic tab.
This will now effectively give you data about the enemy's base defence positions. What you are actually doing is sending a probe
to see if the enemy has defences in the areas around one of the attack paths.
Maybe you'll sacrifice some units for the recon, but that's
why you shouldn't be sending Overlords to see if the enemy has defenses ;)
Now you can make three scripts that use the collected data about the enemy's base and attack accordingly, with a default attack path if every side of the enemy base has
defenses. Give your usual attack teams this script instead of the usual ones:
Script name: USA Attack Enemy Sequential
Flag named 'USA EnemyCenterHasDefenses' IS FALSE
Team '' executes Script 'USA Attack Enemy Base Center' sequentially
Run Subroutine 'USA Attack Enemy Check Flank'
...and these are the other two scripts to use the collected data:
Script name: USA Attack Enemy Check Flank
Flag named 'USA EnemyFlankHasDefenses' IS FALSE
Team '' executes Script 'USA Attack Enemy Base Flank' sequentially
Run Subroutine 'USA Attack Enemy Check Back'
Script name: USA Attack Enemy Check Back
Flag named 'USA EnemyBackHasDefenses' IS FALSE
Team '' executes Script 'USA Attack Enemy Base Back' sequentially
Run Subroutine 'USA Attack Enemy Base Center'
You can, of course, set the USA Attack Enemy Check Back ***ELSE*** action to execute a different attack script, as this script
will be executed if all sides of the enemy base has at least one defensive structure.
You are done! Note that you should tell your AI to build the "probe" teams more than once because there is a chance that they will be killed
by something else than a base defense. You should also put it into the Passive state as it's a probe team and not an attack team.