|
RA2/YR: AI Triggers: Making an AI Trigger Viewer 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:
| ||
|
Making the AI Trigger Viewer
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:
| ||
|
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:
| ||
|
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. | ||