Adding Custom Triggers

From AgeofWiki

I'll explain how to add custom Trigger Members to your typetest.xml file. This is not a guide to make them. You have downloaded, created or otherwise obtained some trigger members code and you want to be able to use them. We'll use this example code:

<Condition name = "QV Timer">
<Param name = "QVName" dispName = "$$23952$$Var Name" varType = "string">QV1</Param>
<Expression>(trTime()-cActivationTime) >= trQuestVarGet("%QVName%")</Expression>
</Condition>

And:

<Effect name="QV Set Fake Counter">
<Param name="Text1" dispName="TextBefore" VarType="stringid">Default</Param>
<Param name="QVName" dispName="$$23952$$Var Name" VarType="string">QV1</Param>
<Param name="Text2" dispName="TextAfter" VarType="stringid">Default</Param>
<Command>trSetCounterDisplay("%Text1% " + trQuestVarGet("%QVName%")+ " %Text2%");</Command>
</Effect>


Table of contents

Typetest file

First, you have to locate your typetest.xml file.

  1. Go to your AoE3 Directory (usually C:\Program Files\Microsoft Games\Age of Empires III).
  2. Open the trigger directory.
  3. There should be a file called typetest.xml. Check whether it's marked read-only (right click on the file -> Properties -> Read-Only) and untick the box if it is.
  4. Open typetest.xml with a simple text editor, like Notepad or Wordpad.


Conditions

To add conditions, do the following.

  1. Search for the following text in typetest.xml: </Conditions>
  2. You'll find this:
    ...
    </Condition>
    </Conditions>
  3. Add all the code you have (from <Condition> until </Condition>) between the </Condition> and </Conditions> you have found.
  4. This is how it should look like:
    ...
    </Condition>
    <Condition name = "QV Timer">
    <Param name = "QVName" dispName = "$$23952$$Var Name" varType = "string">QV1</Param>
    <Expression>(trTime()-cActivationTime) >= trQuestVarGet("%QVName%")</Expression>
    </Condition>
    </Conditions>
  5. In this example, you have added the condition QV Timer now.


Effects

To add effects, do the following.

  1. Scroll to the end of the typetest.xml file.
  2. You'll see this:
    ...
    </Effect>
    </Effects>
  3. Add all the code you have (from <Effect> until </Effect>) between the </Effect> and </Effects> you have found.
  4. This is how it should look like:
    ...
    </Effect>
    <Effect name="QV Set Fake Counter">
    <Param name="Text1" dispName="TextBefore" VarType="stringid">Default</Param>
    <Param name="QVName" dispName="$$23952$$Var Name" VarType="string">QV1</Param>
    <Param name="Text2" dispName="TextAfter" VarType="stringid">Default</Param>
    <Command>trSetCounterDisplay("%Text1% " + trQuestVarGet("%QVName%")+ " %Text2%");</Command>
    </Effect>
    </Effects>
  5. In this example, you have added the effect QV Set Fake Counter now.


Saving the file

Now save the file. That's all.


Further Notes

After changing something in typetest.xml, you should do the following.

  • Open the changed typetest.xml in a browser like Internet Explorer. If the code is wrong at any point (if the code is not 'well-formed'), Internet Explorer will tell you. Make sure you have followed all steps correctly.
  • Make a backup of typetest.xml once in a while.