In the history of AoM there have always been 2 types of designers: Scenario designers and modders. The first one works with
Now apparently the majority (I think I'm safe to assume 99%) thinks that there is no way to combine the power of triggers and the moddable data outside the editor. But that's a lie! :P The game does it all the time. When you create a trigger in a scenario it gets transformed into XS the moment you load the scenario and guess what, XS falls under the moddable data as every random map loads the victory conditions which is written in XS. What this means is that triggers can be combined with mods!
In this guide we'll go through the basics of VC scripting.
The victory condition file is located in your Age of Mythology\trigger2 and called basicvcnomain.xs. Open this with your text editor it should start with this:
//==============================================================================
// BASICVC.xs
//
// A really, really simple victory condition script.
//==============================================================================
It actually is really simple but we're not going to touch the victory condition. We're just adding extra triggers. But first include the variable file and a little debug script:
include "cVariables.xs";
rule Debug
minInterval 0
maxInterval 0
active
{
int testVariables = cTechStatusUnobtainable;
trChatSend(0, "VC works and variables loaded!");
xsDisableSelf();
}
This way we know immediately if our VC works because player 0 will tell us
rule EnableTechWhenNotNearPopCap
minInterval 1
maxInterval 1
active
{
//Iterate over the players, we start at 1 as gaia should
// not be checked (she's always popcapped anyways)
for (i=1; <cNumberPlayers)
{
// Set the context player and check if its current pop + 5 is bigger or equal to its pop cap
xsSetContextPlayer(i);
if((kbGetPop()+5)>=kbGetPopCap())
{
// We are near pop cap so disable the watch towers tech for the current player
trTechSetStatus(i, cTechWatchTower, cTechStatusUnobtainable);
}
else
{
// We are not near pop cap so enable the watch towers tech for the current player
trTechSetStatus(i, cTechWatchTower, cTechStatusActive);
}
}
}
And there we go, all our towers should be able to shoot at enemies when we have more than 5 pop slots available, but most importantly every random map that uses the standard VC will have this effect!
You can add more if statements that check for the current age of a player as the towers will now also be enabled in age 1 but that's up to you.
It should contain the triggers of your scenario in XS form. Never attempted to copy paste them into the VC but it might work! If not then it is still a nice reference.
For example:
extern const int cTechYourNewTechNameWithoutSpaces = 507;
For now this is where the guide ends but I might add some more sections about godpowers, units and debugging if there is enough interest. Atm the guide only covers the basics of combining technologies and triggers but the same methods should apply to godpowers and units too.
[This message has been edited by WarriorMario (edited 07-15-2015 @ 01:03 AM).]