......
幸好孙百里是用旧版本触发程序的,所以台海战争有他设定的旧版本触发程序:
rmCreateTrigger("string triggerName"); //设定触发程序名称
rmSwitchToTrigger(rmTriggerID("string triggerName")); //开启某触发程序
rmSetTriggerPriority(3); //优先级
rmSetTriggerActive(true); //设定是否作用中,false为关闭状态
rmSetTriggerRunImmediately(true); //设定是否立即运行,false为开局5秒后才允许
rmSetTriggerLoop(false); //设定是否无限循环本触发,false为只执行一次
rmAddTriggerCondition("string conditionType"); //设定条件,必须与游戏目录的trigger3文件夹里面的typetest.xml文件中的Condition name=""对应
rmSetTriggerConditionParamInt("string paramName", int value, false); //设定条件内容,paramName必须与条件名称在同一个触发,与typetest.xml的Param name=""对应,typetest.xml那个条件有多少个选项你就添加多少句,注意假如rmSetTriggerConditionParam加上Int只能填数字。
rmSetTriggerConditionParam("string paramName", "string value", false); //假如 rmSetTriggerEffectParam 不加 Int ,则变成string效果,第二个值要加英文双引号
rmAddTriggerEffect("string effectType"); //设定效果,必须与游戏目录的 trigger3 文件夹里面的 typetest.xml 文件中的 Effect name="" 对应
rmSetTriggerEffectParamInt("string paramName", int value, false); //设定效果内容, paramName 必须与条件名称在同一个触发,与 typetest.xml 的 Param name="" 对应, typetest.xml 那个效果有多少个选项你就添加多少句,注意假如 rmSetTriggerEffectParam 加上 Int 第二个值只能填数字
rmSetTriggerEffectParam("string paramName", "string value", false); //假如 rmSetTriggerEffectParam 不加 Int ,则变成string效果,第二个值要加英文双引号
模板:
rmCreateTrigger("string triggerName");
rmSwitchToTrigger(rmTriggerID("string triggerName"));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(true);
rmSetTriggerLoop(false);
rmAddTriggerCondition("string conditionType");
rmSetTriggerConditionParamInt("string paramName", int value, false);
rmSetTriggerConditionParam("string paramName", "string value", false);
rmAddTriggerEffect("string effectType");
rmSetTriggerEffectParamInt("string paramName", int value, false);
rmSetTriggerEffectParam("string paramName", "string value", false);
条件:首先必须在地图的void main(void)前面添加以下语句: void aoebbs(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" /* "); } void aoebbsA(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsE(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsZ(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true"); } void aoebbsR(string xs1="",string xs2="") { rmCreateTrigger(xs1+" "+xs2+"/*"); rmCreateTrigger("*/rule _"+xs1+"End"); rmSetTriggerActive(false); } 然后在在void(main)里面,你需要在输入触发程序的地方按照以下方法添加触发程序优点:
rmAddTriggerEffect注入代码
以下红色字体为必要设定,只需要添加一次,添加一次后,你就可以在CustomTrigger与_Temp之间任意插入xs触发。最后一句必须用 `aoebbsE("");`或者`aoebbsZ("/*");`结尾,aoebbsE("")的双引号内可以插入触发程序代码,aoebbsZ的的双引号内也可以插入代码,但双引号内的末尾必须是`/*`。 rmCreateTrigger("CustomTrigger"); rmSwitchToTrigger(rmTriggerID("CustomTrigger")); rmSetTriggerRunImmediately(true); aoebbsA("}}"); //---------在下面输入规则(触发),旧版本触发程序会输出类似下面的规则,输出的名称叫rule _触发程序名-------- //----可以无限添加规则---------- //这个是示例: aoebbs("rule _1start inactive runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 300.00000000){"); aoebbs("trSetLighting(\"New England Start\", 130.00000000);"); aoebbs("xsDisableRule(\"_1start\");"); aoebbs("xsEnableRule(\"_2start\");"); aoebbsE("}} "); //如果你使用的是aoebbsZ结束函数,那么必须要以aoebbsZ("/*");结尾 aoebbs("rule _1startZ inactive runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 300.00000000){"); aoebbs("trSetLighting(\"New England Start\", 130.00000000);"); aoebbs("xsDisableRule(\"_1startZ\");"); aoebbs("xsEnableRule(\"_2start\");"); aoebbsZ("}} /*"); //RM与XS混用,根据RM的设定,生成不同的触发 int PlayerType = rmRandInt(1,2); aoebbs("rule _2start inactive runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 130.00000000){"); if ( PlayerType == 1 ) { aoebbs("trSetLighting(\"yellow_river\", 140.00000000);"); } if ( PlayerType == 2 ) { aoebbs("trSetLighting(\"yukon\", 140.00000000);"); } aoebbs("xsDisableRule(\"_2start\");"); aoebbs("xsEnableRule(\"_3patagonia\");"); aoebbsE("}} "); if (rmGetNomadStart()!=true) { aoebbs("rule _start active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); for(p=1;<=cNumberNonGaiaPlayers) { if (rmGetPlayerCiv(p) >= 14 && rmGetPlayerCiv(p) <= 18 ) { aoebbs("trChatSendToPlayer(0,"+p+",\"{63974}\");"); } else if (rmGetPlayerCiv(p) >= 19 && rmGetPlayerCiv(p) <= 26 ) { aoebbs("trChatSendToPlayer(0,"+p+",\"{63973}\");"); } else { aoebbs("trChatSendToPlayer(0,"+p+",\"{31536}\");"); } } aoebbs("xsDisableRule(\"_start\");"); aoebbsE("}} "); } aoebbs("rule _Debug1 active runImmediately { "); //rule _后面的文字相当于旧版触发程序的触发名称 aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");"); aoebbs("xsDisableRule(\"_Debug1\");"); aoebbsZ("}} /*"); aoebbs("rule _Debug2 active runImmediately { "); //runImmediately为立刻运行,理论上跟剧情编辑器一样,如果不设定立刻运行,开局后会有延迟。 aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");"); aoebbs("xsDisableRule(\"_Debug2\");"); aoebbsZ("}} /*"); aoebbs("rule _Debug3 active runImmediately { "); //active代表作用中,改成inactive就变成关闭状态 aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");"); aoebbs("xsDisableRule(\"_Debug3\");"); aoebbsZ("}} /*"); //-------------------规则必须在上面添加------------ //触发程序结尾,所有规则必须在上面添加,超出此处将无效。 这里必须要以aoebbsZ结尾,不能用aoebbsE结尾 aoebbs("rule _Temp inactive { if(true){"); aoebbsZ("xsDisableSelf();");
rmCreateTrigger("BuildLimit");
rmSwitchToTrigger(rmTriggerID("BuildLimit"));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(false);
rmSetTriggerLoop(false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "ypCastle", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Outpost", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Blockhouse", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "WarHut", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "YPOutpostAsian", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "ypCastle", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "Outpost", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "Blockhouse", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "WarHut", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "YPOutpostAsian", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Caravel", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Galley", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Canoe", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "60", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "ypFune", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "ypWarJunk", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "Caravel", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "Galley", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "Canoe", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "60", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "ypFune", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 2, false);
rmSetTriggerEffectParam("ProtoUnit", "ypWarJunk", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "30", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Monitor", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Galleon", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Fluyt", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Frigate", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypFuchuan", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypAtakabune", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypTekkousen", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "5", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Fluyt", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Monitor", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Galleon", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "Frigate", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypFuchuan", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypAtakabune", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 3-randomplayer, false);
rmSetTriggerEffectParam("ProtoUnit", "ypTekkousen", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rule _BuildLimit
minInterval 2
active
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
trModifyProtounit("ypCastle", 1, 10, 20);
trModifyProtounit("Outpost", 1, 10, 20);
trModifyProtounit("Blockhouse", 1, 10, 20);
trModifyProtounit("WarHut", 1, 10, 20);
trModifyProtounit("YPOutpostAsian", 1, 10, 20);
trModifyProtounit("ypCastle", 2, 10, 20);
trModifyProtounit("Outpost", 2, 10, 20);
trModifyProtounit("Blockhouse", 2, 10, 20);
trModifyProtounit("WarHut", 2, 10, 20);
trModifyProtounit("YPOutpostAsian", 2, 10, 20);
trModifyProtounit("Caravel", 1, 10, 30);
trModifyProtounit("Galley", 1, 10, 30);
trModifyProtounit("Canoe", 1, 10, 60);
trModifyProtounit("ypFune", 1, 10, 30);
trModifyProtounit("ypWarJunk", 1, 10, 30);
trModifyProtounit("Caravel", 2, 10, 30);
trModifyProtounit("Galley", 2, 10, 30);
trModifyProtounit("Canoe", 2, 10, 60);
trModifyProtounit("ypFune", 2, 10, 30);
trModifyProtounit("ypWarJunk", 2, 10, 30);
trModifyProtounit("Monitor", 1, 10, 5);
trModifyProtounit("Galleon", 1, 10, 5);
trModifyProtounit("Fluyt", 1, 10, 5);
trModifyProtounit("Frigate", 1, 10, 5);
trModifyProtounit("ypFuchuan", 1, 10, 5);
trModifyProtounit("ypAtakabune", 1, 10, 5);
trModifyProtounit("ypTekkousen", 1, 10, 5);
trModifyProtounit("Fluyt", 2, 10, 20);
trModifyProtounit("Monitor", 2, 10, 20);
trModifyProtounit("Galleon", 2, 10, 20);
trModifyProtounit("Frigate", 2, 10, 20);
trModifyProtounit("ypFuchuan", 2, 10, 20);
trModifyProtounit("ypAtakabune", 2, 10, 20);
trModifyProtounit("ypTekkousen", 2, 10, 20);
xsDisableRule("_BuildLimit");
trEcho("Trigger disabling rule BuildLimit");
}
}
rule _BuildLimit minInterval 2 active
{
trModifyProtounit("ypCastle", 1, 10, 20);
trModifyProtounit("Outpost", 1, 10, 20);
trModifyProtounit("Blockhouse", 1, 10, 20);
trModifyProtounit("WarHut", 1, 10, 20);
trModifyProtounit("YPOutpostAsian", 1, 10, 20);
trModifyProtounit("ypCastle", 2, 10, 20);
trModifyProtounit("Outpost", 2, 10, 20);
trModifyProtounit("Blockhouse", 2, 10, 20);
trModifyProtounit("WarHut", 2, 10, 20);
trModifyProtounit("YPOutpostAsian", 2, 10, 20);
trModifyProtounit("Caravel", 1, 10, 30);
trModifyProtounit("Galley", 1, 10, 30);
trModifyProtounit("Canoe", 1, 10, 60);
trModifyProtounit("ypFune", 1, 10, 30);
trModifyProtounit("ypWarJunk", 1, 10, 30);
trModifyProtounit("Caravel", 2, 10, 30);
trModifyProtounit("Galley", 2, 10, 30);
trModifyProtounit("Canoe", 2, 10, 60);
trModifyProtounit("ypFune", 2, 10, 30);
trModifyProtounit("ypWarJunk", 2, 10, 30);
trModifyProtounit("Monitor", 1, 10, 5);
trModifyProtounit("Galleon", 1, 10, 5);
trModifyProtounit("Fluyt", 1, 10, 5);
trModifyProtounit("Frigate", 1, 10, 5);
trModifyProtounit("ypFuchuan", 1, 10, 5);
trModifyProtounit("ypAtakabune", 1, 10, 5);
trModifyProtounit("ypTekkousen", 1, 10, 5);
trModifyProtounit("Fluyt", 2, 10, 20);
trModifyProtounit("Monitor", 2, 10, 20);
trModifyProtounit("Galleon", 2, 10, 20);
trModifyProtounit("Frigate", 2, 10, 20);
trModifyProtounit("ypFuchuan", 2, 10, 20);
trModifyProtounit("ypAtakabune", 2, 10, 20);
trModifyProtounit("ypTekkousen", 2, 10, 20);
xsDisableRule("_BuildLimit");
}
aoebbs("rule _BuildLimit minInterval 2 active");
aoebbs("{");
aoebbs("trModifyProtounit(\"ypCastle\", 1, 10, 20);");
aoebbs("trModifyProtounit(\"Outpost\", 1, 10, 20);");
aoebbs("trModifyProtounit(\"Blockhouse\", 1, 10, 20);");
aoebbs("trModifyProtounit(\"WarHut\", 1, 10, 20);");
aoebbs("trModifyProtounit(\"YPOutpostAsian\", 1, 10, 20);");
aoebbs("trModifyProtounit(\"ypCastle\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Outpost\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Blockhouse\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"WarHut\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"YPOutpostAsian\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Caravel\", 1, 10, 30);");
aoebbs("trModifyProtounit(\"Galley\", 1, 10, 30);");
aoebbs("trModifyProtounit(\"Canoe\", 1, 10, 60);");
aoebbs("trModifyProtounit(\"ypFune\", 1, 10, 30);");
aoebbs("trModifyProtounit(\"ypWarJunk\", 1, 10, 30);");
aoebbs("trModifyProtounit(\"Caravel\", 2, 10, 30);");
aoebbs("trModifyProtounit(\"Galley\", 2, 10, 30);");
aoebbs("trModifyProtounit(\"Canoe\", 2, 10, 60);");
aoebbs("trModifyProtounit(\"ypFune\", 2, 10, 30);");
aoebbs("trModifyProtounit(\"ypWarJunk\", 2, 10, 30);");
aoebbs("trModifyProtounit(\"Monitor\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"Galleon\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"Fluyt\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"Frigate\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"ypFuchuan\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"ypAtakabune\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"ypTekkousen\", 1, 10, 5);");
aoebbs("trModifyProtounit(\"Fluyt\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Monitor\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Galleon\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"Frigate\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"ypFuchuan\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"ypAtakabune\", 2, 10, 20);");
aoebbs("trModifyProtounit(\"ypTekkousen\", 2, 10, 20);");
aoebbs("xsDisableRule(\"_BuildLimit\");");
aoebbs("}");
aoebbsE("");
然后游戏中实测,打开trigtemp.xs获得以下代码;
trSetUnitIdleProcessing(true); */ rule _BuildLimit minInterval 2 active /* );
trSetUnitIdleProcessing(true); */ { /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypCastle", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Outpost", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Blockhouse", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("WarHut", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("YPOutpostAsian", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypCastle", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Outpost", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Blockhouse", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("WarHut", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("YPOutpostAsian", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Caravel", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galley", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Canoe", 1, 10, 60); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFune", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypWarJunk", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Caravel", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galley", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Canoe", 2, 10, 60); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFune", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypWarJunk", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Monitor", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galleon", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Fluyt", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Frigate", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFuchuan", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypAtakabune", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypTekkousen", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Fluyt", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Monitor", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galleon", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Frigate", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFuchuan", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypAtakabune", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypTekkousen", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ xsDisableRule("_BuildLimit"); /* );
trSetUnitIdleProcessing(true); */ } /* );
trSetUnitIdleProcessing(true); */ /*
rmCreateTrigger("CustomTrigger");
rmSwitchToTrigger(rmTriggerID("CustomTrigger"));
rmSetTriggerRunImmediately(true);
aoebbsA("}}");
aoebbs("rule _Temp inactive { if(true){");
aoebbsZ("xsDisableSelf();"); aoebbs("rule _Temp inactive { if(true){");
aoebbsZ("xsDisableSelf();");
rule _CustomTrigger
minInterval 4
active
runImmediately
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
trSetUnitIdleProcessing(true); }}/* trSetUnitIdleProcessing(true);
trSetUnitIdleProcessing(true); */ rule _BuildLimit minInterval 2 active /* );
trSetUnitIdleProcessing(true); */ { /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypCastle", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Outpost", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Blockhouse", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("WarHut", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("YPOutpostAsian", 1, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypCastle", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Outpost", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Blockhouse", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("WarHut", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("YPOutpostAsian", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Caravel", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galley", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Canoe", 1, 10, 60); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFune", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypWarJunk", 1, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Caravel", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galley", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Canoe", 2, 10, 60); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFune", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypWarJunk", 2, 10, 30); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Monitor", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galleon", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Fluyt", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Frigate", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFuchuan", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypAtakabune", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypTekkousen", 1, 10, 5); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Fluyt", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Monitor", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Galleon", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("Frigate", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypFuchuan", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypAtakabune", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ trModifyProtounit("ypTekkousen", 2, 10, 20); /* );
trSetUnitIdleProcessing(true); */ xsDisableRule("_BuildLimit"); /* );
trSetUnitIdleProcessing(true); */ } /* );
trSetUnitIdleProcessing(true); */ /* trSetUnitIdleProcessing(true);
trSetUnitIdleProcessing(true); */ rule _Temp inactive { if(true){ /* );
trSetUnitIdleProcessing(true); */ xsDisableSelf(); trSetUnitIdleProcessing(true);
xsDisableRule("_CustomTrigger");
trEcho("Trigger disabling rule CustomTrigger");
}
}
rule _CustomTrigger
minInterval 4
active
runImmediately
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
trSetUnitIdleProcessing(true);
}
}
rule _BuildLimit minInterval 2 active
{
trModifyProtounit("ypCastle", 1, 10, 20);
trModifyProtounit("Outpost", 1, 10, 20);
trModifyProtounit("Blockhouse", 1, 10, 20);
trModifyProtounit("WarHut", 1, 10, 20);
trModifyProtounit("YPOutpostAsian", 1, 10, 20);
trModifyProtounit("ypCastle", 2, 10, 20);
trModifyProtounit("Outpost", 2, 10, 20);
trModifyProtounit("Blockhouse", 2, 10, 20);
trModifyProtounit("WarHut", 2, 10, 20)
trModifyProtounit("YPOutpostAsian", 2, 10, 20);
trModifyProtounit("Caravel", 1, 10, 30);
trModifyProtounit("Galley", 1, 10, 30);
trModifyProtounit("Canoe", 1, 10, 60);
trModifyProtounit("ypFune", 1, 10, 30);
trModifyProtounit("ypWarJunk", 1, 10, 30);
trModifyProtounit("Caravel", 2, 10, 30);
trModifyProtounit("Galley", 2, 10, 30);
trModifyProtounit("Canoe", 2, 10, 60);
trModifyProtounit("ypFune", 2, 10, 30);
trModifyProtounit("ypWarJunk", 2, 10, 30);
trModifyProtounit("Monitor", 1, 10, 5);
trModifyProtounit("Galleon", 1, 10, 5);
trModifyProtounit("Fluyt", 1, 10, 5);
trModifyProtounit("Frigate", 1, 10, 5);
trModifyProtounit("ypFuchuan", 1, 10, 5);
trModifyProtounit("ypAtakabune", 1, 10, 5);
trModifyProtounit("ypTekkousen", 1, 10, 5);
trModifyProtounit("Fluyt", 2, 10, 20);
trModifyProtounit("Monitor", 2, 10, 20);
trModifyProtounit("Galleon", 2, 10, 20);
trModifyProtounit("Frigate", 2, 10, 20);
trModifyProtounit("ypFuchuan", 2, 10, 20);
trModifyProtounit("ypAtakabune", 2, 10, 20);
trModifyProtounit("ypTekkousen", 2, 10, 20);
xsDisableRule("_BuildLimit");
}
rule _Temp inactive
{
if(true)
{
xsDisableSelf();
trSetUnitIdleProcessing(true);
xsDisableRule("_CustomTrigger");
trEcho("Trigger disabling rule CustomTrigger");
}
}
rmCreateTrigger("BuildLimit");
rmSwitchToTrigger(rmTriggerID("BuildLimit"));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(false);
rmSetTriggerLoop(false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "ypCastle", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmAddTriggerEffect("Modify Protounit");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ProtoUnit", "Outpost", false);
rmSetTriggerEffectParam("Field", "10", false);
rmSetTriggerEffectParam("Delta", "20", false);
rmCreateTrigger("TriggerName active runImmediately{trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");xsDisableSelf();}/*");
rmCreateTrigger("*/rule _TriggerNameEnd");
封装函数后变成
aoebbsR("TriggerName","active runImmediately{trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");xsDisableSelf();}");
rmCreateTrigger("TriggerName active runImmediately{trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");xsDisableSelf();}/*");
rmCreateTrigger("*/rule _TriggerNameEnd");
运行后得到以下代码:
rule _TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*
minInterval 4
active
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
xsDisableRule("_TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*");
trEcho("Trigger disabling rule TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*");
}
}
rule _*/rule _TriggerNameEnd
minInterval 4
active
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
xsDisableRule("_*/rule _TriggerEnd");
trEcho("Trigger disabling rule */rule _TriggerEnd");
}
}
aoebbsR("TriggerName","active runImmediately{trChatSendSpoofed(0,\"<color=0,1,1>Forum : https://www.aoebbs.net\");xsDisableSelf();}");
上述代码运行后,输出如下:
rule _TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*
minInterval 4
active
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
xsDisableRule("_TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*");
trEcho("Trigger disabling rule TriggerName active runImmediately{trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();}/*");
}
}
rule _*/rule _TriggerNameEnd
minInterval 4
inactive
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
xsDisableRule("_*/rule _TriggerNameEnd");
trEcho("Trigger disabling rule */rule _TriggerNameEnd");
}
}
rule _TriggerName
active
runImmediately
{
trChatSendSpoofed(0,"<color=0,1,1>Forum : https://www.aoebbs.net");xsDisableSelf();
}
rule _TriggerNameEnd
minInterval 4
inactive
{
bool bVar0 = (true);
bool tempExp = (bVar0);
if (tempExp)
{
trSetUnitIdleProcessing(true);
xsDisableRule("_*/rule _TriggerNameEnd");
trEcho("Trigger disabling rule */rule _TriggerNameEnd");
}
}
<Condition name="Timer">
<Param name="Param1" dispName="$$22291$" VarType="long">0</Param>
<Expression>(trTime()-cActivationTime) >= %Param1%</Expression>
</Condition>
<Effect name="Grant Resources">
<Param name="PlayerID" dispName="$$22301$" varType="player">1</Param>
<Param name="ResName" dispName="$$22455$" varType="resource">food</Param>
<Param name="Amount" dispName="$$22456$" varType="long">100</Param>
<Command>trPlayerGrantResources(%PlayerID%, "%ResName%", %Amount%);</Command>
</Effect>
方法1.旧版触发:
//第一个值必须与typetest.xml对应
rmCreateTrigger("Gold");
rmSwitchToTrigger(rmTriggerID("Gold"));
rmSetTriggerPriority(3);
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(true);
rmSetTriggerLoop(false);
rmAddTriggerCondition("Timer");
rmSetTriggerConditionParamInt("Param1", 10, false);
rmAddTriggerEffect("Grant Resources");
rmSetTriggerEffectParamInt("PlayerID", 1, false);
rmSetTriggerEffectParam("ResName", "Gold", false);
rmSetTriggerEffectParamInt("Amount", 100, false);
//第二个值为什么是这样填写的?你去参考一下剧情编辑器,制作一个相同的触发看看。
方法2.注入式触发程序-rmAddTriggerEffect注入代码:
include "mercenaries.xs"; include "ypAsianInclude.xs"; include "ypKOTHInclude.xs"; //顶部定义函数 void aoebbs(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" /* "); } void aoebbsA(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsE(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsZ(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true"); } void aoebbsR(string xs1="",string xs2="") { rmCreateTrigger(xs1+" "+xs2+"/*"); rmCreateTrigger("*/rule _"+xs1+"End"); rmSetTriggerActive(false); } void main(void) { // ---------------------------------------- Map Info ------------------------------------------- int playerTilesX=13200; //设定地图X大小 int playerTilesZ=13200; //设定地图Z大小(帝国3的Y是高度,Z才是我们平常所用到的Y) //如果玩家大于4将playerTilesX与playerTilesZ改为11500(同一个值的int只能出现1次,当你需要修改数值的时候,不能再加入int) if (cNumberNonGaiaPlayers >4){ playerTilesX=11500; playerTilesZ=11500;} if (cNumberNonGaiaPlayers >6){ playerTilesX=10500; playerTilesZ=10500;} //Modify Map X&Z Size of 6,7,8 Player int SizeX = 2*sqrt(cNumberNonGaiaPlayers*playerTilesX); int SizeZ = 2*sqrt(cNumberNonGaiaPlayers*playerTilesZ); string MapTerrain ="Carolinas\ground_marsh3_car"; //<-------- 地图地形,自己参照剧情编辑器 <-------- string MapLighting ="319a_Snow"; //<-------- 照明,自己参照剧情编辑器 <-------- string PlayerTerrain ="Carolinas\ground_marsh1_car"; //<--------- 玩家范围地形 <--------- //设定地图XZ大小,分别调用上面用int定义的SizeX与SizeZ,即为rmSetMapSize(13200,13200);如果玩家大于4将改为11500 rmSetMapSize(SizeX, SizeZ); rmSetMapElevationParameters(cElevTurbulence, 0.15, 2.5, 0.35, 3.0); // type, frequency, octaves, persistence, variation rmSetMapElevationHeightBlend(1.0); //地形初始化,设定地图初始地形,调用上面用string定义MapTerrain,即为"Carolinas\ground_marsh3_car"; rmTerrainInitialize(MapTerrain,6); //设定照明,调用上面用string定义MapLighting,即为"319a_Snow" rmSetLightingSet(MapLighting); rmSetGlobalRain(0.9); //设定下雨 chooseMercs(); rmSetMapType("yucatan"); rmSetMapType("water"); rmSetMapType("default"); //设定地图类型,地图类型影响到宝藏 rmSetMapType("land"); rmSetMapType("bayou"); rmSetSeaLevel(0); // this is height of river surface compared to surrounding land. River depth is in the river XML. rmSetStatusText("",0.01);//读取地图进度条 rmSetPlacementSection(0.6, 0.00); rmPlacePlayersCircular(0.40, 0.40, 0.0); // rmSetPlayerResource(1, "Food", 200); //玩家范围 float AreaSizePlayer = rmAreaTilesToFraction(700); for(i=1; <=cNumberNonGaiaPlayers) { int id=rmCreateArea("Player"+i); rmSetPlayerArea(i, id); rmSetAreaWarnFailure(id, false); rmSetAreaSize(id, AreaSizePlayer, AreaSizePlayer); rmSetAreaLocPlayer(id, i); rmSetAreaCoherence(id, 0.85); rmSetAreaSmoothDistance(id, 2); rmSetAreaMinBlobs(id, 1); rmSetAreaMaxBlobs(id, 1); rmSetAreaTerrainType(id,PlayerTerrain); rmBuildArea(id); } //定义城镇中心 int TownCenterID = rmCreateObjectDef("player TC"); if (rmGetNomadStart()) { rmAddObjectDefItem(TownCenterID, "CoveredWagon", 1, 0.0); } else { rmAddObjectDefItem(TownCenterID, "TownCenter", 1, 0); } rmSetObjectDefMinDistance(TownCenterID, 0.0); rmSetObjectDefMaxDistance(TownCenterID, 20.0); for(i=1; <=cNumberNonGaiaPlayers) { //放置城镇中心,rmPlaceObjectDefAtLoc第二个值为被放置玩家对象,这里使用了for循环,循环值=1,<=玩家人数,所以会放置所有玩家的城镇中心。 rmPlaceObjectDefAtLoc(TownCenterID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i)); } //定义起始单位(civs.xml定义那些开局单位) int startingUnits = rmCreateStartingUnitsObjectDef(5.0); rmSetObjectDefMinDistance(startingUnits, 6.0); rmSetObjectDefMaxDistance(startingUnits, 10.0); for(i=1; <=cNumberNonGaiaPlayers) { //我暂时只能告诉你这个是调用城镇中心坐标,不解释太多,解释太多你听不懂。另外留意下for(i=1;<=xx){},这是c++的一种循环格式。 vector TCLocation = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TownCenterID, i)); //放置起始单位 rmPlaceObjectDefAtLoc(startingUnits, i, rmXMetersToFraction(xsVectorGetX(TCLocation)), rmZMetersToFraction(xsVectorGetZ(TCLocation))); } int TestID=rmCreateArea("Test ID Area"); rmSetAreaSize(TestID, rmAreaTilesToFraction(500), rmAreaTilesToFraction(500)); rmSetAreaWaterType(TestID, "Cinematic Ship Ocean"); rmSetAreaWarnFailure(TestID, true); rmSetAreaSmoothDistance(TestID, 0); rmSetAreaCoherence(TestID, 0.0); //rmSetAreaMix(TestID, "himalayas_a");将设定地形类型语句删除,就算是保留也不会再起任何作用了。 rmSetAreaBaseHeight(TestID, 4.0);//地形高度可加,也可以不加,看你自己想怎样设定。 rmSetAreaElevationOctaves(TestID, 3); rmSetAreaObeyWorldCircleConstraint(TestID, false); rmSetAreaLocation(TestID, 0.5, 0.5); rmBuildArea(TestID); rmSetOceanReveal(true); rmSetStatusText("",0.50);//读取地图进度条 rmCreateTrigger("Gold"); rmSwitchToTrigger(rmTriggerID("Gold")); rmSetTriggerPriority(3); rmSetTriggerActive(true); rmSetTriggerRunImmediately(true); rmSetTriggerLoop(false); rmAddTriggerCondition("Timer"); rmSetTriggerConditionParamInt("Param1", 10, false); rmAddTriggerEffect("Grant Resources"); rmSetTriggerEffectParamInt("PlayerID", 1, false); rmSetTriggerEffectParam("ResName", "Gold", false); rmSetTriggerEffectParamInt("Amount", 100, false); //下面就是rmSetTriggerEffect注入代码了,上面是旧版本触发,上面的触发最后会输出成下面蓝色文字双引号""内那种形式 rmCreateTrigger("GamestartInit"); rmSwitchToTrigger(rmTriggerID("GamestartInit")); rmSetTriggerRunImmediately(true); aoebbsA("}}"); aoebbs("rule _Resources active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); //Timer会输出成(trTime()-cActivationTime),意思是(游戏总时间-这个触发作用时长) aoebbs("trPlayerGrantResources(1,\"Gold\",100);"); //是不是很简洁?旧触发要去typetest.xml找名称,这种只需要去函数表找一下就OK了(对我这种比较熟悉函数的人来说) aoebbs("xsDisableRule(\"_Resources\");"); //关闭触发自身,相当于旧触发的rmSetTriggerLoop(false);,,不关闭就变成循环触发;rmSetTriggerLoop(false);最后也会变成这种形式。 aoebbsZ("}} /*"); //上面因为注释太乱了,再写一个加100食物、500木材的触发 aoebbs("rule _ResourcesFood active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); aoebbs("trPlayerGrantResources(1,\"Food\",100);"); aoebbs("trPlayerGrantResources(1,\"Wood\",500);"); aoebbs("xsDisableRule(\"_ResourcesFood\");"); aoebbsZ("}} /*"); aoebbs("rule _Temp inactive { if(true){"); aoebbsZ("xsDisableSelf();"); rmSetStatusText("",1.00);//读取地图进度条 } //END
rmCreateTrigger("AddGold active runImmediately{if((trTime()-cActivationTime)>=10){trPlayerGrantResources(1,\"Gold\",100);xsDisableSelf();xsDisableRule(\"_AddGoldEnd\");}}/*");
rmCreateTrigger("*/rule _AddGoldEnd"); //不能出现任何空格,这个用来结尾的触发除外。
include "mercenaries.xs"; include "ypAsianInclude.xs"; include "ypKOTHInclude.xs"; //顶部定义函数 void aoebbs(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" /* "); } void aoebbsA(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsE(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsZ(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true"); } void aoebbsR(string xs1="",string xs2="") { rmCreateTrigger(xs1+" "+xs2+"/*"); rmCreateTrigger("*/rule _"+xs1+"End"); rmSetTriggerActive(false); } void main(void) { // ---------------------------------------- Map Info ------------------------------------------- int playerTilesX=13200; //设定地图X大小 int playerTilesZ=13200; //设定地图Z大小(帝国3的Y是高度,Z才是我们平常所用到的Y) //如果玩家大于4将playerTilesX与playerTilesZ改为11500(同一个值的int只能出现1次,当你需要修改数值的时候,不能再加入int) if (cNumberNonGaiaPlayers >4){ playerTilesX=11500; playerTilesZ=11500;} if (cNumberNonGaiaPlayers >6){ playerTilesX=10500; playerTilesZ=10500;} //Modify Map X&Z Size of 6,7,8 Player int SizeX = 2*sqrt(cNumberNonGaiaPlayers*playerTilesX); int SizeZ = 2*sqrt(cNumberNonGaiaPlayers*playerTilesZ); string MapTerrain ="Carolinas\ground_marsh3_car"; //<-------- 地图地形,自己参照剧情编辑器 <-------- string MapLighting ="319a_Snow"; //<-------- 照明,自己参照剧情编辑器 <-------- string PlayerTerrain ="Carolinas\ground_marsh1_car"; //<--------- 玩家范围地形 <--------- //设定地图XZ大小,分别调用上面用int定义的SizeX与SizeZ,即为rmSetMapSize(13200,13200);如果玩家大于4将改为11500 rmSetMapSize(SizeX, SizeZ); rmSetMapElevationParameters(cElevTurbulence, 0.15, 2.5, 0.35, 3.0); // type, frequency, octaves, persistence, variation rmSetMapElevationHeightBlend(1.0); //地形初始化,设定地图初始地形,调用上面用string定义MapTerrain,即为"Carolinas\ground_marsh3_car"; rmTerrainInitialize(MapTerrain,6); //设定照明,调用上面用string定义MapLighting,即为"319a_Snow" rmSetLightingSet(MapLighting); rmSetGlobalRain(0.9); //设定下雨 chooseMercs(); rmSetMapType("yucatan"); rmSetMapType("water"); rmSetMapType("default"); //设定地图类型,地图类型影响到宝藏 rmSetMapType("land"); rmSetMapType("bayou"); rmSetSeaLevel(0); // this is height of river surface compared to surrounding land. River depth is in the river XML. rmSetStatusText("",0.01);//读取地图进度条 rmSetPlacementSection(0.6, 0.00); rmPlacePlayersCircular(0.40, 0.40, 0.0); // rmSetPlayerResource(1, "Food", 200); //玩家范围 float AreaSizePlayer = rmAreaTilesToFraction(700); for(i=1; <=cNumberNonGaiaPlayers) { int id=rmCreateArea("Player"+i); rmSetPlayerArea(i, id); rmSetAreaWarnFailure(id, false); rmSetAreaSize(id, AreaSizePlayer, AreaSizePlayer); rmSetAreaLocPlayer(id, i); rmSetAreaCoherence(id, 0.85); rmSetAreaSmoothDistance(id, 2); rmSetAreaMinBlobs(id, 1); rmSetAreaMaxBlobs(id, 1); rmSetAreaTerrainType(id,PlayerTerrain); rmBuildArea(id); } //定义城镇中心 int TownCenterID = rmCreateObjectDef("player TC"); if (rmGetNomadStart()) { rmAddObjectDefItem(TownCenterID, "CoveredWagon", 1, 0.0); } else { rmAddObjectDefItem(TownCenterID, "TownCenter", 1, 0); } rmSetObjectDefMinDistance(TownCenterID, 0.0); rmSetObjectDefMaxDistance(TownCenterID, 20.0); for(i=1; <=cNumberNonGaiaPlayers) { //放置城镇中心,rmPlaceObjectDefAtLoc第二个值为被放置玩家对象,这里使用了for循环,循环值=1,<=玩家人数,所以会放置所有玩家的城镇中心。 rmPlaceObjectDefAtLoc(TownCenterID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i)); } //定义起始单位(civs.xml定义那些开局单位) int startingUnits = rmCreateStartingUnitsObjectDef(5.0); rmSetObjectDefMinDistance(startingUnits, 6.0); rmSetObjectDefMaxDistance(startingUnits, 10.0); for(i=1; <=cNumberNonGaiaPlayers) { //我暂时只能告诉你这个是调用城镇中心坐标,不解释太多,解释太多你听不懂。另外留意下for(i=1;<=xx){},这是是c++的一种循环格式。 vector TCLocation = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TownCenterID, i)); //放置起始单位 rmPlaceObjectDefAtLoc(startingUnits, i, rmXMetersToFraction(xsVectorGetX(TCLocation)), rmZMetersToFraction(xsVectorGetZ(TCLocation))); } int TestID=rmCreateArea("Test ID Area"); rmSetAreaSize(TestID, rmAreaTilesToFraction(500), rmAreaTilesToFraction(500)); rmSetAreaWaterType(TestID, "Cinematic Ship Ocean"); rmSetAreaWarnFailure(TestID, true); rmSetAreaSmoothDistance(TestID, 0); rmSetAreaCoherence(TestID, 0.0); //rmSetAreaMix(TestID, "himalayas_a");将设定地形类型语句删除,就算是保留也不会再起任何作用了。 rmSetAreaBaseHeight(TestID, 4.0);//地形高度可加,也可以不加,看你自己想怎样设定。 rmSetAreaElevationOctaves(TestID, 3); rmSetAreaObeyWorldCircleConstraint(TestID, false); rmSetAreaLocation(TestID, 0.5, 0.5); rmBuildArea(TestID); rmSetOceanReveal(true); rmSetStatusText("",0.50);//读取地图进度条 rmCreateTrigger("Gold"); rmSwitchToTrigger(rmTriggerID("Gold")); rmSetTriggerPriority(3); rmSetTriggerActive(true); rmSetTriggerRunImmediately(true); rmSetTriggerLoop(false); rmAddTriggerCondition("Timer"); rmSetTriggerConditionParamInt("Param1", 10, false); rmAddTriggerEffect("Grant Resources"); rmSetTriggerEffectParamInt("PlayerID", 1, false); rmSetTriggerEffectParam("ResName", "Gold", false); rmSetTriggerEffectParamInt("Amount", 100, false); rmCreateTrigger("GamestartInit"); rmSwitchToTrigger(rmTriggerID("GamestartInit")); rmSetTriggerRunImmediately(true); aoebbsA("}}"); aoebbs("rule _Resources active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); aoebbs("trPlayerGrantResources(1,\"Gold\",100);"); aoebbs("xsDisableRule(\"_Resources\");"); aoebbsZ("}} /*"); //上面因为注释太乱了,再写一个加100食物、500木材的触发 aoebbs("rule _ResourcesFood active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); aoebbs("trPlayerGrantResources(1,\"Food\",100);"); aoebbs("trPlayerGrantResources(1,\"Wood\",500);"); aoebbs("xsDisableRule(\"_ResourcesFood\");"); aoebbsZ("}} /*"); aoebbs("rule _Temp inactive { if(true){"); aoebbsZ("xsDisableSelf();"); rmCreateTrigger("AddGold active runImmediately{if((trTime()-cActivationTime)>=10){trPlayerGrantResources"+"(1,\"Gold\",100);xsDisableSelf();xsDisableRule(\"_AddGoldEnd\");}}/*"); rmCreateTrigger("*/rule _AddGoldEnd"); rmSetStatusText("",1.00);//读取地图进度条 } //END
include "mercenaries.xs"; include "ypAsianInclude.xs"; include "ypKOTHInclude.xs"; //定义顶部函数 void aoebbs(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" /* "); } void aoebbsA(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsE(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+"/* trSetUnitIdleProcessing(true"); } void aoebbsZ(string xs="") { rmAddTriggerEffect("SetIdleProcessing"); rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true"); } void aoebbsR(string xs1="",string xs2="") { rmCreateTrigger(xs1+" "+xs2+"/*"); rmCreateTrigger("*/rule _"+xs1+"End"); rmSetTriggerActive(false); } void main(void) { // ---------------------------------------- Map Info ------------------------------------------- int playerTilesX=13200; //设定地图X大小 int playerTilesZ=13200; //设定地图Z大小(帝国3的Y是高度,Z才是我们平常所用到的Y) //如果玩家大于4将playerTilesX与playerTilesZ改为11500(同一个值的int只能出现1次,当你需要修改数值的时候,不能再加入int) if (cNumberNonGaiaPlayers >4){ playerTilesX=11500; playerTilesZ=11500;} if (cNumberNonGaiaPlayers >6){ playerTilesX=10500; playerTilesZ=10500;} //Modify Map X&Z Size of 6,7,8 Player int SizeX = 2*sqrt(cNumberNonGaiaPlayers*playerTilesX); int SizeZ = 2*sqrt(cNumberNonGaiaPlayers*playerTilesZ); string MapTerrain ="Carolinas\ground_marsh3_car"; //<-------- 地图地形,自己参照剧情编辑器 <-------- string MapLighting ="319a_Snow"; //<-------- 照明,自己参照剧情编辑器 <-------- string PlayerTerrain ="Carolinas\ground_marsh1_car"; //<--------- 玩家范围地形 <--------- //设定地图XZ大小,分别调用上面用int定义的SizeX与SizeZ,即为rmSetMapSize(13200,13200);如果玩家大于4将改为11500 rmSetMapSize(SizeX, SizeZ); rmSetMapElevationParameters(cElevTurbulence, 0.15, 2.5, 0.35, 3.0); // type, frequency, octaves, persistence, variation rmSetMapElevationHeightBlend(1.0); //地形初始化,设定地图初始地形,调用上面用string定义MapTerrain,即为"Carolinas\ground_marsh3_car"; rmTerrainInitialize(MapTerrain,6); //设定照明,调用上面用string定义MapLighting,即为"319a_Snow" rmSetLightingSet(MapLighting); rmSetGlobalRain(0.9); //设定下雨 chooseMercs(); rmSetMapType("yucatan"); rmSetMapType("water"); rmSetMapType("default"); //设定地图类型,地图类型影响到宝藏 rmSetMapType("land"); rmSetMapType("bayou"); rmSetSeaLevel(0); // this is height of river surface compared to surrounding land. River depth is in the river XML. rmSetStatusText("",0.01);//读取地图进度条 rmSetPlacementSection(0.6, 0.00); rmPlacePlayersCircular(0.40, 0.40, 0.0); // rmSetPlayerResource(1, "Food", 200); //玩家范围 float AreaSizePlayer = rmAreaTilesToFraction(700); for(i=1; <=cNumberNonGaiaPlayers) { int id=rmCreateArea("Player"+i); rmSetPlayerArea(i, id); rmSetAreaWarnFailure(id, false); rmSetAreaSize(id, AreaSizePlayer, AreaSizePlayer); rmSetAreaLocPlayer(id, i); rmSetAreaCoherence(id, 0.85); rmSetAreaSmoothDistance(id, 2); rmSetAreaMinBlobs(id, 1); rmSetAreaMaxBlobs(id, 1); rmSetAreaTerrainType(id,PlayerTerrain); rmBuildArea(id); } //定义城镇中心 int TownCenterID = rmCreateObjectDef("player TC"); if (rmGetNomadStart()) { rmAddObjectDefItem(TownCenterID, "CoveredWagon", 1, 0.0); } else { rmAddObjectDefItem(TownCenterID, "TownCenter", 1, 0); } rmSetObjectDefMinDistance(TownCenterID, 0.0); rmSetObjectDefMaxDistance(TownCenterID, 20.0); for(i=1; <=cNumberNonGaiaPlayers) { //放置城镇中心,rmPlaceObjectDefAtLoc第二个值为被放置玩家对象,这里使用了for循环,循环值=1,<=玩家人数,所以会放置所有玩家的城镇中心。 rmPlaceObjectDefAtLoc(TownCenterID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i)); } //定义起始单位(civs.xml定义那些开局单位) int startingUnits = rmCreateStartingUnitsObjectDef(5.0); rmSetObjectDefMinDistance(startingUnits, 6.0); rmSetObjectDefMaxDistance(startingUnits, 10.0); for(i=1; <=cNumberNonGaiaPlayers) { //我暂时只能告诉你这个是调用城镇中心坐标,不解释太多,解释太多你听不懂。另外留意下for(i=1;<=xx){},这是是c++的一种循环格式。 vector TCLocation = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TownCenterID, i)); //放置起始单位 rmPlaceObjectDefAtLoc(startingUnits, i, rmXMetersToFraction(xsVectorGetX(TCLocation)), rmZMetersToFraction(xsVectorGetZ(TCLocation))); } int TestID=rmCreateArea("Test ID Area"); rmSetAreaSize(TestID, rmAreaTilesToFraction(500), rmAreaTilesToFraction(500)); rmSetAreaWaterType(TestID, "Cinematic Ship Ocean"); rmSetAreaWarnFailure(TestID, true); rmSetAreaSmoothDistance(TestID, 0); rmSetAreaCoherence(TestID, 0.0); //rmSetAreaMix(TestID, "himalayas_a");将设定地形类型语句删除,就算是保留也不会再起任何作用了。 rmSetAreaBaseHeight(TestID, 4.0);//地形高度可加,也可以不加,看你自己想怎样设定。 rmSetAreaElevationOctaves(TestID, 3); rmSetAreaObeyWorldCircleConstraint(TestID, false); rmSetAreaLocation(TestID, 0.5, 0.5); rmBuildArea(TestID); rmSetOceanReveal(true); rmSetStatusText("",0.50);//读取地图进度条 //循环方法1,循环所有语句,创建cNumberNonGaiaPlayers个触发: for(i=1; <=cNumberNonGaiaPlayers) { rmCreateTrigger("Gold"+i); //为什么要加循环值i呢?因为不能出现两个相同名称的触发,否则会全体触发失效。 rmSwitchToTrigger(rmTriggerID("Gold"+i)); rmSetTriggerPriority(3); rmSetTriggerActive(true); rmSetTriggerRunImmediately(true); rmSetTriggerLoop(false); rmAddTriggerCondition("Timer"); rmSetTriggerConditionParamInt("Param1", 10, false); rmAddTriggerEffect("Grant Resources"); rmSetTriggerEffectParamInt("PlayerID", i, false); rmSetTriggerEffectParam("ResName", "Gold", false); rmSetTriggerEffectParamInt("Amount", 100, false); } //循环方法2,仅循环效果语句: rmCreateTrigger("AllPlayerGold"); rmSwitchToTrigger(rmTriggerID("AllPlayerGold")); rmSetTriggerPriority(3); rmSetTriggerActive(true); rmSetTriggerRunImmediately(true); rmSetTriggerLoop(false); rmAddTriggerCondition("Timer"); rmSetTriggerConditionParamInt("Param1", 10, false); for(i=1; <=cNumberNonGaiaPlayers) { rmAddTriggerEffect("Grant Resources"); rmSetTriggerEffectParamInt("PlayerID", i, false); rmSetTriggerEffectParam("ResName", "Gold", false); rmSetTriggerEffectParamInt("Amount", 100, false); } rmCreateTrigger("GamestartInit"); rmSwitchToTrigger(rmTriggerID("GamestartInit")); rmSetTriggerRunImmediately(true); aoebbsA("}}"); //循环方法1,RM层循环所有语句,创建cNumberNonGaiaPlayers个触发: //为什么是"+i+"?因为我们是在地图语句循环的,属于RM层,不属于TR触发层;所以引号内的语句要用"+i+",意思是"左边的xxx"加上循环值i再加上"右边的xxxx"。 //第一句双引号加了颜色,这样你应该看的懂是怎样一回事。 for(i=1; <=cNumberNonGaiaPlayers) { aoebbs("rule _Resources"+i+" active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); aoebbs("trPlayerGrantResources("+i+",\"Gold\",100);"); aoebbs("xsDisableRule(\"_Resources"+i+"\");"); aoebbsZ("}} /*"); } //关闭本身也要加上"+i+",不然就没法正常关闭,直接变成执行无限次的循环触发了,或者你可以直接使用xsDisableSelf();//循环方法2,RM层循仅环函数语句(会在地图生成cNumberNonGaiaPlayers个语句):
aoebbs("rule _ResourcesFood active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); for(i=1; <=cNumberNonGaiaPlayers) { aoebbs("trPlayerGrantResources("+i+",\"Food\",100);"); aoebbs("trPlayerGrantResources("+i+",\"Wood\",500);"); } aoebbs("xsDisableRule(\"_ResourcesFood\");"); aoebbsZ("}} /*");//循环方法3,TR层循仅环函数语句(输出语句与下面一样,到了执行触发,再循环):
aoebbs("rule _AddResources active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 10.00000000){"); aoebbs("for(i=1; <="+cNumberNonGaiaPlayers+")"); aoebbs("{"); aoebbs("trPlayerGrantResources(i,\"Food\",100);"); //TR层的循环直接填i就行 aoebbs("trPlayerGrantResources(i,\"Wood\",500);"); aoebbs("}"); aoebbs("xsDisableRule(\"_AddResources\");"); aoebbsZ("}} /*"); //注:cNumberNonGaiaPlayers无法在TR层使用,要加上"++"使它变成RM层数据。另一个计算玩家数量的变量cNumberPlayers可以在TR层使用。 //再加一个将玩家资源信息发送到聊天的触发 //发送聊天信息的是trChatSendSpoofed(fromID message): Changes the chat status, but does not append player. //trChatSendSpoofed(0,\"\");(0就是大自然) //返回玩家资源语句为trPlayerResourceCount(playerID, resource): returns the number of resources for the player. //trPlayerResourceCount(playerID, \"\") //发送聊天触发11秒后再执行(因为触发是按顺序执行的,如果是十秒就先执行这个,再执行下面的触发 aoebbs("rule _SendChat active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 11.00000000){");) for(i=1; <=cNumberNonGaiaPlayers) { aoebbs("trChatSendSpoofed(0,\"Player"+i+" <color=0,1,0>Food:\"+trPlayerResourceCount("+i+", \"Food\"));"); aoebbs("trChatSendSpoofed(0,\"Player"+i+" <color=0,1,1>Wood:\"+trPlayerResourceCount("+i+", \"Wood\"));"); aoebbs("trChatSendSpoofed(0,\"Player"+i+" <color=0.25,1,0.25>Gold:\"+trPlayerResourceCount("+i+", \"Gold\"));"); } aoebbs("xsDisableRule(\"_SendChat\");"); aoebbsZ("}} /*"); //有时候你设定随机数或者不明白RM函数设定的值(坐标、vector坐标那些)是什么,可以用这种触发返回那个值,用trChatSendSpoofed(0,\""+此处写上int定义之类的+"\");发送到聊天窗口。 //怎么一会用"+ +",一会儿不用?已经说了RM层语句与TR层语句不通用,TR层调用RM层数值要用"+ +"。 //<color=0,1,0>那几个是改变本次聊天字体颜色。 aoebbs("rule _Temp inactive { if(true){"); aoebbsZ("xsDisableSelf();");//循环方法1,RM层循环所有语句,创建cNumberNonGaiaPlayers个触发:
for(i=1; <=cNumberNonGaiaPlayers) { rmCreateTrigger("AddGold"+i+" active runImmediately{if((trTime()-cActivationTime)>=10){trPlayerGrantResources("+i+",\"Gold\",100);xsDisableSelf();xsDisableRule(\"_AddGoldEnd"+i+"\");}}/*"); rmCreateTrigger("*/rule _AddGoldEnd"+i+""); }//循环方法2,TR层循仅环函数语句(输出语句与下面一样,到了执行触发,再循环):
rmCreateTrigger("AddGold active runImmediately{if((trTime()-cActivationTime)>=10){for(i=1;<cNumberPlayers){trPlayerGrantResources"+"(i,\"Gold\",100);}xsDisableSelf();xsDisableRule(\"_AddGoldEnd\");}}/*"); rmCreateTrigger("*/rule _AddGoldEnd"); //上面已经说过了cNumberNonGaiaPlayers不能在TR层使用,所以用cNumberPlayers代替,但是我还是推荐使用"+cNumberNonGaiaPlayers+",为什么呢?rmCreateTrigger注入代码只能输出255个字符,"+cNumberNonGaiaPlayers+"从RM转成数字后会变成只有一个字符(游戏最多能有8人),所以比cNumberPlayers节省了14个字符。 rmSetStatusText("",1.00);//读取地图进度条 } //END
补充<color=0,1,0>颜色值参考帝国3RGB 统计上面一共加了多少资源? 旧版本触发 :所有玩家+100金 *2个 rmSetTriggerEffect注入代码 :所有玩家+100金 *1个;所有玩家+100食物+500木材 *2个 rmCreateTrigger注入代码 :所有玩家+100金 *2个 合计:![]()
最后补充:有不懂语句是什么作用的,可以去查看XS、KB、TR函数表搜索函数 触发程序不仅可以使用TR函数,还可以使用XS、KB以及一小部分UI函数。 使用KB函数注意事项,使用KB函数必须加上xsSetContextPlayer来设定KB函数的对象玩家。 [(void )] xsSetContextPlayer( int playerID ): Sets the current context player ID (DO NOT DO THIS IF YOU DO NOT KNOW WHAT YOU ARE DOING). [(float )] kbTotalResourceGet( int resourceID ): Returns the total amount of the given resource gathered to this point in the game. 例如获取玩家1采集了多少食物(食物的resourceID为2):xsSetContextPlayer(1);kbTotalResourceGet(2); 获取所有玩家采集了多少食物for(i=1;<cNumberPlayers){xsSetContextPlayer(i);{kbTotalResourceGet(2);} 获取这些值有什么用呢?如下 用if判断玩家食物是否大于100 for(i=1;<cNumberPlayers) { xsSetContextPlayer(i); if(kbTotalResourceGet(2)>100) { } } 个人推荐使用第一种注入式触发程序`rmSetTriggerEffect`,因为这种触发方便,也能自定义,还能写出非常复杂的触发。 第二种可以在中文路径使用的注入式触发程序`rmCreateTrigger`适用小批量触发程序,你自己也懂的,在天朝每10个人就有7个人安装路径存在中文字符,小批量能用这种触发程序就用这种。 为了避免因为中文路径导致的不同步现象,可以这样设定: 以下语句为开局踢出中文路径玩家: /* It can't use in Chinese path .*/ rmCreateTrigger("GameStart"); rmSetTriggerRunImmediately(true); rmSetTriggerPriority(5); rmSetTriggerEffectParam("IdleProc","true);trQuestVarSet(\"Path\",1);xsDisableSelf();}}/*"); aoebbs("rule _GameStartEND inactive { if(true){"); aoebbsZ("xsDisableSelf();"); /*the next Trigger will kick "Chinese Path Player" out of the game.*/ rmCreateTrigger("Path active runImmediately{if(trQuestVarGet(\"Path\")!=1){"+"showSPCNote(\"Error!\",\"<color=0,1,0>Use-the-English-path-to-install-the-Age-of-Empires-III,please.\");"+"uiMessageBox2(20948);trEndGame();trYouWin(true);xsDisableRule(\"_Path\");}}/*"); rmSetTriggerActive(false); rmSetTriggerPriority(5); rmCreateTrigger("*/rule _PathEnd"); rmSetTriggerActive(false); 这效果是怎样达成的呢? 已知帝国3安装目录存在中文路径所有触发程序将会失效,那么我们就用官方版本的触发程序用Quest Var Set设定一个值,设定那个值为1。而中文路径的帝国3因为触发程序失效,那个值就不为1,然后我们可以利用rmCreateTrigger注入代码,由于rmCreateTrigger注入代码后不受中文路径影响,可以获取那个值,不等于1就执行效果trEndGame();结束游戏,trYouWin(true);自己离开游戏(出局)。有一点要说明的是不是用触发设定那个玩家出局,而是让那个玩家自己离开游戏才不会导致出现问题。 最终,中文路径玩家会显示:你觉得单位ID是怎样导出的?
string kbGetUnitTypeName( int unitTypeID ): Returns the name of the unit type.
string kbGetUnitTypeName( int unitTypeID ):获取此单位类型 ID 对应的名称。
trChatSend(fromID, message) : Changes the chat status.
trChatSend(fromID, message) :发送聊天消息,改变聊天状态。
地图里面怎么用汉字aoebbs("rule _Debug29 active runImmediately { "); aoebbs("if((trTime()-cActivationTime) == 1.00000000){"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>\"+kbGetUnitTypeName(0));"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>\"+kbGetUnitTypeName(1));"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>\"+kbGetUnitTypeName(2));"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>\"+kbGetUnitTypeName(1463));"); aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>\"+kbGetUnitTypeName(1464));"); aoebbs("xsDisableRule(\"_Debug29\");"); aoebbsZ("}} /*");![]()
aoebbs("rule _Unittype active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); for(u=1; <1800) { aoebbs("trChatSendSpoofed(0,\"<color=0,1,1>"+u+":\");"); } aoebbs("xsDisableRule(\"_Unittype\");"); aoebbsZ("}} /*");整合两个触发
aoebbs("rule _Unittype2 active runImmediately { "); aoebbs("if((trTime()-cActivationTime) >= 1.00000000){"); for(u=1463; <1800) { aoebbs("trChatSend(0,\"<color=0,1,1>"+u+" \"+kbGetUnitTypeName("+u+"));"); } aoebbs("xsDisableRule(\"_Unittype2\");"); aoebbsZ("}} /*");![]()
rmCreateTrigger("Message2 active runImmediately{"+"trChatSendSpoofed(0,\"{68440}\");trChatSendSpoofed(0,\"<color=0,1,0>If you don't have the WarChiefs"+" Content, please press the Alt + F4 key.\");xsDisableSelf();}/*");
rmCreateTrigger("*/rule _Message2End");
aoebbs("rule _Debug71 minInterval 2 active runImmediately {");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("int UnitTypeID = 0;");
aoebbs("while(kbGetUnitTypeName(UnitTypeID)!=\"unit\"){");
aoebbs("UnitTypeID = UnitTypeID+1;");
aoebbs("}");
aoebbs("xsSetContextPlayer(1);");
aoebbs("trChatSend(0,\"UnitTypeID:\"+UnitTypeID+\":\"+kbGetUnitTypeName(UnitTypeID));");
aoebbs("int queryID = kbUnitQueryCreate(\"QueryAliveUnit\");");
aoebbs("trChatSend(0,\"queryID:\"+queryID);");
aoebbs("kbUnitQueryResetData(queryID);");
aoebbs("kbUnitQueryResetResults(queryID);");
aoebbs("kbUnitQuerySetUnitType(queryID,UnitTypeID);");
aoebbs("kbUnitQuerySetState(queryID, cUnitStateAlive);");
aoebbs("kbUnitQuerySetAscendingSort(queryID,true);");
aoebbs("kbUnitQuerySetPlayerID(queryID, 1,false);");
aoebbs("int resultCount = kbUnitQueryExecute(queryID);");
aoebbs("resultCount = kbUnitQueryNumberResults(queryID);");
aoebbs("trChatSend(0,\"resultCount:\"+resultCount);");
aoebbs("int unitID = 0;");
aoebbs("for(i=0;<resultCount) {");
aoebbs("unitID = kbUnitQueryGetResult(queryID,i);");
aoebbs("trChatSend(0,\"unitID[\"+unitID+\"]:\"+kbGetProtoUnitName(kbUnitGetProtoUnitID(unitID)));");
aoebbs("}");
aoebbs("xsDisableSelf();");
aoebbs("}");
aoebbs("}");
aoebbsE("");





