翔鹰帝国网|帝国时代论坛|帝国时代系列|神话时代
 找回密码
 注册翔鹰会员(昵称)
搜索
查看: 4239|回复: 0

[公告] 帝国时代II高清版脚本参考(RMS/AI)

[复制链接]

352

主题

57

精华

35万

积分

教皇

帝國榮譽元帥

耕战
64323
鹰币
97876
天龙币
0
回帖
200

翔鹰建站十周年纪念章翔鹰十周年帝国Online纪念章特级帝国勋章特级嘉禾勋章特级皇家勋章蛟龙勋章十字军勋章智将勋章

附庸关系0
发表于 2015-4-2 14:35:55 | 显示全部楼层 |阅读模式
本帖最后由 孟雨亲王 于 2015-4-2 17:02 编辑

Age of Empires Script Reference
帝国时代脚本参考
翻译:孟雨亲王(道禪無)
翔鹰帝国论坛 荣誉出品
https://steamcommunity.com/app/221380/discussions/0/684839199943495537/

Summary 概述
Hi everyone, I'm writing here to document the various script support we have added to Age of Empires. Most of these scripts emulate features found in UserPatch. The Forgotten was based on UserPatch, so we supported the features necessary to support the campaigns and Improved Standard AI. The AI's can efficiently hunt boars improving their castle booms.

None of us know who User Patch is and he (or she) was not involved in development of this expansion. However, props out to whoever this person is and making our job easier to reverse engineering using UserPatch Reference[userpatch.aiscripters.net]. It was a unique challenge because we had to try and figure out what UserPatch actually did and emulate similar behavior by working with Bert, Tom, and Archon. The boar hunting support was particularly challenging to get right.

General Changes (both AoK and AoF) 一般改变
•        Updated the number of timers from 10 to 50
•        计时器数量从10更新至50
•        Updated the number of allowed facts from 1000 to 10000
•        允许的事实数量从1000更新至10000
•        Updated the number of goals from 50 to 512.
•        目标的数量从50更新至512
•        sn-task-ungrouped-soldiers now defaults to 0.
•        sn-task-ungrouped-soldiers现预设为0
•        dropsite-min-distance now supports additional dropsite-types: hunting, boar-hunting, deer-hunting, and live-boar.
•        dropsite-min-distance现支援额外的dropsite-types:hunting,boar-hunting,deer-hunting,和 live-boar

New Random Map Script Commands (*.rms2) 新随机地图脚本命令
These commands are only available in *.rms2 files which can only be used while AoF is enabled.
这些命令只在*.rms2文件中可用且*.rms2文件只能在AoF启用时使用。

ai_map_info_type
ai_map_info_type inConstMapName inConstIsNomad inConstIsMichi inConstExtraStyle
You can set the map type and additional AI information. There are several new map types defined for AoF.
您可设置地图类型和额外的人工智能信息。AoF定义了几个新的地图类型。

Examples for ai_info_map_type:
示例:

1. #load-if-defined COASTAL-MAP will be true for AIs.
COASTAL-MAP将对人工智能为真
  1. <PLAYER_SETUP>
  2. random_placement
  3. ai_info_map_type COASTAL 0 0 0
复制代码



2. #load-if-defined MONGOLIA-MAP and UP-NOMAD-STYLE will be true for AIs.
MONGOLIA-MAP 和 UP-NOMAD-STYLE将对人工智能为真
  1. <PLAYER_SETUP>
  2. random_placement
  3. ai_info_map_type MONGOLIA 1 0 0
复制代码



3. #load-if-defined BLACK-FOREST-MAP and UP-MICHI-STYLE will be true for AIs.
BLACK-FOREST-MAP 和 UP-MICHI-STYLE将对人工智能为真
  1. <PLAYER_SETUP>
  2. random_placement
  3. ai_info_map_type BLACK_FOREST 0 1 0
复制代码



The last parameter will define UP-EXTRA-STYLE if someone out there is feeling particularly creative and wants to link an RMS2 with a new AI2/PER2.
最后一个参量将定义UP-EXTRA-STYLE,若您感觉特别的创造性并想要将一个RMS2与一个新的AI2/PER2关联。

