| |  | | | | | | | | | |  | | | | | | | | |
| | | | | | :Navigation:
C-GEN Home
C-GEN Forums
:Red Alert 2 & YR:
Mods & Projects
CannisRules
Federal Knight
MooMan's Corner
The Project
Purple Alert
YR 1.002 UMP
Resources
RedUtils
Terra Scope
PixelOps
YR Terrain Expansion
Assault Mappacks
YR Playlist Modifier
Editing Tutorials
MapMakers
Cannis
CaptnMel
Concolor1
Fraser101
Mir4dor
:Warcraft III:
Mods & Projects
Federal Knight
:Generals & ZH:
Mods & Projects
Tiberian Generals
Resources
Terra Scope
MapMakers
Cannis



| |
| | | | | |
RA2/YR: AI Triggers: Making an AI Trigger Viewer
by CannisRabidus. Published: 3/24/03. Last update: 3/24/03.
Introduction
Modifications to Red Alert2 and Yuri's Revenge can add new computer attacks for the skirmish AI, or AI Triggers. Of
course everyone knows this. Such AI Triggers are known as global triggers, in that they are in effect for all maps unless
specifically disabled. New AI Triggers can be added to individual maps too, so this tutorial is aimed at the mapmaker as
well as the modmaker. In any event, adding new AI Triggers can be really cool and can make the skirmish AI do things that
the player would not consider typical, within the limits of the AI coding of the game of course.
How to make such new AI Triggers is beyond the scope of this tutorial. However, making new AI Triggers is not really that
hard, especially if you can look at what the Red Alert2 and Yuri's Revenge programmers used for the skirmish AI in the
standard game. All of the AI Triggers can be found in the file AI.INI (for Red Alert2) and in AIMD.INI (for
Yuri's Revenge). These files are part of the game installed on your hard disk, and you can extract them using
XCC Mixer. For Red Alert2, use the mixer to open
RA2.MIX, then LOCAL.MIX within that, then you will find AI.INI. Right-click and choose
"extract". For Yuri's Revenge, the operation is identical, except you open RA2MD.MIX, and within that
find LOCALMD.MIX, then extract AIMD.INI. You should save these AI files to a different folder than where you
have installed RA2 and YR, else the game will read them rather than the versions in the MIX files.
Opening either AI file in a text editor (Wordpad does nicely), you will see lots of text which might make no real sense to
you. The files are formatted in this way:
- List of all Taskforces
- All the Taskforces themselves
- List of all Scripts
- All the Scripts themselves
- List of all Teams
- All the Teams themselves
- All the AITriggers
What these things do and how they work is, again, beyond the scope of this tutorial. All we are trying to do here is get
access to the AI code and be able to read it in a form that isn't just gibberish. Reading the AI ini files is admittedly
confusing, but we'll fix that right up, and we'll use the Final Alert2 Yuri map editor to do it.
| | | | | | | |
| | | | | |
Making the AI Trigger Viewer
1. Make sure the appropriate AI file (AI.INI or AIMD.INI) is extracted as described above, and exists on your
hard disk.
2. Open Final Alert2 Yuri. (You should be using the latest version, v1.01, since it includes AITrigger editing
support).
3. On the File menu, click New.
4. On the Create New Map - Step 1 dialog, make sure the Multiplayer map radio button is selected and click
Next.
5. On the Create New Map - Step 2 dialog, make sure the Create a completely new map radio button is checked.
The status of the Activate AI Triggers checkbox does not matter, so I advise unchecking it. Click Next.
6. On the Create New Map - Step 3 dialog, nothing you set matters since this map will never be loaded in the
game. This map you are creating is for reference purposes only. Just click Next now.
7. Once the graphics load, go to the Edit menu and click INI editing.
8. On the INI Editor dialog, click the Insert another INI file content button.
9. A "Save As" dialog pops up. You are not actually saving anything here, this dialog is just acting as a file
browser. Find the AI INI file you extracted (AI.INI or AIMD.INI), select it, and click the Save button.
10. Now yet another dialog pops up - Insert INI file section. Make sure the Import all sections radio button
is selected and click OK. You have just added the entire contents of the selected AI file to the map you are creating.
11. Close the INI Editor.
12. On the File menu, click Save as.
13. On the Check Map dialog, ignore any complaints that may appear, and click OK.
14. Now the Save As dialog pops up again. This time you really are saving something - this map. Now, this map will
never be run in the game, so there's no need to make RA2/YR waste time parsing it on startup. Browse to a folder other than
your Red Alert2 folder (where you are keeping those extracted AI INI files would be a good place). Type in a filename for
the map - I would suggest using the filenames AI.MPR if this map contains the RA2 AI Triggers, or AIMD.YRM if
this map contains the YR AI Triggers. Once done click Save.
15. On the Save Options dialog, nothing you set will matter. Just click OK now. You are done.
At any time you need to study the game's AI, you can open this special "AI Trigger" map in FA2-Yuri. Using the
Edit menu, you can:
- Use the Scripts editor to view the game's AI Trigger scripts
- Use the Taskforces editor to view the game's AI Trigger Taskforces
- Use the Teams editor to view the game's AI Trigger Teams
- Use the AITrigger editor to view the game's AI Triggers
| | | | | | | |
| | | | | |
Some Notes on How AI Triggers Work
In very general terms, this is how the elements of the AI Triggers, Teams, Scripts and Taskforces relate to each other:
-
An AITrigger will be used under certain conditions, and will call a certain Team.
-
A Team will describe the properties of the units' behavior, and will call a certain Taskforce and will call a
certain Script.
-
A Script will describe the series of actions that a Team will follow.
-
A Taskforce will describe the unit type(s) and how many of each that will be assigned to a Team.
Naturally, two or more AITriggers could call a common Team, and two or more Teams can call a common
Script and/or a common Taskforce. If you make a new AITrigger, whether it be in a mod or in a map, you could
use elements that are already present rather than duplicate them. Like make that new AITrigger call an already existing
Team, or make a new Team call an already existing Taskforce and/or Script. This is especially important in maps, where file
size is a consideration.
| | | | | | | |
| | | | | |
Conclusion
As stated in the introduction, how to make your own AI Triggers is beyond the scope of this tutorial. For information on the
workings of the game's AI, and how to write your own AI Trigger code, I refer you to
DeeZire's INI Editing Guide. Once you get this resource,
you will find nearly all you will need to know in AI.DOC.
Once you start using FA2 as an AI Trigger viewer, you might well believe it's a natural thing to create your own AI Triggers
in FA2 as well. I would strongly advise against it, at least not doing it to create your final AI Trigger code! There are a
couple of reasons that I say this. One is that FA2 is prone to creating corrupt AI Triggers from time to time. Another is
that FA2 writes Team code oddly, with their properties in an odd order, and includes properties that are unnecessary for
mod AI. Yet another is that FA2 does not list all the available script actions. Instead, you should write your AI Triggers,
Teams, Taksforces, and Scripts in text, using DeeZire's guide as a reference. You can always load your mod's AI code into
FA2 to view it later, in the same manner as this tutorial tells you how to view the game's stock AI.
Hopefully you will find this AI Trigger viewer technique to be valuable in helping you understand how the existing AI code
works, so you can then begin writing your own.
| | | | | | | |
| | :Alliances:
Allies Revenge 2
CNCDEN : RADEN
CNC Archive
CNC Source
DeeZire Online
Strategy X Network
| | | | | | |
| | All content, files, images, etc., appearing on this website and all hosted websites, are copyright © 2002-2006 by Cannis Games Editing Network (C-GEN), and/or if applicable, by the Owner(s) of said hosted website(s), and/or in the case of submitted material, by the Author(s) of that material. No reproduction of any of the above is permitted for any reason unless express permission is given by the applicable Owner(s) and/or Author(s). All trademarks appearing on this website are, and remain, the property of their respective owners. This website is best viewed with Internet Explorer 5 or higher, at a resolution of 1024x768 or greater. | | |
|