触发和动作脚本
此页面列出全部火卫一引入的AI脚本与触发相关的逻辑。
Bugfixes and Miscellanous
脚本动作
移动到单元格
现在遵循YR的单元格计算规则,使用1000 * Y + X
,而非遗留自RA1的128 * Y + X
。路径点的范围由[0,701]扩展到[0, 2147483647]。
地图触发动作
125 将建筑建造于...
现在可以设置是否播放建造动画(需要下述设置)。全局变量与局部变量现在都是无限数量的了。
脚本动作
部署
现在会使DeploysInto
载具自动搜寻空地,而非卡死在原处。
Script Actions
10000-10999
Ingame Actions
10000-10049
Attack Actions
These actions instruct the TeamType to use the TaskForce to approach and attack the target specified by the second parameter which is an index of a generic pre-defined group. Look at the tables below for the possible actions (first parameter value) and arguments (the second parameter value).
基于威胁度的攻击行为会参考
rulesmd.ini
的TargetSpecialThreatCoefficientDefault
和EnemyHouseThreatBonus
标签。All aircraft that attack other air units will end the script. This behavior is intentional because without it aircraft had some bugs that weren’t fixable at the time of developing the feature.
AITargetTypes
actions instruct the TeamType to use the TaskForce to approach and attack the target specified by the second parameter which is an index of a modder-defined group fromAITargetTypess
. Look at the tables below for the possible actions (first parameter value) and arguments (the second parameter value).
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=i,n ; For i values check the next table
行为 |
参数 |
重复 |
目标优先级 |
描述 |
---|---|---|---|---|
10000 |
目标类型# |
是 |
更近 |
|
10001 |
目标类型# |
否 |
更近 |
当一个小队成员摧毁给定目标时结束 |
10002 |
|
是 |
更近 |
|
10003 |
|
否 |
更近 |
当一个小队成员摧毁给定目标时结束 |
10004 |
|
是 |
更近 |
从列表中随机选择一个目标 |
10005 |
目标类型# |
是 |
更远 |
|
10006 |
目标类型# |
否 |
更远 |
当一个小队成员摧毁给定目标时结束 |
10007 |
|
是 |
更远 |
|
10008 |
|
否 |
更远 |
当一个小队成员摧毁给定目标时结束 |
10009 |
|
是 |
更远 |
从列表中随机选择一个目标 |
10010 |
目标类型# |
是 |
更近时更高威胁 |
|
10011 |
目标类型# |
否 |
更近时更高威胁 |
当一个小队成员摧毁给定目标时结束 |
10012 |
|
是 |
更近时更高威胁 |
|
10013 |
|
否 |
更近时更高威胁 |
当一个小队成员摧毁给定目标时结束 |
10014 |
目标类型# |
是 |
更远时更高威胁 |
|
10015 |
目标类型# |
否 |
更远时更高威胁 |
当一个小队成员摧毁给定目标时结束 |
10016 |
|
是 |
更远时更高威胁 |
|
10017 |
|
否 |
更远时更高威胁 |
当一个小队成员摧毁给定目标时结束 |
下列值是可被用于新攻击脚本行为的第二参数的目标类型#
值 |
目标类型 |
描述 |
---|---|---|
1 |
任意目标 |
任意敌方 |
2 |
建筑 |
任何不含 |
3 |
矿车 |
任何含有 |
4 |
步兵 |
任意敌方 |
5 |
载具 |
任何含有 |
6 |
工厂 |
任何含有Factory=设定的敌方 |
7 |
防御建筑 |
任何含有 |
8 |
所属方威胁 |
任何将小队所属方的任何单位作为目标的敌方对象,或者任何接近小队队长的敌人 |
9 |
发电厂 |
任何含有正数值 |
10 |
驻扎建筑 |
任何被步兵驻扎的 |
11 |
科技建筑 |
任何含有 |
12 |
矿石精炼厂 |
任何含有 |
13 |
心灵控制者 |
任何拥有带 |
14 |
空中单位 |
任意敌方的 |
15 |
海上目标 |
任何含有 |
16 |
干扰者 |
任何含有正数值 |
17 |
地面载具 |
任何不含 |
18 |
经济单位 |
任何含有 |
19 |
兵营 |
任何含有 |
20 |
战车工厂 |
任何含有 |
21 |
机场 |
任何含有 |
22 |
雷达 |
任何含有 |
23 |
科技实验室 |
任何在 |
24 |
船坞 |
任何含有 |
25 |
超级武器 |
任何含有 |
26 |
建造厂 |
任何含有 |
27 |
中立 |
任意中立对象 (Civilian) |
28 |
发生器 |
任何含有 |
29 |
雷达干扰器 |
任何含有正数值 |
30 |
屏蔽器 |
任何含有正数值 |
31 |
海军单位 |
任何含有 |
32 |
机动单位 |
任意 |
33 |
可占领目标 |
任何含有 |
34 |
区域威胁 |
任何处于小队队长的警戒范围内的敌方对象 |
35 |
战车工厂与海军船坞 |
任何含有 |
36 |
非防御建筑 |
任何含有 |
The second parameter with a 0-based index for the
AITargetTypes
section specifies the list of possibleVehicleTypes
,AircraftTypes
,InfantryTypes
andBuildingTypes
that can be evaluated.The
AITargetTypes
index# values are obtained in the newAITargetTypes
section that must be declared inrulesmd.ini
:
在rulesmd.ini
中:
[AITargetTypes] ; List of TechnoType lists
0=SOMETECHNOTYPE,SOMEOTHERTECHNOTYPE,SAMPLETECHNOTYPE
1=ANOTHERTECHNOTYPE,YETANOTHERTECHNOTYPE
; ...
10050-10099
Move Team to Techno Location actions
These actions instructs the TeamType to use the TaskForce to approach the target specified by the second parameter. Look at the tables below for the possible actions (first parameter value).
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=i,n ; For i values check the next table
行为 |
参数 |
Target Owner |
目标优先级 |
描述 |
---|---|---|---|---|
10050 |
目标类型# |
敌方 |
更近时更高威胁 |
|
10051 |
|
敌方 |
更近时更高威胁 |
|
10052 |
|
敌方 |
更近 |
从被选中的列表中随机选择一个目标 |
10053 |
目标类型# |
友方 |
更近 |
|
10054 |
|
友方 |
更近 |
|
10055 |
|
友方 |
更近 |
从被选中的列表中随机选择一个目标 |
10056 |
目标类型# |
敌方 |
更远时更高威胁 |
|
10057 |
|
敌方 |
更远时更高威胁 |
|
10058 |
|
敌方 |
更远 |
从被选中的列表中随机选择一个目标 |
10059 |
目标类型# |
友方 |
更远 |
|
10060 |
|
友方 |
更远 |
|
10061 |
|
友方 |
更远 |
从被选中的列表中随机选择一个目标 |
10000-10049
General Purpose
10100
Timed Area Guard
Puts the TaskForce into Area Guard mode for the given units of time. Unlike the original timed Guard script action (
5,n
) that just stays in place doing a basic guard operation this action has a more active role attacking nearby invaders or defending units that needs protection.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=10100,n ; integer, time in ingame seconds
10101
Wait Until Ammo is Full
当小队内所有成员弹药满时继续执行下一个动作。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=10101,0
10102
Regroup Temporarily Around the Team Leader
Puts the TaskForce into Area Guard mode for the given amount of time around the Team Leader (this unit remains almost immobile until the action ends). The default radius around the leader is
[General] > CloseEnough
and the units will not leave that area.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=10102,n
10103
Load onto Transports
If the TaskForce contains unit(s) that can be carried by the transports of the same TaskForce then this action will make the units enter the transports. In single player missions the next action must be “Wait until fully loaded” (
43,0
) or the script will not continue.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=10103,0
12000-12999
Suplementary/Setup Pre-actions
12000
Wait if No Target Found
When executed before a new Attack ScriptType actions like
Generic Target Type Attack
actions andAITargetTypes Attack
actions the TeamType will remember that must wait 1 second if no target was selected. The second parameter is a positive value that specifies how much retries the Attack will do when no target was found before new Attack ScriptType Action is discarded & the script execution jumps to the next line. The value0
means infinite retries.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=12000,n ; integer n=0
12001
Modify Target Distance
By default
Moving Team to techno location
actions ends when the Team Leader reaches a distance declared in rulesmd.ini calledCloseEnough
. When this action is executed before the actionsMoving Team to techno location
overwritesCloseEnough
value. This action works only the first time andCloseEnough
will be used again the next Movement action.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=12001,n
12002
Set Move Action End Mode
Sets how the Movement actions ends and jumps to the next line. This action works only the first time and
CloseEnough
will be used again the next Movement action.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=12002,n
可选参数为:
参数 |
动作结束当… |
---|---|
0 |
小队队长抵达最小距离 |
1 |
一个单位抵达最小距离 |
2 |
所有成员抵达最小距离 |
14000-14999
Utility Actions
14000
Team’s Trigger Weight Reward
When executed before a new Attack ScriptType actions like
Generic Target Type Attack
actions andAITargetTypes Attack
actions the TeamType will remember that must be rewarded increasing the current weight of the AI Trigger when the TeamType Target was killed by any of the Team members. The current weight will never surprass the minimum weight and maximum weight limits of the AI Trigger. The second parameter is a positive value.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=14000,n ; integer n=0
14001
Increase AI Trigger Current Weight
When executed this increases the current weight of the AI Trigger. The current weight will never surprass the minimum weight and maximum weight limits of the AI Trigger. Take note that all TeamTypes of the same AI Trigger will update the AI Trigger Current Weight sooner or later. The second parameter is a positive value. Take note that the original game only uses the first of the two Teams for calculating the AI Trigger Current weight at the end of the Trigger life, this action ignores if the Team is the first or the second of the AI Trigger and the Current weight is calculated when is executed the action.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=14001,n
14002
Decrease AI Trigger Current Weight
When executed this decreases the current weight of the AI Trigger. Details same as above.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=14002,n
14003
Unregister Team Success
就是
49,0
的反向版本。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=14003,0
16000-16999
Flow Control
16000
Start a Timed Jump to the Same Line
When the timer ends the current script action ends and start again the same script action. The timer jump repeats again (infinite loop) until is stopped with action
16002
or the team is destroyed.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=16000,n ; integer n=0, in ingame seconds
16001
Start a Timed Jump to the Next Line
当此脚本动作的计时器结束时,开始下一行。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=16001,n ; integer n=0, in ingame seconds
16002
Stop the Timed Jumps
如果定时跳转已经激活,那么停止。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=16002,0
16003
Randomly Skip Next Action
执行此动作时会挑选一个1-100之间的随机数,如果此数值小于等于第二个参数,则跳过下一个动作。第二个参数为0时,下一个脚本一定会执行;为100时,下一个脚本一定不会执行。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=16003,n ; where 0 > n <= 100
16004
Pick a Random Script
When executed this action picks a random Script Type and replaces the current script by the new picked one. The second parameter is a 0-based index from the new section
AIScriptsList
explained below.
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=16004,n
第二个参数是基于0的AIScriptsList
中的索引,指定了可用的ScriptTypes
列表。要使本脚本正常工作,需要在rulesmd.ini
中声明[AIScriptsList]。
在rulesmd.ini
中:
[AIScriptsList] ; List of ScriptType lists
0=SOMESCRIPTTYPE,SOMEOTHERSCRIPTTYPE,SAMPLESCRIPTTYPE
1=ANOTHERSCRIPTTYPE,YETANOTHERSCRIPTTYPE
; ...
18000-18999
Variable Manipulation
18000-18023
Edit Variable
计算一个变量的值
由于某些原因,变量的类型是int16而不是像触发动作中那样是int32,意味着值域范围为[-32768,32767]。
超过此范围可能会引起预期外的效果。
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=i,n ; where 18000 <= i <= 18023, n is made up of two parts, the low 16 bits is being used to store the variable index, the high 16 bits is being used for storing the param value.
18024 - 18047
Edit Variable using Local Variable
Operate a variable’s value using a local variable’s value
Similar to 18000-18023, but the number to operate the value is being read from a local variable
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=i,n ; where 18024 <= i <= 18047, n is made up of two parts, the low 16 bits is being used to store the variable index, the high 16 bits is being used for storing the local variable index.
18000 - 18071
Edit Variable using Global Variable
Operate a variable’s value using a global variable’s value
Similar to 18000-18023, but the number to operate the value is being read from a global variable
在aimd.ini
中:
[SOMESCRIPTTYPE] ; ScriptType
x=i,n ; where 18048 <= i <= 18071, n is made up of two parts, the low 16 bits is being used to store the variable index, the high 16 bits is being used for storing the global variable index.
19000-19999
Miscellanous/Uncategorized
This category is empty for now.
Trigger Actions
500
保存游戏
立刻存档(仅单人游戏)。
以下原版CSF被使用:
TXT_SAVING_GAME
,TXT_GAME_WAS_SAVED
和TXT_ERROR_SAVING_GAME
。存档名将会是
地图名 - CSF
例如:
盟军战役25: 僵僵の钱 - 钱全被偷光了!
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],500,4,[CSFKey],0,0,0,0,A,[ActionX]
...
501
编辑变量
计算一个变量的值
变量类型为int32,即值域范围为[-2147483648,2147483647]。
超过此范围可能会引起预期外的效果。
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],501,0,[VariableIndex],[Operation],[Number],[IsGlobalVariable],0,A,[ActionX]
...
操作数 |
描述 |
---|---|
0 |
当前值=数字 |
1 |
当前值=当前值+数字 |
2 |
当前值=当前值-数字 |
3 |
当前值=当前值*数字 |
4 |
当前值=当前值/数字 |
5 |
当前值=当前值%数字 |
6 |
当前值=当前值<<数字 |
7 |
当前值=当前值>>数字 |
8 |
当前值=~当前值 |
9 |
当前值=当前值⊕数字 |
10 |
当前值=当前值|数字 |
11 |
当前值=当前值&数字 |
502
生成随机数
在[Min, Max]之间生成一个随机数,存储在给定的变量中。
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],502,0,[VariableIndex],[Min],[Max],[IsGlobalVariable],0,A,[ActionX]
...
503
打印变量值
在消息列表中输出变量值。
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],503,[VariableIndex],0,[IsGlobalVariable],0,0,0,A,[ActionX]
...
504
变量间计算
将两个变量的值进行计算
类似501,但计算数由另一个变量中读取
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],504,0,[VariableIndex],[Operation],[VariableForOperationIndex],[IsGlobalVariable],[IsOperationGlobalVariable],A,[ActionX]
...
操作数
请查阅501
号动作
505
在特定地点发射超级武器
将超级武器发射到指定地点。
所属方索引
可以有以下值:
所属方索引 |
描述 |
---|---|
>= 0 |
地图上的此所属方 |
4475-4482 |
类似0-7 |
-1 |
随机挑选非中立所属 |
-2 |
第一个中立所属方 |
-3 |
随机人类玩家 |
坐标的X和Y可以取正数或-1,-1代表在可视区域内随机。
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],505,0,0,[SuperWeaponTypesIndex],[HouseIndex],[CoordinateX],[CoordinateY],A,[ActionX]
...
506
在特定路径点发射超级武器
将超级武器发射到指定路径点。
在mycampaign.map
中:
[Actions]
...
ID=ActionCount,[Action1],506,0,0,[SuperWeaponTypesIndex],[HouseIndex],[WaypointIndex],0,A,[ActionX]
...
触发事件
500-511
变量比较
将变量与给定的数字相比。
在mycampaign.map
中:
[Events]
...
ID=EventCount,[Event1],[EVENTID],2,[VariableIndex],[Param],[EventX]
...
事件ID |
描述 |
全局 |
---|---|---|
500 |
当前值>数字 |
否 |
501 |
当前值<数字 |
否 |
502 |
当前值=数字 |
否 |
503 |
当前值>=数字 |
否 |
504 |
当前值<=数字 |
否 |
505 |
当前值&数字 |
否 |
506 |
当前值>数字 |
是 |
507 |
当前值<数字 |
是 |
508 |
当前值=数字 |
是 |
509 |
当前值>=数字 |
是 |
510 |
当前值<=数字 |
是 |
511 |
当前值&数字 |
是 |
512-523
变量与局部变量比较
将变量值与给定的局部变量值进行比较。
在mycampaign.map
中:
[Events]
...
ID=EventCount,[Event1],[EVENTID],2,[VariableIndex],[LocalVariableIndex],[EventX]
...
事件ID |
描述 |
全局 |
---|---|---|
512 |
当前值>局部变量值 |
否 |
513 |
当前值<局部变量值 |
否 |
514 |
当前值=局部变量值 |
否 |
515 |
当前值>=局部变量值 |
否 |
516 |
当前值<=局部变量值 |
否 |
517 |
当前值&局部变量值 |
否 |
518 |
当前值>局部变量值 |
是 |
519 |
当前值<局部变量值 |
是 |
520 |
当前值=局部变量值 |
是 |
521 |
当前值>=局部变量值 |
是 |
522 |
当前值<=局部变量值 |
是 |
523 |
当前值&局部变量值 |
是 |
524-535
变量与全局变量比较
将变量值与给定的全局变量值进行比较。
在mycampaign.map
中:
[Events]
...
ID=EventCount,[Event1],[EVENTID],2,[VariableIndex],[GlobalVariableIndex],[EventX]
...
事件ID |
描述 |
全局 |
---|---|---|
524 |
当前值>全局变量值 |
否 |
525 |
当前值<全局变量值 |
否 |
526 |
当前值=全局变量值 |
否 |
527 |
当前值>=全局变量值 |
否 |
528 |
当前值<=全局变量值 |
否 |
529 |
当前值&全局变量值 |
否 |
530 |
当前值>全局变量值 |
是 |
531 |
当前值<全局变量值 |
是 |
532 |
当前值=全局变量值 |
是 |
533 |
当前值>=全局变量值 |
是 |
534 |
当前值<=全局变量值 |
是 |
535 |
当前值&全局变量值 |
是 |
600
The shield of the attached object is broken
在mycampaign.map
中:
[Events]
...
ID=EventCount,...,600,2,0,0,...
...