New valid map types are (Forgotten Only):
新的有效地图类型有:(仅AoF)
  1. ACROPOLIS-MAP
  2. BUDAPEST-MAP
  3. CENOTES-MAP
  4. CITYOFLAKES-MAP
  5. GOLDENPIT-MAP
  6. HIDEOUT-MAP
  7. HILLFORT-MAP
  8. LOMBARDIA-MAP
  9. STEPPE-MAP
  10. VALLEY-MAP
  11. MEGARANDOM-MAP
  12. HAMBURGER-MAP
复制代码




base_elevation:
base_elevation: inConstElevation
&#8226;        Modify the base elevation for player and standard lands. <ELEVATION_GENERATION> must exist if used.
&#8226;        修正玩家和标准地区的基础海拔。如果使用,则<ELEVATION_GENERATION>必须存在。
&#8226;        Section: LAND_GENERATION :: create_player_lands, create_land
Examples for base_elevation
示例
1. Create a palm desert land with elevation 2.
创建一片高地2的棕榈沙漠地区
  1. <LAND_GENERATION>
  2. create_land
  3. {
  4. terrain_type PALM_DESERT
  5. number_of_tiles 128
  6. base_elevation 2
  7. }

  8. <ELEVATION_GENERATION>
复制代码



grouped_by_team:
&#8226;        Position team members in close proximity on the map. This command and "random_placement" are mutually exclusive. The "base_size" specified in "create_player_lands" determines the distance between players on a team. When enabled, the UP-GROUPED-BY-TEAM #load symbol will be defined for AIs.
&#8226;        在地图上紧密临近放置组队成员。此命令和 “random_placement”互相排斥。“create_player_lands”指定的“base_size”决定了一个组队的玩家之间的距离当启用时,UP-GROUPED-BY-TEAM装载标识将为人工智能定义。
&#8226;        Section: PLAYER_SETUP
Examples for grouped_by_team
示例
1. Enable the team positioning system for player lands.
为玩家地区启用组队位置系统
  1. <PLAYER_SETUP>
  2. grouped_by_team /*replaces random_placement*/
复制代码



nomad_resources:
&#8226;        Modify starting resources to match the built-in nomad map. This means that the cost of a town center (275W, 100S) is added to the stockpile. When enabled, the UP-NOMAD-RESOURCES #load symbol will be defined for AIs.
&#8226;        修正起始资源以匹配内置的游牧地图。这意味着一个市镇中心的花费(275木材,100石材)将增至资源储备。当启用时,UP-NOMAD-RESOURCES装载标识将为人工智能定义。
&#8226;        Section: PLAYER_SETUP
Examples for nomad_resources
示例
1. Set starting resources like nomad with +275W, +100S.
设置起始资源类似游牧+275木材,+100石材
  1. <PLAYER_SETUP>
  2. random_placement
  3. nomad_resources
复制代码


New AI Script Commands (*.per2) 新人工智能脚本命令
These commands are only available in *.per2 files which can only be used while AoF is enabled.
这些命令只在*.per2文件中可用且*.per2文件只能在AoF启用时使用。

up-retask-gatherers:
(up-retask-gatherers inConstResource typeOp inOpValue)
&#8226;        Retask a specific number of villagers gathering from a resource.
&#8226;        再指派指定数量的村民采集一种资源。
Examples for up-retask-gatherers
示例
1. Request up to 3 lumberjacks to attempt to retask.
要求至多3名伐木工尝试再指派

  1. (defrule
  2. (true)
  3. =>
  4. (up-retask-gatherers wood c: 3)
  5. (disable-self))
复制代码



boar-food is a new valid type for up-retask-gatherers.
boar-food是up-retask-gatherers的一个新的有效类型

up-request-hunters:
(up-request-hunters typeOp inOpValue)
&#8226;        Attempt to request support hunters for the active boar lure. This is not guaranteed to reach the total.
&#8226;        尝试要求猎人支援活跃的野猪引诱。这不保证能达到总数。
Examples for up-request-hunters
示例
1. Request a total of 4 hunters to support the current lure.
要求总数为4的猎人支援当前引诱。

  1. (defrule
  2. (true)
  3. =>
  4. (up-request-hunters c: 4)
  5. (disable-self))
