SDI title
 

 
  News:
  Current News
  Archive News

  Features:
  Tutorials
  Downloads

  Community:
  Forum




  Random Tip:
  View All Tips



  Site:
  Staff
  Contact Us

  Affiliates:
  Atomic Wiener Dog
  CNC Reneclips
  GenDev
  Project Perfect Mod
  The Finest Hour
  Warhammer40k: DoW SDI
  YR Argentina
 

Adding new superweapons

Title: Adding new superweapons
Difficulty: Novice AI Scripter
Author(s): SDI Team
Game Type: Both Regular Generals and Zero Hour


Super weapons (or special powers) are easily done, yet often avoided due to unreal complexity. It's basically, as always very simple:

Let's assume we want to add a superweapon to the USA AI, the Raptor Strike. First we study the original scripts,
the usual routine, open World Builder, go to Edit>Player List and click "Add Skirmish Players".

Now click "OK" and go to Edit>Scripts and find the "Import Scripts" button. If you have Zero Hour make sure the "Auto Verify" box is unchecked otherwise it will verify every single script...

Select the SkirmishScripts.scb file which should be in your "Command and Conquer Generals\Data\Scripts\" folder or for ZH users in the "Command and Conquer Generals Zero Hour\Data\Scripts" folder. Now click "OK" and open the "SkirmishAmerica" folder.

Every special power or superweapon is activated by the scripts in this manner:

-[special power] AI
-[special power] Fire

The "AI" script for this checks if the special power is ready, if it is it deactivates itself, and activates the "Fire" script. The Fire script then in turn checks if the special power is ready as well and fires it at the enemy's highest cost area. Note that it is possible to change this with Team commandbutton commands - just select the generic team for the faction for SkirmishAmerica it would be teamSkirmishAmerica, which has all commandbuttons and everything..

So now, copy two existing scripts, one ending with "AI" the other with "Fire". Rename them to your special power, in our case it is the Raptor Strike. Once both scripts are renamed, set the IF conditions of both to check for the correct special power and set the script ending with "AI" to disable itself on its "Actions if true" tab, and enable the "Fire" script. The same should be done the other way round: the "Fire" script should disable itself and activate the "AI" script again.

Tip for Zero Hour Users:
For greater efficiency you can do what EA did: set another IF condition in the "AI" script to make it check if the flag '_LAUNCH_ATTACK_' is true. The special power will then fire when the AI is getting ready to ambush it with ground units.

This is basically it, the AI will check if the special power is ready, then activate another script and deactivate itself, then fire it on the enemy's highest cost area. Now export your scripts while overwriting the original.

But what about purchasing? Special powers like the A10 Thunderbolt must be purchased with a generals point.

This is done in the AIData.ini. Extract it from the INI.big or INIZH.big (it is in the "Default" subfolder) and put it in the Data\INI\ folder, or Data\INI\Default doesn't really matter too much. Open it up and find your faction here, for this scenario it is SideInfo America. Below that you'll see SkillSets - basically a set of generals abilities to purchase. There can be more than one, the AI will randomize between them.

Now either make a new SkillSet or add Science = SCIENCE_RaptorStrike there- the AI will purchase it when it has the points.

That's it, be sure to have the special power reload time set high enough in SpecialPower.ini so that you don't get killed when you are testing it...


Tip: The Script Debugger will show you if a faction purchases a science from a skillset,
be sure to use it if you are unsure if the science is even purchased...









SDI
SDI is part of the Revora Creative Network.
Orange Block design created by Detail 2004 Revora Creative Network.
Content Revora Creative Network 2004 - 2008