还原后的源代码(可以自行使用转换器转换地图触发程序转换器):
rule _Debug71 minInterval 2 active runImmediately {
if((trTime()-cActivationTime) >= 5.00000000){
int UnitTypeID = 0;
while(kbGetUnitTypeName(UnitTypeID)!="unit"){
UnitTypeID = UnitTypeID+1;
}
xsSetContextPlayer(1);
trChatSend(0,"UnitTypeID:"+UnitTypeID+":"+kbGetUnitTypeName(UnitTypeID));
int queryID = kbUnitQueryCreate("QueryAliveUnit");
trChatSend(0,"queryID:"+queryID);
kbUnitQueryResetData(queryID);
kbUnitQueryResetResults(queryID);
kbUnitQuerySetUnitType(queryID,UnitTypeID);
kbUnitQuerySetState(queryID, cUnitStateAlive);
kbUnitQuerySetAscendingSort(queryID,true);
kbUnitQuerySetPlayerID(queryID, 1,false);
int resultCount = kbUnitQueryExecute(queryID);
resultCount = kbUnitQueryNumberResults(queryID);
trChatSend(0,"resultCount:"+resultCount);
int unitID = 0;
for(i=0;<resultCount) {
unitID = kbUnitQueryGetResult(queryID,i);
trChatSend(0,"unitID["+unitID+"]:"+kbGetProtoUnitName(kbUnitGetProtoUnitID(unitID)));
}
xsDisableSelf();
}
}
aoebbs("rule _Debug431 active runImmediately {");
aoebbs("float UnitTypeID = 0;");
aoebbs("while(kbGetUnitTypeName(UnitTypeID) != \"AbstractInfantry\") {");
aoebbs("UnitTypeID = UnitTypeID+1;");
aoebbs("}");
aoebbs("for(i=1;<=cNumberPlayers) {");
aoebbs("float UnitID = 0;");
aoebbs("xsSetContextPlayer(i);");
aoebbs("while(kbGetUnitTypeName(UnitID) !=\"Unit\") {");
aoebbs("if(kbProtoUnitIsType(i,UnitID,UnitTypeID)) {");
aoebbs("trModifyProtounit(kbGetProtoUnitName(UnitID), i, 0, 1000.0);");
aoebbs("}");
aoebbs("UnitID = UnitID +1;");
aoebbs("}");
aoebbs("}");
aoebbs("xsDisableSelf();");
aoebbs("}");
aoebbsE("");
原代码:
rule _Debug431 active runImmediately {
float UnitTypeID = 0;
while(kbGetUnitTypeName(UnitTypeID) != "AbstractInfantry") {
UnitTypeID = UnitTypeID+1;
}
for(i=1;<=cNumberPlayers) {
float UnitID = 0;
xsSetContextPlayer(i);
while(kbGetUnitTypeName(UnitID) !="Unit") {
if(kbProtoUnitIsType(i,UnitID,UnitTypeID)) {
trModifyProtounit(kbGetProtoUnitName(UnitID), i, 0, 1000.0);
}
UnitID = UnitID +1;
}
}
xsDisableSelf();
}
//注释版:
rule _Debug431 active runImmediately {
// 定义浮点数UnitTypeID初始值为0;
float UnitTypeID = 0;
//循环查找某个单位类型,直到找到名字为 "AbstractInfantry"(kbGetUnitTypeName(UnitTypeID)返回UnitTypeName,若不为AbstractInfantry,UnitTypeID+1)
while(kbGetUnitTypeName(UnitTypeID) != "AbstractInfantry") {
UnitTypeID = UnitTypeID+1;
}
// 遍历所有玩家
for(i=1;<=cNumberPlayers) {
// 定义浮点数UnitID初始值为0;
float UnitID = 0;
//kb函数对象玩家,用于无对象的kb函数指定对象玩家,找bug找怕了,凡是kb函数,不管其是否有对象,一律使用xsSetContextPlayer
xsSetContextPlayer(i);
// 循环查找某个单位类型,直到找到名字为 "Unit",其作用为以第一个unittype作为断点遍历所有单位(已知protoy.xml最后一个单位ID+1的ID为Unit,因此Unit常用于作断点)
while(kbGetUnitTypeName(UnitID) !="Unit") {
// 判断当前玩家的当前的protoy单位是否拥有指定类型 (AbstractInfantry)
if(kbProtoUnitIsType(i,UnitID,UnitTypeID)) {
// 当前玩家,当前单位的生命值增加1000。
trModifyProtounit(kbGetProtoUnitName(UnitID), i, 0, 1000.0);
}
UnitID = UnitID +1;
}
}
xsDisableSelf();
}
trModifyProtounit请参考Modify Protounit
include "mercenaries.xs"; // ensure extras
void aoebbs(string xs="") {
rmAddTriggerEffect("SetIdleProcessing");
rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" /* ");
}
void aoebbsA(string xs="") {
rmAddTriggerEffect("SetIdleProcessing");
rmSetTriggerEffectParam("IdleProc", "true); "+xs+"/* trSetUnitIdleProcessing(true");
}
void aoebbsZ(string xs="") {
rmAddTriggerEffect("SetIdleProcessing");
rmSetTriggerEffectParam("IdleProc", "true); */ "+xs+" trSetUnitIdleProcessing(true");
}
void main(void)
{
rmSetMapSize((2*sqrt(cNumberNonGaiaPlayers*12000)), (2*sqrt(cNumberNonGaiaPlayers*12000)));
rmSetMapElevationParameters(cElevTurbulence, 0, 0, 0, 0);
rmSetMapElevationHeightBlend(1.0);
rmTerrainInitialize("caribbean\ground7_crb",6);
rmSetMapType("caribbean");
rmSetMapType("water");
rmSetMapType("default");
rmSetMapType("water");
rmSetMapType("land");
rmSetLightingSet("319a_Snow");
rmSetSeaLevel(6);
rmSetStatusText("",0.10);
chooseMercs();
int PlayerClass=rmDefineClass("Player");
int LakeClass= rmDefineClass("Lakes");
int CliffClass= rmDefineClass("Cliffs");
rmDefineClass("ExplorerUnit");
rmDefineClass("MainForest");
rmDefineClass("MainItems");
rmDefineClass("Nativ");
int CWvsCW=rmCreateTypeDistanceConstraint("CWTOCW", "CoveredWagon", 30.0);
int FOvsTC=rmCreateTypeDistanceConstraint("FOTOTC", "TownCenter", 20.0);
//Tree=单位调用名--鹿,创建规则放置时,间隔Deer类型单位30距离。
int AvoidDeer = rmCreateTypeDistanceConstraint("Deer Distance", "Deer", 30.0);
rmSetStatusText("",0.20);
float Breite0 = 3.0;
int seaI = rmRiverCreate(-1, "Coastal Japan", 1, 1, Breite0, Breite0);
rmRiverAddWaypoint(seaI, 0.70, 0.40 );
rmRiverAddWaypoint(seaI, 0.70, 0.30 );
rmRiverAddWaypoint(seaI, 0.80, 0.20 );
rmRiverSetBankNoiseParams(seaI,0.00, 0, 0.0, 0.0, 0.0, 0.0);
rmRiverBuild(seaI);
rmAddAreaToClass(seaI,rmClassID("Sea"));
rmPlacePlayersCircular(0.35, 0.35, 0.0);
int IDRiver = rmRiverCreate(-1, "Great Lakes", 1, 1, 10.0, 10.0);
rmRiverAddWaypoint(IDRiver, 0.70, 0.30 );
rmRiverAddWaypoint(IDRiver, 0.85, 0.30 );
rmRiverAddWaypoint(IDRiver, 0.80, 0.30 );
rmRiverAddWaypoint(IDRiver, 0.80, 0.35 );
rmRiverAddWaypoint(IDRiver, 0.80, 0.25 );
rmRiverAddShallow(IDRiver,1.00);
rmRiverAddShallows(IDRiver,10.00,8);
rmRiverSetBankNoiseParams(IDRiver,0.00, 0, 0.0, 0.0, 0.0, 0.0);
rmRiverBuild(IDRiver);
int DestroyID=rmCreateArea("Destroy ID Area");
rmSetAreaSize(DestroyID, 0.10, 0.10);
rmSetAreaLocation(DestroyID, .5, .5);
rmSetAreaWarnFailure(DestroyID, true);
rmSetAreaSmoothDistance(DestroyID, 50);
rmSetAreaCoherence(DestroyID, 1.0);
rmSetAreaMix(DestroyID, "himalayas_a");
rmSetAreaElevationType(DestroyID, cElevFractalSum);
rmSetAreaElevationVariation(DestroyID, 4.0);
rmSetAreaBaseHeight(DestroyID, 4.0);
rmSetAreaElevationOctaves(DestroyID, 3);
rmSetAreaObeyWorldCircleConstraint(DestroyID, false);
rmBuildArea(DestroyID);
// ****************************************** TRADE ROUTE **********************************************
int tradeRouteID = rmCreateTradeRoute();
int socketID=rmCreateObjectDef("sockets to dock Trade Posts");
rmAddObjectDefItem(socketID, "SocketTradeRoute", 1, 0.0);
rmSetObjectDefAllowOverlap(socketID, true);
rmSetObjectDefMinDistance(socketID, 0.0);
rmSetObjectDefMaxDistance(socketID, 6.0);
int tpvariation = rmRandInt(0,1);
float socket01 = 0.10;
float socket02 = 0.28;
float socket03 = 0.43;
float socket04 = 0.69;
float socket05 = 0.90;
float socketB01 = 0.10;
float socketB02 = 0.28;
float socketB03 = 0.41;
float socketB04 = 0.69;
float socketC01 = 0.10;
float socketC02 = 0.43;
float socketC03 = 0.69;
int socketcount = rmRandInt(rmRandInt(3,4),5);
if (tpvariation > 0.5)
{ //South Start
rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
rmAddTradeRouteWaypoint(tradeRouteID, 0.00, 0.52);
rmAddTradeRouteWaypoint(tradeRouteID, 0.20, 0.51);
rmAddTradeRouteWaypoint(tradeRouteID, 0.40, 0.40);
rmAddTradeRouteWaypoint(tradeRouteID, 0.55, 0.45);
rmAddTradeRouteWaypoint(tradeRouteID, 0.68, 0.68);
rmAddTradeRouteWaypoint(tradeRouteID, 0.80, 0.65);
rmAddTradeRouteWaypoint(tradeRouteID, 1.00, 0.50);
socket01 = 0.10;
socket02 = 0.28;
socket03 = 0.45;
socket05 = 0.92;
socketB01 = 0.15;
socketB02 = 0.29;
socketB03 = 0.55;
socketB04 = 0.75;
socketC01 = 0.20;
socketC02 = 0.43;
socketC03 = 0.69;
}
else
{ //North Start
rmSetObjectDefTradeRouteID(socketID, tradeRouteID);
rmAddTradeRouteWaypoint(tradeRouteID, 1.00, 0.50);
rmAddTradeRouteWaypoint(tradeRouteID, 0.80, 0.65);
rmAddTradeRouteWaypoint(tradeRouteID, 0.68, 0.68);
rmAddTradeRouteWaypoint(tradeRouteID, 0.55, 0.45);
rmAddTradeRouteWaypoint(tradeRouteID, 0.40, 0.40);
rmAddTradeRouteWaypoint(tradeRouteID, 0.20, 0.51);
rmAddTradeRouteWaypoint(tradeRouteID, 0.00, 0.52);
socket01 = 0.08;
socket02 = 0.22;
socket03 = 0.55;
socket05 = 0.90;
socketB01 = 0.22;
socketB02 = 0.44;
socketB03 = 0.69;
socketB04 = 0.90;
socketC01 = 0.22;
socketC02 = 0.55;
socketC03 = 0.80;
}
bool placedTradeRouteA = rmBuildTradeRoute(tradeRouteID, "snow");
vector socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, 0.00);
if (socketcount == 3)
{
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC01);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC02);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketC03);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
}
if (socketcount == 4)
{
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB01);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB02);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB03);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socketB04);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
}
if (socketcount == 5)
{
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socket01);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socket02);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socket03);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socket04);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
socketLoc = rmGetTradeRouteWayPoint(tradeRouteID, socket05);
rmPlaceObjectDefAtPoint(socketID, 0, socketLoc);
}
// *************************************************************************************************************
int TreeID= rmCreateObjectDef("Create TreeNewEnglandSnow");
rmAddObjectDefItem(TreeID, "TreeNewEnglandSnow", 10, 20.0);
rmSetObjectDefMinDistance(TreeID, 0.0);
rmSetObjectDefMaxDistance(TreeID, 12);
rmPlaceObjectDefAtLoc(TreeID, 0, 0.5, 0.5,10);
int SPCFixedGunID= rmCreateObjectDef("FixedGun");
rmAddObjectDefItem(SPCFixedGunID, "SPCFixedGun", 1, 6.0);
rmSetObjectDefMinDistance(SPCFixedGunID, 0.0);
rmSetObjectDefMaxDistance(SPCFixedGunID, 16);
rmPlaceObjectDefAtLoc(SPCFixedGunID, 0, 0.2, 0.2,1);
int SPCFixedGun2ID= rmCreateObjectDef("FixedGun2");
rmAddObjectDefItem(SPCFixedGun2ID, "SPCFixedGun", 1, 6.0);
rmSetObjectDefMinDistance(SPCFixedGun2ID, 0.0);
rmSetObjectDefMaxDistance(SPCFixedGun2ID, 16);
rmPlaceObjectDefAtLoc(SPCFixedGun2ID, 0, 0.8, 0.8,1);
int DeerID= -1;
for(d=1;<=5)
{
DeerID= rmCreateObjectDef("Deer"+d);
rmAddObjectDefItem(DeerID, "Deer", 20, 12.0);
rmSetObjectDefMinDistance(DeerID, 0.0);
//rmXFractionToMeters(1.0)=全图
rmSetObjectDefMaxDistance(DeerID, rmXFractionToMeters(1.0));
//往上面搜索AvoidDeer,这个是定义放置规则,例如间隔距离
rmAddObjectDefConstraint(DeerID, AvoidDeer);
rmPlaceObjectDefAtLoc(DeerID, 0, 0.5, 0.5,1);
}
int ExplorerID= rmCreateObjectDef("Explorer");
rmAddObjectDefItem(ExplorerID, "Explorer", 1, 6.0);
rmAddObjectDefItem(ExplorerID, "OutlawMusketeer", 8, 6.0);
rmSetObjectDefMinDistance(ExplorerID, 0.0);
rmSetObjectDefMaxDistance(ExplorerID, 16);
rmPlaceObjectDefAtLoc(ExplorerID, 0, 0.5, 0.5,1);
rmSetStatusText("",0.30);
float AreaSizePlayer = rmAreaTilesToFraction(700);
for(i=1; <cNumberPlayers)
{
int id=rmCreateArea("Player"+i);
rmSetPlayerArea(i, id);
rmSetAreaWarnFailure(id, false);
rmSetAreaSize(id, AreaSizePlayer, AreaSizePlayer);
rmAddAreaToClass(id, PlayerClass);
rmSetAreaLocPlayer(id, i);
rmSetAreaCoherence(id, 0.05);
rmSetAreaMinBlobs(id, 1);
rmSetAreaMaxBlobs(id, 1);
rmSetAreaTerrainType(id,"caribbean\ground7_crb");
rmBuildArea(id);
}
rmSetStatusText("",0.35);
int TCID = rmCreateObjectDef("player TC");
rmAddObjectDefItem(TCID, "TownCenter", 1, 0);
rmAddObjectDefItem(TCID, "CoveredWagon", 1, 10);
rmAddObjectDefItem(TCID, "CrateofWheatBundleLarge", 4, 7);
rmAddObjectDefItem(TCID, "CrateofWoodLarge", 4, 9);
rmAddObjectDefItem(TCID, "CrateofCoinLarge", 4, 12);
rmAddObjectDefItem(TCID, "CrateofFoodLarge", 4, 15);
rmAddObjectDefItem(TCID, "Plantation", 1, 50);
rmAddObjectDefItem(TCID, "Settler", 11, 16);
rmAddObjectDefItem(TCID, "Market", 1, 30);
rmSetObjectDefMinDistance(TCID, 0.0);
rmSetObjectDefMaxDistance(TCID, 20.0);
for(i=1; <cNumberPlayers)
{
rmPlaceObjectDefAtLoc(TCID, i, rmPlayerLocXFraction(i), rmPlayerLocZFraction(i));
}
int ExplorerUnits = rmCreateStartingUnitsObjectDef(5.0);
rmSetObjectDefMinDistance(ExplorerUnits, 6.0);
rmSetObjectDefMaxDistance(ExplorerUnits, 10.0);
rmSetStatusText("",0.70);
for(i=1; <cNumberPlayers)
{
vector TCLocation = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TCID, i));
vector closestPoint = rmFindClosestPointVector(TCLocation, rmXFractionToMeters(1.0));
rmPlaceObjectDefAtLoc(ExplorerUnits, i, rmXMetersToFraction(xsVectorGetX(TCLocation)), rmZMetersToFraction(xsVectorGetZ(TCLocation)));
}
for(i=1; <cNumberPlayers)
{
TCLocation = rmGetUnitPosition(rmGetUnitPlacedOfPlayer(TCID, i));
closestPoint = rmFindClosestPointVector(TCLocation, rmXFractionToMeters(1.0));
}
rmClearClosestPointConstraints();
rmSetStatusText("",0.80);
rmSetStatusText("",0.90);
// Text
rmSetStatusText("",0.25);
// Text
rmSetStatusText("",0.35);
// ********************************************** Define ***********************************************
rmCreateTrigger("xiaoyu");
rmSwitchToTrigger(rmTriggerID("xiaoyu"));
rmSetTriggerRunImmediately(true);
aoebbsA("}}");
// //是注释,在下一行换行符之前的内容都是无效的。
/*这种也是注释,中间的内容无效*/
//""一对非转义引号内字符最长只能为125个,好像是127,我记不清了,你自己注意点
/*
//aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000:<color=0,255,0>\");");
上面的因为字符长度过长,导致无法打开地图。
解决方法如下:多加一队引号(下面的"+")
//aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>00000000000000000000000000000000000000000000"+"0000000000000000000000000000000000000000000000000000000:<color=0,255,0>\");");
*/
//active默认开启 //inactive默认关闭 //runImmediately立刻运行
aoebbs("rule _StartTech active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 1.00000000){");
aoebbs("trModifyProtounit(\"Explorer\", 0, 0, -400);");
aoebbs("trModifyProtounit(\"Explorer\", 0, 0, 400);");
aoebbsZ("}} /*");
/*
上面的trModifyProtounit等于触发程序的Modify Protounit
<Effect name="Modify Protounit">
<Param name="ProtoUnit" dispName="$$22449$" varType="protounit">Villager</Param>
<Param name="PlayerID" dispName="$$22301$" VarType="player">1</Param>
<Param name="Field" dispName="$$25417$" varType="pufield">0</Param>
<Param name="Delta" dispName="$$25418$" varType="float">1.0</Param>
<Command>trModifyProtounit("%ProtoUnit%", %PlayerID%, %Field%, %Delta%);</Command>
</Effect>
trModifyProtounit(unit, player, field, delta)
*/
//玩家0为大自然
for(i=1;<=cNumberNonGaiaPlayers)
{
aoebbs("rule _Explorer"+i+" active runImmediately { ");
aoebbs("if(trPlayerActive("+i+")){");
/*往上面搜索ExplorerID,只对第一个放置的单位有效*/
aoebbs("if(trCountUnitsInArea(\""+rmGetUnitPlaced(ExplorerID, 0)+"\","+i+",\"unit\",35) >= 3){");
aoebbs("if(trCountUnitsInArea(\""+rmGetUnitPlaced(ExplorerID, 0)+"\",0,\"OutlawMusketeer\",45) == 0){");
aoebbs("trUnitSelectClear();");
aoebbs("trUnitSelectByID("+rmGetUnitPlaced(ExplorerID, 0)+");");
aoebbs("trUnitConvert("+i+");");
aoebbs("trUnitSelectClear();");
aoebbs("trUnitSelectByID("+rmGetUnitPlaced(ExplorerID, 0)+");");
aoebbs("trUnitHighlight(10, true);");
aoebbs("trUnitSelectClear();");
aoebbs("trUnitSelectByID("+rmGetUnitPlaced(ExplorerID, 0)+");");
aoebbs("trUnitChangeProtoUnit(\"Explorer\");");
aoebbs("trChatSend(0,\"Player"+i+" has rescued an Explorer, who joins the cause.\");");
for(p=1;<=cNumberNonGaiaPlayers)
{
aoebbs("xsDisableRule(\"_Explorer"+p+"\");");
}
aoebbs("}}}");
aoebbs("else{");
aoebbs("xsDisableRule(\"_Explorer"+i+"\");");
aoebbsZ("}} /*");
}
aoebbs("rule _LOS active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 10.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("trModifyProtounit(\"TownCenter\","+p+",2,1000);");
aoebbs("trTechSetStatus("+p+",446,2);");
}
aoebbs("xsEnableRule(\"_Fog\");");
aoebbs("xsEnableRule(\"_LOS2\");");
aoebbs("xsDisableRule(\"_LOS\");");
aoebbsZ("}} /*");
aoebbs("rule _LOS2 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 2.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("trModifyProtounit(\"TownCenter\","+p+",2,-1000);");
}
aoebbs("xsDisableRule(\"_LOS2\");");
aoebbsZ("}} /*");
aoebbs("rule _Fog inactive runImmediately { ");
aoebbs("if(trPlayerActive(trCurrentPlayer())){");
aoebbs("trSetFogAndBlackmap(true,false);");
aoebbs("xsDisableRule(\"_Fog\");");
aoebbsZ("}} /*");
/*
aoebbs("rule _Debug2 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 1.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"Colonialize:<color=0,255,0>\"+kbTechGetStatus("+p+",284,8));");
}
aoebbs("xsDisableRule(\"_Debug2\");");
aoebbsZ("}} /*");
*/
aoebbs("rule _Debug24 inactive runImmediately { ");
aoebbs("xsSetContextPlayer(1);");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P1Colonialize:<color=0,255,0>\"+kbTechGetStatus(421));");
aoebbs("xsDisableRule(\"_Debug24\");");
aoebbs("xsEnableRule(\"_Debug25\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug25 inactive runImmediately { ");
aoebbs("xsSetContextPlayer(1);");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P1Colonialize:<color=0,255,0>\"+kbTechGetStatus(421));");
aoebbs("xsDisableRule(\"_Debug25\");");
aoebbs("xsEnableRule(\"_Debug24\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug26 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 10.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("trUnitCreate(\"Learicorn\",\"Learicorn"+p+"\",0.5,0.5,0.5,0,"+p+");");
}
aoebbs("xsDisableRule(\"_Debug26\");");
aoebbs("xsEnableRule(\"_Debug27\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug27 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 10.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("trUnitCreate(\"Learicorn\",\"Learicorn"+p+"\",0.5,0.5,0.5,0,"+p+");");
}
aoebbs("xsDisableRule(\"_Debug27\");");
aoebbs("xsEnableRule(\"_Debug26\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug28 active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("trChatSendSpoofed(0,\"<color=0,255,255>QQ Group:85442352\");");
aoebbs("trChatSendSpoofed(0,\"<color=0,255,255>QQ Group:347551328\");");
aoebbs("xsDisableRule(\"_Debug28\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug30 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
for(u=1; <1700)
{
aoebbs("trChatSend(0,\"<color=0,255,0>"+u+" <color=0,255,255>\"+kbGetUnitTypeName("+u+"));");
}
aoebbs("xsDisableRule(\"_Debug30\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug31 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
for(u=1463; <1667)
{
aoebbs("trChatSend(0,\"<color=0,255,0>"+u+" <color=0,255,255>\"+kbGetUnitTypeName("+u+"));");
}
aoebbs("xsDisableRule(\"_Debug31\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug32 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("trChatSend(0,\"<color=0,255,0>1111111111111111111<color=0,255,255>\");");
aoebbs("trChatSend(0,\"<color=0,1,0>1111111111111111111<color=0,255,255>\");");
aoebbs("trChatSend(0,\"<color=0,145,0>1111111111111111111<color=0,255,255>\");");
aoebbs("trChatSend(0,\"<color=255,255,0>1111111111111111111<color=0,255,255>\");");
aoebbs("trChatSend(0,\"<color=1,1,0>1111111111111111111<color=0,255,255>\");");
aoebbs("xsDisableRule(\"_Debug32\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug33 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 0.00000000){");
for(p=0; <cNumberPlayers)
{
aoebbs("trModifyProtounit(\"Cannonball\","+p+",8,60);");
}
aoebbs("xsDisableRule(\"_Debug33\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug34 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
for(p=1; <cNumberPlayers)
{
if (rmGetPlayerCiv(p) >= 19 && rmGetPlayerCiv(p)<=26)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigTradeTaxRemove:<color=0,255,0>\"+kbTechGetStatus(2398));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigTradeTaxEnable:<color=0,255,0>\"+kbTechGetStatus(2399));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigConsulateRussians:<color=0,255,0>\"+kbTechGetStatus(2110));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigConsulateFrench:<color=0,255,0>\"+kbTechGetStatus(2112));");
/*
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateABQ(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateABQ));");
*/
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAlive(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAlive));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAliveOrBuilding(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAliveOrBuilding));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAny(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAny));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateBuilding(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateBuilding));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateDead(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateDead));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateNone(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateNone));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateQueued(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateQueued));");
}
}
aoebbs("xsEnableRule(\"_Debug35\");");
aoebbs("xsDisableRule(\"_Debug34\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug35 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
for(p=1; <cNumberPlayers)
{
if (rmGetPlayerCiv(p) >= 19 && rmGetPlayerCiv(p)<=26)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigTradeTaxRemove:<color=0,255,0>\"+kbTechGetStatus(2398));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigTradeTaxEnable:<color=0,255,0>\"+kbTechGetStatus(2399));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigConsulateRussians:<color=0,255,0>\"+kbTechGetStatus(2110));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"ypBigConsulateFrench:<color=0,255,0>\"+kbTechGetStatus(2112));");
// aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateABQ(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateABQ));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAlive(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAlive));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAliveOrBuilding(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAliveOrBuilding));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateAny(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateAny));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateBuilding(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateBuilding));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateDead(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateDead));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateNone(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateNone));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"cUnitStateQueued(Consulate):<color=0,255,0>\"+kbUnitCount("+p+",922,cUnitStateQueued));");
}
}
aoebbs("xsEnableRule(\"_Debug34\");");
aoebbs("xsDisableRule(\"_Debug35\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug36 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("trTechSetStatus(1,116,2);");
aoebbs("trChatSend(0,trTime()+\"<color=0,255,0>Debug36 Active<color=0,255,255>\");");
aoebbs("xsDisableRule(\"_Debug36\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug37 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("for(i=1;<cNumberPlayers){xsSetContextPlayer(i);for(c=0;<2549){if(kbTechCostPerResource(c,6)>0){trTechSetStatus(i,c,0);}}}");
// aoebbs("for(i=1;<=cNumberNonGaiaPlayers){xsSetContextPlayer(i);for(c=0;<2549)"+"{if(kbTechCostPerResource(c,6)>0){trTechSetStatus(i,c,0);}}");
// aoebbs("for(i=1;<=cNumberNonGaiaPlayers[can not ues cNumberNonGaiaPlayers in "TR"]){}");
aoebbs("xsDisableRule(\"_Debug37\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug38 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("for(i=1;<cNumberPlayers){xsSetContextPlayer(i);if(kbGetCivForPlayer(i)==0){}}");
aoebbs("xsDisableRule(\"_Debug38\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug40 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255><color=0,255,0>\"+kbGetCivName(kbGetCiv()));");
aoebbs("if(kbGetCivName(kbGetCiv()) == \"chinese\"){");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255><color=0,255,0>\"+kbGetCivName(kbGetCiv()));}");
}
aoebbs("xsDisableRule(\"_Debug40\");");
aoebbs("xsEnableRule(\"_Debug41\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug41 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255><color=0,255,0>\"+kbGetCiv());");
}
aoebbs("xsDisableRule(\"_Debug41\");");
aoebbs("xsEnableRule(\"_Debug40\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug42 active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("trChatSendSpoofed(0,\"cMapResources:"+cMapResources+"\");");
aoebbs("trChatSendSpoofed(0,\"cMapSize:"+cMapSize+"\");");
aoebbs("trChatSendSpoofed(0,\"cConnectEnemies:"+cConnectEnemies+"\");");
aoebbs("trChatSendSpoofed(0,\":cConnectAllies"+cConnectAllies+"\");");
aoebbs("trChatSendSpoofed(0,\":cConnectPlayers"+cConnectPlayers+"\");");
aoebbs("trChatSendSpoofed(0,\":cConnectAreas"+cConnectAreas+"\");");
aoebbs("trChatSendSpoofed(0,\"cRandomMapName\");");
aoebbs("trChatSendSpoofed(0,\"cMyTeam\");");
aoebbs("xsDisableRule(\"_Debug42\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug403 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 2.00000000){");
aoebbs("xsSetContextPlayer(0);");
for(c=0;<70)
{
aoebbs("trChatSendSpoofed(0,\"CivID:"+c+":\"+kbGetCivName("+c+"));");
}
aoebbs("xsDisableRule(\"_Debug43\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug46 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 2.00000000){");
aoebbs("xsSetContextPlayer(0);");
for(i=0;<8)
{
aoebbs("trChatSendSpoofed(0,\"Player:"+i+"rmGetPlayerCiv:"+rmGetPlayerCiv(i)+"\");");
aoebbs("trChatSendSpoofed(0,\"Player:"+i+"rmGetPlayerCulture:"+rmGetPlayerCulture(i)+"\");");
aoebbs("trChatSendSpoofed(0,\"Player:"+i+"rmGetPlayerTeam:"+rmGetPlayerTeam(i)+"\");");
aoebbs("trChatSendSpoofed(0,\"Player:"+i+"rmGetHomeCityLevel:"+rmGetHomeCityLevel(i)+"\");");
aoebbs("trChatSendSpoofed(0,\"Player:"+i+"rmGetNumberFairLocs:"+rmGetNumberFairLocs(i)+"\");");
}
for(i=0;<=3)
{
aoebbs("trChatSendSpoofed(0,\"Team:"+i+"rmGetNumberPlayersOnTeam:"+rmGetNumberPlayersOnTeam(i)+"\");");
}
aoebbs("trChatSendSpoofed(0,\"rmGetHighHomeCityLevel:"+rmGetHighHomeCityLevel()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetAverageHomeCityLevel:"+rmGetAverageHomeCityLevel()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetIsRelicCapture:"+rmGetIsRelicCapture()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetLowHomeCityLevel:"+rmGetLowHomeCityLevel()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetMapXSize:"+rmGetMapXSize()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetMapZSize:"+rmGetMapZSize()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetNomadStart:"+rmGetNomadStart()+"\");");
aoebbs("trChatSendSpoofed(0,\"rmGetSeaLevel:"+rmGetSeaLevel()+"\");");
aoebbs("xsDisableRule(\"_Debug46\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug47 active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 2.00000000){");
for(i=0;<=8)
{
aoebbs("xsSetContextPlayer("+i+");");
aoebbs("trChatSendSpoofed(0,\"Player:"+i+";kbGetPlayerName("+i+"):\"+kbGetPlayerName("+i+"));");
}
aoebbs("xsDisableSelf();");
aoebbsZ("}} /*");
aoebbs("rule _Debug48 inactive runImmediately { ");
aoebbs("xsSetContextPlayer(1);");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2207)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2207));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2626)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2626));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2627)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2627));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2628)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2628));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2629)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2629));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2630)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2630));");
aoebbs("xsDisableSelf();");
aoebbs("xsEnableRule(\"_Debug49\");");
aoebbsZ("}} /*");
aoebbs("rule _Debug49 inactive runImmediately { ");
aoebbs("xsSetContextPlayer(1);");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2207)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2207));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2626)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2626));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2627)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2627));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2628)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2628));");
aoebbs("trChatSendSpoofed(0,trTime()+\";\"+kbGetTechName(2630)+\"<color=0,255,255>:<color=0,255,0>\"+kbTechGetStatus(2630));");
aoebbs("xsDisableSelf();");
aoebbs("xsEnableRule(\"_Debug48\");");
aoebbsZ("}} /*");
for(i=1; <cNumberPlayers)
{
/*
if (rmGetPlayerCiv(i) >= 19 && rmGetPlayerCiv(i)<=26)
{
aoebbs("rule _CheckConsulate"+i+" inactive runImmediately { ");
aoebbs("if(trPlayerActive("+i+")){");
aoebbs("if(trTechStatusCheck("+i+",2399,2)){");
aoebbs("xsDisableRule(\"_CheckConsulate"+i+"\");");
aoebbsZ("}} /*");
}
*/
}
/*
aoebbs("rule _Debug inactive runImmediately { ");
aoebbs("xsSetContextPlayer(1);");
aoebbs("int cc=kbUnitCount(1,1509,8);");
aoebbs("if((trTime()-cActivationTime) >= 1.00000000){");
aoebbs("if(cc >= 1.00000000){");
aoebbs("trChatSend(1,\"\"+cc);");
//aoebbs("xsEnableRule(\"_Debug1\");");
//aoebbs("xsDisableRule(\"_Debug\");");
aoebbsZ("}}} /*");
aoebbs("rule _Debug1 inactive runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 1.00000000){");
for(p=1; <cNumberPlayers)
{
aoebbs("xsSetContextPlayer("+p+");");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"Settler:<color=0,255,0>\"+kbUnitCount("+p+",284,8));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"Unit:<color=0,255,0>\"+kbUnitCount("+p+",1463,8));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>P"+p+"All:<color=0,255,0>\"+kbUnitCount("+p+",1509,8));");
}
aoebbs("xsEnableRule(\"_Debug\");");
aoebbs("xsDisableRule(\"_Debug1\");");
aoebbsZ("}} /*");
*/
/*
aoebbs("rule _SocketCount active runImmediately { ");
aoebbs("for(UnittypeID=3000;>-1){if(kbGetUnitTypeName(UnittypeID) ==\"TownCenter\") Break;}");
aoebbs("if((trTime()-cActivationTime) == 1.00000000){");
aoebbs("trQuestVarSet(\"cSocketCount\",kbUnitCount(1,928,cUnitStateAny));");
aoebbs("xsDisableRule(\"_SocketCount\");");
aoebbsZ("}} /*");
aoebbs("rule _SentSocketCount active runImmediately { ");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>SocketCount:<color=0,255,0>\"+trQuestVarGet(\"cSocketCount\"));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>SocketCount:<color=0,255,0>\"+kbUnitCount(1,928,cUnitStateAny));");
aoebbs("trChatSendSpoofed(0,trTime()+\"<color=0,255,255>SocketCount:<color=0,255,0>\"+kbGetUnitTypeName(928));");
aoebbsZ("}} /*");
*/
aoebbs("rule _Debug70 minInterval 2 active runImmediately {");
aoebbs("if((trTime()-cActivationTime) >= 1.00000000){");
aoebbs("float TypeID = 0;");
aoebbs("while(kbGetUnitTypeName(TypeID)!=\"LogicalTypeNeededForVictory\")");
aoebbs("{");
aoebbs("TypeID = TypeID+1;");
aoebbs("}");
aoebbs("bool whilebool = true;");
aoebbs("int PlayerCount = 1;");
aoebbs("while(whilebool)");
aoebbs("{");
aoebbs("if(kbIsPlayerValid(PlayerCount))");
aoebbs("{");
aoebbs("PlayerCount = PlayerCount + 1;");
aoebbs("}");
aoebbs("else");
aoebbs("{");
aoebbs("whilebool = false;");
aoebbs("}");
aoebbs("}");
aoebbs("PlayerCount = PlayerCount - 1;");
aoebbs("trChatSendSpoofed(0,\"PlayerCount:\"+PlayerCount);");
aoebbs("for(PlayerID=1;<=PlayerCount)");
aoebbs("{");
aoebbs("xsSetContextPlayer(PlayerID);");
//aoebbs("for(EnemyAlive=0;<0){}");
aoebbs("static int EnemyAlive=0;");
aoebbs("for(i=1;<=PlayerCount)");
aoebbs("{");
aoebbs("if(kbIsPlayerEnemy(i)) ");
aoebbs("{");
aoebbs("if(trPlayerActive(i))");
aoebbs("{");
aoebbs("EnemyAlive = 1;");
aoebbs("}");
aoebbs("}");
aoebbs("}");
aoebbs("if(EnemyAlive == 0)");
aoebbs("{");
aoebbs("if(trCurrentPlayer() == PlayerID && trPlayerActive(trCurrentPlayer()))");
aoebbs("{");
aoebbs("trYouWin(false);");
aoebbs("}");
aoebbs("trSetPlayerWon(PlayerID);");
aoebbs("}");
aoebbs("if(trPlayerActive(PlayerID))");
aoebbs("{");
aoebbs("if(kbUnitCount(PlayerID,TypeID,cUnitStateAlive) < 1)");
aoebbs("{");
aoebbs("if(trCurrentPlayer() == PlayerID && trPlayerActive(trCurrentPlayer()))");
aoebbs("{");
aoebbs("trYouLose(\"\");");
aoebbs("}");
aoebbs("trSetPlayerDefeated(PlayerID);");
aoebbs("}");
aoebbs("}");
aoebbs("}");
aoebbs("xsDisableSelf();");
aoebbs("}");
aoebbs("}");
aoebbsE("");
aoebbs("rule _Debug71 minInterval 2 active runImmediately {");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
aoebbs("int UnitTypeID = 0;");
aoebbs("while(kbGetUnitTypeName(UnitTypeID)!=\"unit\"){");
aoebbs("UnitTypeID = UnitTypeID+1;");
aoebbs("}");
aoebbs("xsSetContextPlayer(1);");
aoebbs("trChatSend(0,\"UnitTypeID:\"+UnitTypeID+\":\"+kbGetUnitTypeName(UnitTypeID));");
aoebbs("int queryID = kbUnitQueryCreate(\"QueryAliveUnit\");");
aoebbs("trChatSend(0,\"queryID:\"+queryID);");
aoebbs("kbUnitQueryResetData(queryID);");
aoebbs("kbUnitQueryResetResults(queryID);");
aoebbs("kbUnitQuerySetUnitType(queryID,UnitTypeID);");
aoebbs("kbUnitQuerySetState(queryID, cUnitStateAlive);");
aoebbs("kbUnitQuerySetAscendingSort(queryID,true);");
aoebbs("kbUnitQuerySetPlayerID(queryID, 1,false);");
aoebbs("int resultCount = kbUnitQueryExecute(queryID);");
aoebbs("resultCount = kbUnitQueryNumberResults(queryID);");
aoebbs("trChatSend(0,\"resultCount:\"+resultCount);");
aoebbs("int unitID = 0;");
aoebbs("for(i=0;<resultCount) {");
aoebbs("unitID = kbUnitQueryGetResult(queryID,i);");
aoebbs("trChatSend(0,\"unitID[\"+unitID+\"]:\"+kbGetProtoUnitName(kbUnitGetProtoUnitID(unitID)));");
aoebbs("}");
aoebbs("xsDisableSelf();");
aoebbs("}");
aoebbs("}");
aoebbsE("");
aoebbs("rule _Debug72 minInterval 2 active runImmediately {");
aoebbs("if((trTime()-cActivationTime) >= 5.00000000){");
for(i=1;<=10)
{
aoebbs("trChatSend(0,\" \");");
}
aoebbs("trQuestVarSet(\"unitTypeID\",0);");
aoebbs("trQuestVarSet(\"unitQueryID\",0);");
aoebbs("xsSetContextPlayer(2);");
aoebbs("while(kbGetUnitTypeName(trQuestVarGet(\"unitTypeID\"))!=\"unit\"){");
aoebbs("trQuestVarSet(\"unitTypeID\",trQuestVarGet(\"unitTypeID\")+1);");
aoebbs("}");
aoebbs("trQuestVarSet(\"unitQueryID\",kbUnitQueryCreate(\"unitQueryID\"));");
aoebbs("kbUnitQuerySetUnitType(trQuestVarGet(\"unitQueryID\"),trQuestVarGet(\"unitTypeID\"));");
aoebbs("kbUnitQuerySetAscendingSort(trQuestVarGet(\"unitQueryID\"),true);");
aoebbs("kbUnitQuerySetPlayerID(trQuestVarGet(\"unitQueryID\"), 2,false);");
aoebbs("kbUnitQueryResetResults(trQuestVarGet(\"unitQueryID\"));");
aoebbs("int unitID = 0;");
aoebbs("for(index=0; <kbUnitQueryExecute(trQuestVarGet(\"unitQueryID\"))){");
aoebbs("unitID = kbUnitQueryGetResult(trQuestVarGet(\"unitQueryID\"),index);");
aoebbs("trChatSend(0,\"unitID[\"+unitID+\"]:\"+kbGetProtoUnitName(kbUnitGetProtoUnitID(unitID)));");
aoebbs("}");
aoebbs("trChatSend(0,\"count:\"+kbUnitQueryNumberResults(trQuestVarGet(\"unitQueryID\")));");
aoebbs("xsDisableSelf();");
aoebbs("}");
aoebbs("}");
aoebbsE("");
aoebbs("rule _Temp inactive { if(true){");
aoebbsZ("xsDisableSelf();");
// ************************************************* New Trigger *************************************************
// rmCreateTrigger("SocketCountStart active runImmediately{xsSetContextPlayer(0);for(UnittypeID=3000;>-1){if(kbGetUnitTypeName(UnittypeID)"+"==\"SocketTradeRoute\") Break;}if(trTime()==0)"+"{trQuestVarSet(\"SocketCount\",kbUnitCount(0,UnittypeID,255));xsDisableSelf();}}/*");
// rmCreateTrigger("SocketCountStart active runImmediately{xsSetContextPlayer(0);if(trTime()==1)"+"{trQuestVarSet(\"SocketCount\",kbUnitCount(0,490,255));xsDisableSelf();}}/*");
// rmCreateTrigger("*/rule _SocketCountEnd");
// ******************************************* rmCreateTrigger不受中文路径影响,但不支持空格,一个触发总字符总数有上限,大概输出255字符后就无法继续输出。
// ******************************************* 与上面的规则触发一样,一对引号""内只能输入125个字符,超过就需要用加号附加另一对引号""
// ******************************************* 例如:"这里有125个字符"+"11111"
// ******************************************* 一对引号""内需要增加另一对引号需要使用转义字符\"\",例如:" \"1111\" "
// ******************************************* rmCreateTrigger不能使用/**/形式的注释。该触发联机可用
int SC1 = rmGetUnitPlaced(socketID, 0);
int SC2 = rmGetUnitPlaced(socketID, 0)+1;
int SC3 = rmGetUnitPlaced(socketID, 0)+2;
int SC4 = rmGetUnitPlaced(socketID, 0)+3;
int SC5 = rmGetUnitPlaced(socketID, 0)+4;
//用贸易站下一个单位ID减去贸易站ID
float SC0 = rmGetUnitPlaced(TreeID,0)-rmGetUnitPlaced(socketID,0);
if(SC0== 1)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("CustomStart"+i+" active runImmediately{if(trPlayerControlsSocket("+i+",\"\"+"+SC1+")){trChatSend(0,\"Player"+i+" ABCDEFG:\");xsDisableSelf();}}/*");
rmCreateTrigger("*/rule _CustomEnd"+i);
}
}
if(SC0== 2)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("CustomStart"+i+" active runImmediately{if(trPlayerControlsSocket("+i+",\"\"+"+SC1+")&&trPlayerControlsSocket("+i+",\"\"+"+SC2+")){trChatSend(0,\"Player"+i+" ABCDEFG:\");xsDisableSelf();}}/*");
rmCreateTrigger("*/rule _CustomEnd"+i);
}
}
if(SC0== 3)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("CustomStart"+i+" active runImmediately{if(trPlayerControlsSocket("+i+",\"\"+"+SC1+")&&trPlayerControlsSocket("+i+",\"\"+"+SC2+")&&trPlayerControlsSocket("+i+",\"\"+"+SC3+")){trChatSend(0,\"Player"+i+" ABCDEFG:\");xsDisableSelf();}}/*");
rmCreateTrigger("*/rule _CustomEnd"+i);
}
}
if(SC0== 4)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("CustomStart"+i+" active runImmediately{if(trPlayerControlsSocket("+i+",\"\"+"+SC1+")&&trPlayerControlsSocket("+i+",\"\"+"+SC2+")&&trPlayerControlsSocket("+i+",\"\"+"+SC3+")&&trPlayerControlsSocket("+i+",\"\"+"+SC4+")){trChatSend(0,\"Player"+i+" ABCDEFG:\");xsDisableSelf();}}/*");
rmCreateTrigger("*/rule _CustomEnd"+i);
}
}
if(SC0== 5)
{
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("CustomStart"+i+" active runImmediately{if(trPlayerControlsSocket("+i+",\"\"+"+SC1+")&&trPlayerControlsSocket("+i+",\"\"+"+SC2+")&&trPlayerControlsSocket("+i+",\"\"+"+SC3+")&&trPlayerControlsSocket("+i+",\"\"+"+SC4+")&&trPlayerControlsSocket("+i+",\"\"+"+SC5+")){trChatSend(0,\"Player"+i+" ABCDEFG:\");xsDisableSelf();}}/*");
rmCreateTrigger("*/rule _CustomEnd"+i);
}
}
// 注:rmCreateTrigger不支持输出空格,可使用tab字符作为代替。如果需要输出聊天时可以用StringID// xsDisableSelf();为关闭触发本身,等同于rmSetTriggerLoop(false);;如果不关闭触发就会变成循环触发,等同于rmSetTriggerLoop(true);。
// 因为rmCreateTrigger要创建一个结束触发来辅助上一个触发生成,虽然没有影响,但是可以另开一个触发关闭这些触发。
rmCreateTrigger("DisableStart active runImmediately{xsDisableSelf();for(p=1;<cNumberPlayers)"+"{xsDisableRule(\"_CustomEnd\"+p);xsDisableRule(\"_DisableEnd\");}}/*");
rmCreateTrigger("*/rule _DisableEnd");
// 注意rmCreateTrigger引号""里面的for循环不要有空格,否则会输出为字符_ ;就是这个字符“_”,然后导致触发程序失效。
/* //**********************************************************************************************************************************
<Condition name="Player Controls Socket">
<Param name="PlayerID" dispName="$$22301$" VarType="player">1</Param>
<Param name="Socket" dispName="$$32975$" VarType="unit">default</Param>
<Expression>trPlayerControlsSocket(%PlayerID%, "%Socket%")</Expression>
</Condition>
"%Socket%"为剧情名,所以不能使用加减法。例如""+1=1;""+1+1=11。加减法可以在RM层进行,往上搜索int SC2。
旧版本触发,只列举5个贸易站,其他不列出
for(i=1; <cNumberPlayers)
{
rmCreateTrigger("FourOfAKind"+i);
rmSwitchToTrigger(rmTriggerID("FourOfAKind"+i));
rmSetTriggerActive(true);
rmSetTriggerRunImmediately(true);
rmSetTriggerLoop(false);
rmSetTriggerPriority(4);
rmAddTriggerCondition("Player Controls Socket");
rmSetTriggerConditionParamInt("PlayerID", i, false);
rmSetTriggerConditionParam("Socket", ""+SC1, false);
rmAddTriggerCondition("Player Controls Socket");
rmSetTriggerConditionParamInt("PlayerID", i, false);
rmSetTriggerConditionParam("Socket", ""+SC2, false);
rmAddTriggerCondition("Player Controls Socket");
rmSetTriggerConditionParamInt("PlayerID", i, false);
rmSetTriggerConditionParam("Socket", ""+SC3, false);
rmAddTriggerCondition("Player Controls Socket");
rmSetTriggerConditionParamInt("PlayerID", i, false);
rmSetTriggerConditionParam("Socket", ""+SC4, false);
rmAddTriggerCondition("Player Controls Socket");
rmSetTriggerConditionParamInt("PlayerID", i, false);
rmSetTriggerConditionParam("Socket", ""+SC5, false);
rmAddTriggerEffect("Send Chat");
rmSetTriggerConditionParamInt("PlayerID", i, false);
//旧版本触发不支持("PlayerID", 0, false);;ID 0为以大自然身份发送消息
rmSetTriggerEffectParam("SetName","hc_revolution");
rmSetTriggerEffectParam("Message","Player"+i+"ABCDEFG");
}
*/ //********************************************************************************************************************************
} //END