复制代码




up-jump-rule:
(up-jump-rule inConstRuleDelta)
&#8226;        Jump forward or backward within the current rule set. Never use this command where #load blocks may make your jump target unreliable. Please ensure that the rule you are jumping to actually exists. With this action, you can either decrease rules per pass with intelligent skips, or greatly increase it with loops. Please consider game performance.
&#8226;        向前或向后跳过当前的规则集合。不要在#load块可能使您的跳跃目标不可靠的位置使用此命令。请确保您将要跳跃至的规则实际存在。通过此动作,您可或者通过智能的跳跃每通过一次减少规则,或者通过循环极大地增加之。请考虑游戏性能。
Examples for up-jump-rule
示例
1. Skip 1 rule if a condition is true.
若条件为真跳过1条规则。

  1. (defrule
  2. (true)
  3. =>
  4. (up-jump-rule 1)
  5. )
  6. (defrule ; this rule is skipped
  7. (true)
  8. =>
  9. (do-nothing))
复制代码




2. Loop over a rule 3 times.
3次循环1条规则

  1. (defconst gl-value 100)
  2. (defrule
  3. (true)
  4. =>
  5. (chat-local-to-self "Start")
  6. (set-goal gl-value 0)
  7. )
  8. (defrule
  9. (up-compare-goal gl-value < 3)
  10. =>
  11. (up-modify-goal gl-value c:+ 1)
  12. (up-jump-rule -1))
复制代码




up-get-threat-data:
(up-get-threat-data outGoalElapsedTime outGoalPlayerId outGoalSourceClass outGoalTargetClass)
&#8226;        Get the elapsed time, player, source, and target of the last threat.
&#8226;        获取运行的时间,玩家,资源,和上次威胁的目标。
Examples for up-get-threat-data
示例
1.        Store the latest threat information from anywhere on the map.
存储地图上任何位置的最新的威胁信息。

  1. (defconst gl-threat-time 101)
  2. (defconst gl-threat-player 102)
  3. (defconst gl-threat-source 103)
  4. (defconst gl-threat-target 104)
  5. (defrule
  6. (true)
  7. =>
  8. (up-get-threat-data gl-threat-time gl-threat-player gl-threat-source gl-threat-target))
复制代码




up-chat-data-to-all:
(up-chat-data-to-all inTextFormat typeOp inOpValue)
&#8226;        Send a chat message with a formatted value to everyone.
&#8226;        以格式化的值向所有人发送一条聊天信息。
Examples for up-chat-data-to-all
示例
1. Tell everyone what your player number is.
告诉所有人您的玩家编号。

  1. (defrule
  2. (true)
  3. =>
  4. (up-chat-data-to-all "I am player %d." c: my-player-number)
  5. (disable-self))
复制代码




up-chat-data-to-player:
(up-chat-data-to-player inPlayerAny inTextFormat typeOp inOpValue)
&#8226;        Send a chat message with a formatted value to a player.
&#8226;        以格式化的值向一名玩家发送一条聊天信息。
Examples for up-chat-data-to-player
示例
1. Tell every ally know who the current target player is.
告诉所有盟友当前目标玩家是谁。

  1. (defrule
  2. (true)
  3. =>
  4. (up-chat-data-to-player every-ally "The target is player %d." s: sn-target-player-number)
  5. (disable-self))
复制代码




up-chat-data-to-self:
(up-chat-data-to-self inTextFormat typeOp inOpValue)
&#8226;        Send a chat message with a formatted value locally.
&#8226;        以格式化的值向本地发送一条聊天信息。
Examples for up-chat-data-to-self
示例
1. Chat "Food: 5." to self.
向自己聊天“Food: 5.”

  1. (defrule
  2. (true)
  3. =>
  4. (up-chat-data-to-self "Food: %d." c: 5)
  5. (disable-self))
复制代码




