跳到主要内容

物品动作

给东西、收东西。这一页的 4 种类型在编辑器的「物品」分类里。item 的写法见 触发与目标 的「物品写法」。

例子​

铁匠收 10 个铁锭,换一把剑:

plugins/StarQuest/quests/示例/铁匠的剑.yml
format: 1
id: 铁匠的剑
name: '&f铁匠的剑'
category: 示例
icon: IRON_SWORD
settings:
start: {command: true}
repeat: {mode: unlimited}
requirements:
- {type: item, item: IRON_INGOT, amount: 10}
nodes:
开始:
type: start
x: 0
y: 100
next: [打造]
打造:
type: action
x: 260
y: 100
actions:
- {type: take, item: IRON_INGOT, amount: 10, notify: true}
- {type: give, item: IRON_SWORD, amount: 1, notify: true}
next: [完成]
完成:
type: end
x: 520
y: 100
result: complete

聊天栏依序出现「交出 铁锭 ×10」「获得 铁剑 ×1」。

给予物品 give​

  • item(物品):必填
  • amount(数量):可以写变量
  • mail-if-full(背包满了寄到邮箱):默认 true
  • notify(提示「获得 xxx」):默认 false
- {type: give, item: 'ci:龙鳞剑', amount: 1}
- {type: give, item: 'saved:星辰宝箱钥匙', amount: '{var:钥匙数}', notify: true}

写在完成奖励里时,任务日志的奖励栏会自动显示「龙鳞剑 ×1」。

拿走物品 take​

  • item(物品):必填
  • amount(数量):可以写变量
  • partial(不够也拿走全部):默认 false,不够就一个都不拿;true 就有多少拿多少
  • notify(提示「失去 xxx」):聊天栏显示「交出 铁锭 ×10」
  • match(比对方式):id(默认)、type、exact
- {type: take, item: 'ci:任务信件', amount: 1}

掉落物品 drop​

把物品掉在地上。

  • item(物品):必填
  • amount(数量)
  • location(位置):不写 = 玩家脚下
- {type: drop, item: GOLDEN_APPLE, amount: 3, location: 'world,100,65,-20'}

穿上 / 拿在手上 equip​

直接把物品放到某个部位,原本那格的东西放回背包,放不下就掉在脚下。

  • item(物品):必填
  • slot(部位):hand 主手(默认)、offhand 副手、head 头、chest 胸、legs 腿、feet 脚
- {type: equip, item: 'ci:守林人斗篷', slot: chest}

背包满了​

give 放不下的部分:

  • 装了星月邮箱 StarMail,且 mail-if-full 是 true:寄到邮箱,邮件标题是任务名称,玩家看到「背包满了,剩下的奖励已寄到星月邮箱」
  • 没装星月邮箱,或写了 mail-if-full: false:掉在玩家脚下,玩家看到「背包满了,剩下的奖励掉在你脚下」

更多做法见 背包满了。

会踩的坑​

take 不写 partial 时,数量不够就什么都不拿,后面的动作照样执行。要「拿到才给」,先用接取条件或判断节点检查「背包有物品」。

物品 ID 写错或对应的物品插件没装时,give 什么都不给,后台印一次「物品无法产生」。

完成奖励里的 give 已经会列在「获得奖励:」下面,不用再加 notify: true,不然同一样东西会说两次。

0:000:00