脚本编写参考UP13.docx
- 文档编号:11303791
- 上传时间:2023-02-26
- 格式:DOCX
- 页数:139
- 大小:59.97KB
脚本编写参考UP13.docx
《脚本编写参考UP13.docx》由会员分享,可在线阅读,更多相关《脚本编写参考UP13.docx(139页珍藏版)》请在冰豆网上搜索。
脚本编写参考UP13
脚本编写参考——UserPatch1.3版
UserPatch1.3相对于1.0c的全局改进
·所有使用>,>=,<,<=,==,!
=来执行数据比较的事实现在都支持比较运算符。
·字符串表扩充为5000条。
·defconst命令可以定义字符串常数。
·规则数量上限扩充为10000。
·有效目标(goal)编号范围扩充为1~512。
·有效定时器(timer)编号范围扩充为1~50。
行动(Actions)
up-add-cost-data
语法
up-add-cost-data(in)(goal)目标编号类型操作符(in)(op)值
功能
在当前建造成本数据基础上增加或减去某数量的建造成本。
示例
1.向gl-cost-food代表的当前建造成本数据增加2份军事单位建造成本数据。
(defconstgl-cost-food101)
(defconstgl-cost-wood102)
(defconstgl-cost-stone103)
(defconstgl-cost-gold104)
(defconstgl-military-cost-food111)
(defconstgl-military-cost-wood112)
(defconstgl-military-cost-stone113)
(defconstgl-military-cost-gold114)
(defrule
(true)
=>
(up-setup-cost-data1gl-military-cost-food)
(up-add-object-costc:
knight-linec:
40)
(up-setup-cost-data1gl-cost-food)
(up-add-cost-datagl-military-cost-foodc:
2)
(disable-self)
)
up-add-object-cost
语法
up-add-object-cost类型操作符(in)(op)物件编号类型操作符(in)(op)值
功能
在当前建造成本数据基础上增加或减去若干个给定物件的建造成本。
示例
1.向gl-cost-food代表的当前建造成本数据增加4个长矛兵的建造成本。
(defconstgl-cost-food101)
(defconstgl-cost-wood102)
(defconstgl-cost-stone103)
(defconstgl-cost-gold104)
(defrule
(true)
=>
(up-setup-cost-data0gl-cost-food)
(up-add-object-costc:
spearmanc:
4)
(disable-self)
)
2.增加1个城镇中心的建造成本(特例)。
(defrule
(true)
=>
(up-add-object-costc:
town-center-foundationc:
1);town-center-foundation=621
;(up-add-object-costc:
town-centerc:
1);错误,这样不包括石头消耗
(disable-self)
)
up-add-point
语法
up-add-point(io)(goal)点1(in)(goal)点2类型操作符(in)(op)值
功能
加或减两组表示点的目标对。
给操作数赋负值表示减。
通过把目标点2设为0来使用up-set-target-point存储的点。
示例
1.把焦点玩家和目标玩家所在位置相加。
(defconstgl-point-x100)
(defconstgl-point-y101)
(defconstgl-other-x200)
(defconstgl-other-y201)
(defrule
(true)
=>
(up-get-pointposition-focusgl-point-x)
(up-get-pointposition-targetgl-other-x)
(up-add-pointgl-point-xgl-other-xc:
1)
)
up-add-research-cost
语法
up-add-research-cost类型操作符(in)(op)科技编号类型操作符(in)(op)值
功能
在当前建造成本数据基础上增加或减去若干个给定科技的研发成本。
示例
1.从gl-cost-food代表的当前建造成本数据中减去织布机的研发成本。
(defconstgl-cost-food101)
(defconstgl-cost-wood102)
(defconstgl-cost-stone103)
(defconstgl-cost-gold104)
(defrule
(true)
=>
(up-setup-cost-data0gl-cost-food)
(up-add-research-costc:
ri-loomc:
-1)
(disable-self)
)
up-assign-builders
语法
up-assign-builders类型操作符(in)(op)建筑编号类型操作符(in)(op)值
功能
为给定种类的建筑指定给定数量的建筑工。
示例
1.为所有住房(并非每个住房)指派至少2名建筑工。
(defrule
(true)
=>
(up-assign-buildersc:
housec:
2)
(disable-self)
)
2.为城镇中心指派至少4名建筑工。
(特例)
(defrule
(true)
=>
(up-assign-buildersc:
town-center-foundationc:
4);town-center-foundation=621
;(up-assign-buildersc:
town-centerc:
4);错误,这条语句无效
(disable-self)
)
up-build
语法
up-build(in)(const)放置类型(in)(goal)储备资源状态类型操作符(in)(op)建筑编号
功能
使用变量,向建筑序列中增加一个建筑。
示例
1.不使用储备资源,建筑一个哨站。
(defrule
(up-can-build0c:
outpost)
=>
(up-buildplace-normal0c:
outpost)
)
up-cc-send-cheat
语法
up-cc-send-cheat(in)(text)代码
功能
执行一次作弊。
示例
1.使用“tosmithereens”作弊代码生产一个英雄破坏者。
(defrule
(true)
=>
(up-cc-send-cheat"tosmithereens")
(disable-self)
)
up-change-name
语法
up-change-name(in)(text)新名称
功能
在游戏运行时改变AI玩家名称。
示例
1.改变AI玩家名称为“WilliamWallace”。
(defrule
(true)
=>
(up-change-name"WilliamWallace")
(disable-self)
)
up-chat-data-to-all
语法
up-chat-data-to-all(in)(text)格式类型操作符(in)(op)值
功能
向所有玩家发送一条格式化后的聊天内容。
示例
1.告诉所有玩家你的玩家编号。
(defrule
(true)
=>
(up-chat-data-to-all"Iamplayer%d."c:
my-player-number)
(disable-self)
)
up-chat-data-to-player
语法
up-chat-data-to-player(in)(player)玩家(in)(text)格式类型操作符(in)(op)值
功能
向给定玩家发送一条格式化后的聊天内容。
示例
1.告诉所有同盟当前的目标玩家编号。
(defrule
(true)
=>
(up-chat-data-to-playerevery-ally"Thetargetisplayer%d."s:
sn-target-player-number)
(disable-self)
)
up-chat-data-to-self
语法
up-chat-data-to-self(in)(text)格式类型操作符(in)(op)值
功能
向自己发送一条格式化后的聊天内容。
示例
1.向自己发送聊天内容“Food:
5.”。
(defrule
(true)
=>
(up-chat-data-to-self"Food:
%d."c:
5)
(disable-self)
)
up-copy-point
语法
up-copy-point(out)(goal)点1(in)(goal)点2
功能
把一组表示点的目标对复制给另一组目标对。
示例
1.复制地图中心点位置。
(defconstgl-point-x100)
(defconstgl-point-y101)
(defconstgl-other-x200)
(defconstgl-other-y201)
(defrule
(true)
=>
(up-get-pointposition-centergl-point-x)
(up-copy-pointgl-other-xgl-point-x)
)
up-cross-tiles
语法
up-cross-tiles(io)(goal)点1(in)(goal)点2类型操作符(in)(op)网格数
功能
获取一个垂直于给定的两组表示点的目标对相连而成的直线的点。
网格数为负值表示相减。
把点2设置为0,以使用存储在up-set-target-point中的点。
示例
1.获取相对于地图中心而言,主城镇中心右侧10格的点。
(defconstgl-point-x100)
(defconstgl-point-y101)
(defconstgl-center-x200)
(defconstgl-center-y201)
(defrule
(true)
=>
(up-get-pointposition-selfgl-point-x)
(up-get-pointposition-centergl-center-x)
(up-cross-tilesgl-point-xgl-center-xc:
10)
)
up-delete-distant-farms
语法
up-delete-distant-farms类型操作符(in)(op)值
功能
删除所有给定资源放置距离以外的农田。
示例
1.删除所有“最小资源放置距离”大于8的农田。
(defrule
(true)
=>
(up-delete-distant-farmsc:
8)
(disable-self)
)
up-delete-idle-units
语法
up-delete-idle-units(in)(const)闲置单位类型
功能
删除所有给定类型的闲置单位。
示例
1.删除所有闲置村民。
(defrule
(true)
=>
(up-delete-idle-unitsidle-type-villager)
(disable-self)
)
up-delete-objects
语法
up-delete-objects类型操作符(in)(op)单位编号类型操作符(in)(op)生命值
功能
删除所有生命值低于给定值的单位。
示例
1.删除所有城墙。
(defrule
(true)
=>
(up-delete-objectsc:
wall-classc:
32767);wall-class=927
(disable-self)
)
up-disband-group-type
语法
up-disband-group-type(in)(const)编组类型
功能
解散所有给定类型的内部编组。
示例
1.用一种更直接的方式停止所有陆地探索编组。
(defrule
(true)
=>
(set-strategic-numbersn-number-explore-groups0)
(set-strategic-numbersn-total-number-explorers0)
(up-disband-group-typegroup-type-land-explore)
(up-reset-unitc:
all-units-class)
(disable-self)
)
up-drop-resources
语法
up-drop-resources(in)(const)资源类型操作符(in)(op)值
功能
要求携带给定数量资源的村民上交资源。
示例
1.命令所有携带至少15食物的食物采集者上交资源。
(defrule
(true)
=>
(up-drop-resourcesfoodc:
15)
(disable-self)
)
2.命令所有携带至少5食物的农民上交资源。
(defrule
(true)
=>
(up-drop-resourcesfarm-classc:
5);farm-class=949
(disable-self)
)
up-filter-distance
语法
up-filter-distance类型操作符(in)(op)最小距离类型操作符(in)(op)最大距离
功能
为直接寻的系统设置距离参数。
若某个参数设为-1,则过滤搜索会忽略此条件。
示例
1.设置搜索系统,使其选择目标点周围10格以内的单位。
(defrule
(true)
=>
(up-filter-distancec:
-1c:
10)
)
up-filter-exclude
语法
up-filter-exclude(in)(const)命令编号(in)(const)行动编号(in)(const)执行编号(in)(const)类别编号
功能
为直接寻的系统设置排除参数。
若某个参数设为-1,则过滤搜索会忽略此条件。
示例
1.设置搜索系统,使其排除具有贸易命令编号的单位。
(defrule
(true)
=>
(up-filter-exclude5-1-1-1)
)
up-filter-garrison
语法
up-filter-garrison类型操作符(in)(op)最小驻扎数类型操作符(in)(op)最大驻扎数
功能
为直接寻的系统设置驻扎数参数。
若某个参数设为-1,则过滤搜索会忽略此条件。
示例
1.设置搜索系统,使其选择驻扎了至少5个单位的单位。
(defrule
(true)
=>
(up-filter-garrisonc:
5c:
-1)
)
up-filter-include
语法
up-filter-include(in)(const)命令编号(in)(const)行动编号(in)(const)执行编号(in)(const)位于主大陆
功能
为直接寻的系统设置包括参数。
若某个参数设为-1,则过滤搜索会忽略此条件。
示例
1.设置搜索系统,使其选择具有村民命令编号的单位。
(defrule
(true)
=>
(up-filter-include3-1-1-1)
)
up-filter-range
语法
up-filter-range(in)(const)最小驻扎数(in)(const)最大驻扎数(in)(const)最小距离(in)(const)最大距离
功能
为直接寻的系统设置范围参数。
若某个参数设为-1,则过滤搜索会忽略此条件。
示例
1.设置搜索系统,使其选择目标点周围10格以内的单位。
(defrule
(true)
=>
(up-filter-range-1-1-110)
)
up-find-flare
语法
up-find-flare(out)(goal)点
功能
获取同盟发送的闪光信号坐标,写入表示点的目标对中。
命令会写入两个连续编号的命令对中,合法目标编号范围为41至510。
如果获取失败,会返回(-1,-1)。
命令等效于up-find-player-flareany-ally。
示例
1.获取最新的同盟闪光信号位置。
(defconstgl-point-x100)
(defconstgl-point-y101)
(defrule
(unit-type-countflare>0);flare=274
=>
(up-find-flaregl-point-x)
)
up-find-local
语法
up-find-local类型操作符(in)(op)单位编号类型操作符(in)(op)数量
功能
寻找本地玩家的物件,供直接寻的使用。
如果单位编号改变,那么搜索索引偏移会重置。
反之,搜索会从上次搜索结束处继续。
本命令可以当做事实或行动使用。
示例
1.寻找玩家拥有的至多20个步兵单位。
(defrule
(true)
=>
(up-find-localc:
infantry-classc:
20);infantry-class=906
)
up-find-next-player
语法
up-find-next-player(in)(const)玩家外交状态(in)(const)寻找玩家方法(io)(goal)玩家编号
功能
寻找下一个符合给定信息的活动玩家。
示例
1.寻找距离自己第二近的敌对玩家,存储在gl-player中。
(defconstgl-player101)
(defrule
(true)
=>
(up-find-playerenemyfind-closestgl-player)
(up-find-next-playerenemyfind-closestgl-player)
)
up-find-player
语法
up-find-player(in)(const)玩家外交状态(in)(const)寻找玩家方法(out)(goal)玩家编号
功能
寻找第一个符合给定信息的活动玩家。
示例
1.寻找距离自己最近的敌对玩家,存储在gl-player中。
(defconstgl-player101)
(defrule
(true)
=>
(up-find-playerenemyfind-closestgl-player)
)
up-find-player-flare
语法
up-find-player-flare(in)(player)玩家(out)(goal)点
功能
获取任意可见的闪光信号,读取其位置到表示点的目标对中。
命令会写入两个连续编号的命令对中,合法目标编号范围为41至510。
如果获取失败,会返回(-1,-1)。
示例
1.获取任意敌对玩家闪光信号位置。
(defconstgl-point-x100)
(defconstgl-point-y101)
(defrule
(unit-type-countflare>0);flare=274
=>
(up-find-player-flareany-enemygl-point-x)
)
up-find-remote
语法
up-find-remote类型操作符(in)(op)单位编号类型操作符(in)(op)数量
功能
寻找焦点玩家的物件,供直接寻的使用。
使用本命令前,要设置sn-focus-player-number。
如果单位编号改变,那么搜索索引偏移会重置。
反之,搜索会从上次搜索结束处继续。
本命令可以当做事实或行动使用。
示例
1.寻找敌对玩家2拥有的至多4个城堡。
(defrule
(true)
=>
(set-strategic-numbersn-focus-player-number2)
(up-find-remotec:
castlec:
4)
)
up-garrison
语法
up-garrison(in)(const)物件编号类型操作符(in)(op)单位编号
功能
命令所有给定类型的单位驻扎到给定物件中。
第一个参数不允许是一个类别或者兵系。
它必须是能够驻扎其他单位的有效根物件(battering-ram而不是battering-ram-line)。
示例
1.命令所有可用的步兵单位驻扎到冲车中。
(defrule
(true)
=>
(up-garrisonbattering-ramc:
infantry-class);infantry-class=906
(disable-self)
)
2.命令所有可用的弓箭手驻扎到塔中。
(defrule
(true)
=>
(up-garrisonwatch-towerc:
archer-line)
(disable-self)
)
up-gather-inside
语法
up-gather-inside类型操作符(in)(op)建筑编号类型操作符(in)(op)状态
功能
命令所有给定类型的建筑生产集结点为建筑本身。
示例
1.命令船坞训练的船只驻扎在船坞内,一旦训练了10艘船再释放。
(defrule
(true)
=>
(up-gather-insidec:
dockc:
1)
(disable-self)
)
(defrule
(unit-type-countwarship-class>=10);warship-class=922
=>
(up-gather-insidec:
dockc:
0)
)
2.阻止城镇中心释放驻扎单位,但同时允许继续训练村民。
(defrule
(true)
=>
(up-gather-insidec:
town-centerc:
-1)
(disable-self)
)
up-get-attacker-class
语法
up-g
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 脚本 编写 参考 UP13
![提示](https://static.bdocx.com/images/bang_tan.gif)