//帝国3地图触发分三种,一种是官方设定的标准格式触发,除了是官方设定没有任何优点,需要读取xml文件,使用自定义触发程序不能与未修改触发程序的玩家联机,如果存在中文路径,无法执行;另外两种是通过c++注释符号将触发程序精简成命令并直接输出到游戏,可以自定义触发程序,几百个kb、tr、ui、xs命令任意发挥。第二种触发虽然可以自由发挥,但是仍然受中文路径限制,而第三种触发则不受中文路径限制,就算存在中文路径也能运行,但是输出长度有限制,一个触发程序最高输出255字符,超出就会导致无法读取,使所有触发程序失效。本文不再详述三种地图触发的区别以及使用方法,您自己参考https://www.aoebbs.net/tutorial.php?mod=13-5。
// ---------------------------------------------------------------------------------------------------------- // 以本人制作的中国地图为例子: // ***************************************** Installation Path ***************************************** /*开头触发--踢出中文路径玩家;原理:已知中文路径会导致第一种、第二种触发程序失效,所以用第一种触发程序设定一个值,在用第三种触发程序检测这个数值,如果不等于那个值就使用UI命令,使其主动退出游戏。*/ rmCreateTrigger("GameStart"); rmSetTriggerRunImmediately(true); rmSetTriggerPriority(5); rmSetTriggerEffectParam("IdleProc","true);trQuestVarSet(\"Path\",1);}}/*"); rmCreateTrigger("Path active runImmediately{if(trQuestVarGet(\"Path\")!=1){"+"showSPCNote(\"Error!\",\"<color=0,1,1>Use-the-English-path-to-install-the-Age-of-Empires-III,please.\");"+"uiMessageBox2(20948);trEndGame();trYouWin(true);xsDisableRule(\"_Path\");}}/*"); rmSetTriggerActive(false); rmSetTriggerPriority(5); //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //首先在void main(void)前面声明几个值(我也不知道这样表达是否正确,其实我不太懂c++的) void oxy(string xs1="", string xs2="",string xs3="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs1+xs2+xs3+" /* "); }
void oxyA(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true"); }
void oxyZ(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true"); }
/*--------------------------------------------------------------------------------- 给地图添加昼夜循环触发 -----------------------------------------------------------------------------------*/
// ****************************************** Trigger Start ******************************************** /*下面的触发添加在void main(void)里面,建议添加在底部*/ /*第二种触发程序开头,所有触发程序必须添加在这个触发程序下面*/ rmCreateTrigger("aoebbs"); rmSwitchToTrigger(rmTriggerID("aoebbs")); rmSetTriggerRunImmediately(true); oxyA("}}"); // *****************************************************************************************************
oxy("rule _0start active runImmediately { "); /*第一个触发程序active作用中,runImmediately立刻运行*/ oxy("if((trTime()-cActivationTime) >= 1.00000000){"); /*被active一秒后开始运行*/ oxy("trSetLighting(\"spcCC5b\", 420.00000000);"); /*改变游戏照明为spcCC5b,变化时间为420秒,右边的数值越少,变化越快,越大,变化则越慢*/ oxy("xsDisableRule(\"_0start\");"); /*关闭触发程序_0start,也就是关闭自己,如果不关闭就变成循环触发了,会一直卡在开头,无法改变照明*/ oxy("xsEnableRule(\"_revolutionLighting\");"); /*开启触发程序_revolutionLighting,下面那个触发↓↓↓↓↓*/ oxyZ("}} /*");
oxy("rule _revolutionLighting inactive runImmediately { "); /*inactive代表该触发程序处于未激活状态,需要用其他触发程序去激活*/ oxy("if((trTime()-cActivationTime) >= 419.00000000){"); /*因为上面那个触发程序设定了420秒,所以这里设定激活419秒后运行*/ oxy("trSetLighting(\"hc_revolution\", 250.00000000);"); /*改变游戏照明为hc_revolution,变化时间为250秒*/ oxy("xsDisableRule(\"_revolutionLighting\");"); /*关闭_revolutionLighting*/ oxy("xsEnableRule(\"_6lISBOM\");"); /*开启_6lISBOM;↓↓↓↓↓↓↓↓*/ oxyZ("}} /*");
oxy("rule _6lISBOM inactive runImmediately { "); /*同上*/ oxy("if((trTime()-cActivationTime) >= 250.00000000){"); oxy("trSetLighting(\"Lisbon Storm\", 50.00000000);"); oxy("xsDisableRule(\"_6lISBOM\");"); oxy("xsEnableRule(\"_7spcJC4aflashback\");"); oxyZ("}} /*");
oxy("rule _7spcJC4aflashback inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 50.00000000){"); oxy("trSetLighting(\"spcJC4aflashback\", 120.00000000);"); oxy("xsDisableRule(\"_7spcJC4aflashback\");"); oxy("xsEnableRule(\"_8minescent\");"); oxyZ("}} /*");
oxy("rule _8minescent inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 420.00000000){"); oxy("trSetLighting(\"minescene\", 300.00000000);"); oxy("xsDisableRule(\"_8minescent\");"); oxy("xsEnableRule(\"_1start\");"); oxyZ("}} /*");
oxy("rule _1start inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 300.00000000){"); oxy("trSetLighting(\"New England Start\", 130.00000000);"); oxy("xsDisableRule(\"_1start\");"); oxy("xsEnableRule(\"_2start\");"); oxyZ("}} /*");
int LightingType = rmRandInt(1,2); /*这里弄了个随机数,用来判断数值大小,然后设定不同的照明*/
oxy("rule _2start inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 130.00000000){"); If ( LightingType == 1 ) { oxy("trSetLighting(\"yellow_river\", 140.00000000);"); } If ( LightingType == 2 ) { oxy("trSetLighting(\"yukon\", 140.00000000);"); } oxy("xsDisableRule(\"_2start\");"); oxy("xsEnableRule(\"_3patagonia\");"); oxyZ("}} /*");
oxy("rule _3patagonia inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 140.00000000){"); oxy("trSetLighting(\"spcCC5b\", 150.00000000);"); oxy("xsDisableRule(\"_3patagonia\");"); oxy("xsEnableRule(\"_4hcrevolution4\");"); oxyZ("}} /*");
oxy("rule _4hcrevolution4 inactive runImmediately { "); oxy("if((trTime()-cActivationTime) >= 150.00000000){"); oxy("trSetLighting(\"hc_revolution\", 250.00000000);"); oxy("xsDisableRule(\"_4hcrevolution4\");"); oxy("xsEnableRule(\"_6lISBOM\");"); /*开启触发程序_6lISBOM,你会发现从这个触发程序开始后,会从_6lISBOM无限循环到_4hcrevolution4*/ oxyZ("}} /*");
// ******************************************** Trigger End ******************************************** /*第二种触发程序结尾,所有触发程序必须添加在这个触发程序上面*/ oxy("rule _Temp inactive { if(true){"); oxyZ("xsDisableSelf();"); // *****************************************************************************************************
|