chat-debug:
Special Note: This can be used in AoK and AoF
特别注意:此功能可用于AoK和AoF
This is a chat-to-all command that also logs itself to a chat-debug.txt file found in the Logs folder (inside another folder matching your timestamp when you started the game). I found this particularly useful for debugging AI, as I could play a full game then look at the log to see whatever I was interested in.
这是一个将自己记录到存储于Logs文件夹(在其中的与您启动游戏的时间印章匹配的另一个文件夹内)的chat-debug.txt文件的chat-to-all命令。我发现这对调试人工智能特别有用,因为我可以游玩一整场游戏然后观看记录中我感兴趣的任何部分。
Example:
示例

  1. (defrule
  2. (goal upgrade-conflict 19)
  3. (can-research-with-escrow ri-hussar)
  4. =>
  5. (release-escrow food)
  6. (release-escrow gold)
  7. (research ri-hussar)
  8. (chat-debug "UPGRADES research ri-hussar")
  9. (set-goal upgrade-conflict NO))
复制代码




Example Output (with a bunch of other chats too):

[00:00:00] _Standard AI (BASE): AI PETERSEN RULES orders age-advancement NO (starting goals)
[00:00:00] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:00:00] _Standard AI (BASE): AI PETERSEN RULES orders house construction (no houses)
[00:00:26] _Standard AI (BASE): UPGRADES research loom defrule 1
[00:00:54] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:01:20] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:01:20] _Standard AI (BASE): AI PETERSEN RULES orders house construction (housing-headroom < 5 && population-headroom > 0)
[00:01:47] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:02:13] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:02:20] _Standard AI (BASE): AI PETERSEN RULES orders mill construction (don't have any and found food)
[00:02:23] _Standard AI (BASE): AI PETERSEN RULES orders lumber-camp construction (don't have any and found wood, game-time>90)
[00:02:39] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1
[00:03:06] _Standard AI (BASE): AI PETERSEN RULES train villager defrule 1



PATCH 3.4 CHANGES 变更
We've opened up the scripting improvements to the base game, so the new AI scripts (above and below) will work in both flavors now. You still have to keep in mind differences with FE specific maps, civs, units, techs, etc.


New Defines 新定义
&#8226;        up-pocket-position:
If this is defined, then the AI player is in a "pocket position" - that is, it has allies starting on its flanks. For example, suppose in an eight player game players are arranged like so:
A B C D
E F G H
In this case, B, C, F, and G are all in "pocket positions."
&#8226;        若人工智能玩家在“口袋位置”则定义之。这是说,它在其侧面有盟友。
&#8226;        TEAM-TOGETHER:
This is defined if the "Team Together" option is set.
&#8226;        若“组队集中”选项已设置则定义之。
&#8226;        UP-SCENARIO-GAME:
This is defined if the game is in a custom scenario.
&#8226;        若游戏在定制地图上则定义之。
&#8226;        TURBO-RANDOM-MAP:
This is defined if the game mode is "turbo random map."
&#8226;        若游戏模式为“加速随机地图”则定义之。
&#8226;        ALL-TECHS-ENABLED:
This is defined if the "All Techs" option is set.
&#8226;        若“完整科技”选项已设置则定义之。

New Constants 新常量
&#8226;        target-player: Set to the number of the player that should be targeted for attack. If this sn is set to -1, initiating an attack will instead provide assistance to allies. When set to 0, sn-attack-winning-player will determine the target. Setting this to a player that cannot be attacked (an ally or the AI itself) will result in undefined behavior. You can also use this value with the "target-player" identifier in facts and actions.
This is a wildcard option for use with players-building-count, players-building-type-count, players-civilian-population, etc. with the additional effect that the AI's target player selection algorithm will use whatever this is set to as an override. This is set to whatever the player sets it to using sn-target-player-number.
&#8226;        设置应成为攻击目标的玩家的数量。如果此战略数字数值为-1,则发动进攻将改为为盟友提供支援。设置为一个不能进攻的玩家(一个盟友或人工智能自身)将会得到未定义的行为的结果。您也可在事实和动作中和“"target-player”标识符一同使用此数值。
这是一个和players-building-count,players-building-type-count,players-civilian-population,等等一同使用的通配符选项,带有额外的效果,即人工智能的目标玩家选择算法将会使用此常量设置的值覆盖之。使用sn-target-player-number将之设置为玩家设置为的数值。
&#8226;        focus-player: This is a wildcard option for use with players-building-count, players-building-type-count, players-civilian-population, etc. This is set to whatever the player sets it to using sn-focus-player-number.
&#8226;        这是一个和players-building-count,players-building-type-count,players-civilian-population,等等一同使用的通配符选项。使用sn-focus-player-number将之设置为玩家设置为的数值。
&#8226;        huskarl-set
&#8226;        tarken-set

New Strategic Numbers: 新战略数字
&#8226;        sn-percent-building-cancellation: Set to the maximum allowable completion percentage for building cancellation.
&#8226;        设置为最大允许的取消建筑的完成百分比。
&#8226;        sn-enable-new-building-system: Set to 1 to allow the AIs to build more than one of the same building at a time.
&#8226;        设置为1以允许人工智能同时建造多于一个的相同建筑。
&#8226;        sn-target-player-number: Set this to set the target-player wildcard.
&#8226;        设置此项以设置target-player通配符。
&#8226;        sn-focus-player-number:Set this to set the focus-player wildcard.
&#8226;        设置此项以设置focus-player通配符。
&#8226;        sn-preferred-mill-placement:This controls where the AI likes to put mills. Set to 0 for forage, 1 for deer, or 2 for shore fish.
&#8226;        这控制了人工智能放置磨坊的位置。设置为0以偏好浆果丛,1偏好鹿群,2偏好海岸鱼群。
&#8226;        sn-number-civilian-militia: Set to the maximum number of villagers who may be used to attack the enemy. Specifically, to attack the enemy who are in the AI player's town.
&#8226;        设置为最大数量的可能用于攻击敌人的村民。特别是,攻击在人工智能玩家市镇的敌人。
&#8226;        sn-enable-training-queue: Set to 1 to allow an additional unit to be queued at each building. If set to 0, buildings will train one unit at a time.
&#8226;        设置为1以允许一个额外的单位在每个建筑排队等待训练。若设置为0,则建筑一次会训练一个单位。

up-pending-objects:
(up-pending-objects typeOp inOpObjectId compareOp inOpValue)
&#8226;        Perform a comparison with the pending count of an object.
&#8226;        对一个物件的待定数量执行比较。
Examples for up-pending-objects
示例
1. Check if there is at least 1 house pending completion.
检查是否有至少1座房屋等待完成。
  1. (defrule
  2. (up-pending-objects c: house >= 1)
  3. =>
  4. (do-nothing))
复制代码



up-research-status:
(up-research-status typeOp inOpTechId compareOp inOpResearchState)
&#8226;        Check the research status of a specific technology.
&#8226;        检查特定科技的研究状态。
Examples for up-research-status
示例
1. Check if loom is either being researched or already complete.
检查织布机是否正在研究或者已经完成。
  1. (defrule
  2. (up-research-status c: ri-loom >= research-pending)
  3. =>
  4. (do-nothing))
复制代码



up-timer-status:
(up-timer-status inConstTimerId compareOp inOpTimerState)
&#8226;        Check whether a timer is disabled, triggered, running, or a combination.
&#8226;        检查一个计时器是否被禁用,被触发,正在运行,或是以个组合。
Examples for up-timer-status
示例
1. Check if the specified timer is disabled or triggered.
检查指定的计时器是否被禁用或被触发。
  1. (defconst tm-gathering 1)
  2. (defrule
  3. (up-timer-status tm-gathering <= timer-triggered)
  4. =>
  5. (do-nothing))
复制代码



2. Check if the specified timer is running.
检查指定的计时器是否正在运行。
  1. (defconst tm-gathering 1)
  2. (defrule
  3. (up-timer-status tm-gathering == timer-running)
  4. =>
  5. (do-nothing))
复制代码



up-assign-builders:
(up-assign-builders typeOp inOpBuildingId typeOp inOpValue)
&#8226;        Assign a specific number of builders to a building type or class.
&#8226;        指派一个特定数量的建筑工到一个类型或类别的建筑。
Examples for up-assign-builders
示例
1. Assign at least 2 builders for houses (not per house).
指定至少2名建筑工建造房屋(非每座房屋)。
  1. (defrule
  2. (true)
  3. =>
  4. (up-assign-builders c: house c: 2)
  5. (disable-self))
复制代码


2.        Assign at least 4 builders for town centers (special exception).
指定至少4名建筑工建造市镇中心(特别例外)。
  1. (defrule
  2. (true)
  3. =>
  4. (up-assign-builders c: town-center-foundation c: 4) ; town-center-foundation = 621
  5. ;(up-assign-builders c: town-center c: 4) ; error: this will not work
  6. (disable-self))
复制代码



up-reset-unit:
(up-reset-unit typeOp inOpUnitId)
&#8226;        Halt the activity of all units of a specific type. This is equivalent to clicking the "stop" button.
&#8226;        停止特定类型的所有单位的活动。这等价于点击“停止”按钮。
Examples for up-reset-unit
示例
1. Stop all spearmen on the map.
停止地图上所有的长矛兵。
  1. (defrule
  2. (true)
  3. =>
  4. (up-reset-unit c: spearman-line))
复制代码



up-modify-goal:
(up-modify-goal ioGoalId mathOp inOpValue)
&#8226;        Perform math operations on the value stored in a goal variable.
&#8226;        对存储于目标变量的数值执行数学运算。
Examples for up-modify-goal
示例
1. Add 1 to the value stored in "gl-sheep-total".
对存储于“gl-sheep-total”的数值加1。
  1. (defconst gl-sheep-total 101)
  2. (defrule
  3. (true)
  4. =>
  5. (up-modify-goal gl-sheep-total c:+ 1)
  6. (disable-self))
复制代码



up-modify-sn:
(up-modify-sn ioSnId mathOp inOpValue)
&#8226;        Perform math operations on a strategic number.
&#8226;        对战略数字执行数学运算。
Examples for up-modify-sn
示例
1. Subtract 2 from "sn-maximum-town-size".
从“sn-maximum-town-size”减2。
  1. (defrule
  2. (true)
  3. =>
  4. (up-modify-sn sn-maximum-town-size c:- 2)
  5. (disable-self))
复制代码



up-retreat-now:
(up-retreat-now)
&#8226;        Retreat all military units to the home town center.
&#8226;        将所有军事单位撤退至家乡市镇中心。
Examples for up-retreat-now
示例
1. Retreat to the home town center.
撤退至家乡市镇中心。
  1. (defrule
  2. (true)
  3. =>
  4. (up-retreat-now)
  5. (disable-self))
复制代码



up-find-player:
(up-find-player inConstPlayerStance inConstFindPlayerMethod outGoalPlayerId)
&#8226;        Find the first active player based on the provided information.
&#8226;        基于提供的信息寻找第一个活跃的玩家。
Examples for up-find-player
示例
1. Store the closest enemy player into gl-player.
将最近的敌人玩家存储至gl-player。
(
  1. defconst gl-player 101)
  2. (defrule
  3. (true)
  4. =>
  5. (up-find-player enemy find-closest gl-player))
复制代码



New operators 新的运算子
The 'c' prefix indicates that the operator works on consts, the 'g' prefix indicates that the operator works on goals, and the 's' prefix indicates that the operator works on strategic numbers.
‘c’前缀指示运算子对常量工作,‘g’前缀指示运算子对目标工作,‘s’前缀指示运算子对战略数字工作,
&#8226;        c:<
&#8226;        c:<=
&#8226;        c:>
&#8226;        c:>=
&#8226;        c:==
&#8226;        c:!=
&#8226;        g:<
&#8226;        g:<=
&#8226;        g:>
&#8226;        g:>=
&#8226;        g:==
&#8226;        g:!=
&#8226;        s:<
&#8226;        s:<=
&#8226;        s:>
&#8226;        s:>=
&#8226;        s:==
&#8226;        s:!=



Authenticated by YTY Tech ®, Clm0081 Inc.®, and Snowstar Labs ®;

鈦星伺服器禪宗組
忠正尚武特殊警备战空输司令部
GL帝国生死以,岂因HF避趋之。
回复

使用道具 举报

本版积分规则

排行榜|小黑屋|翔鹰帝国

GMT+8, 2024-12-23 08:00 , Processed in 0.352426 second(s), 20 queries , File On.

Powered by Hawk Studio  QS Security Corp.® Licensed

Copyright © 2001-2023, Hawkaoe.net All Rights Reserved

快速回复 返回顶部 返回列表