跳到主要内容

逻辑条件

把别的条件组合起来,或比较两个数字、两段文字。这一页的 6 种类型在编辑器的「逻辑」分类里。

例子​

VIP 或 30 级以上,再加上三个支线做完任意两个:

plugins/StarQuest/quests/示例/北境远征.yml
format: 1
id: 北境远征
name: '&b北境远征'
category: 示例
icon: DIAMOND_SWORD
settings:
start: {command: true}
repeat: {mode: once}
requirements:
- type: any
message: '&e需要 VIP 或 30 级'
conditions:
- {type: permission, permission: vip.use}
- {type: level, compare: '>=', value: 30}
- type: count
min: 2
message: '&e先做完任意两个支线'
conditions:
- {type: quest, quest: 支线A, status: completed}
- {type: quest, quest: 支线B, status: completed}
- {type: quest, quest: 支线C, status: completed}
rewards:
- {type: exp, mode: levels, amount: 5}
nodes:
开始:
type: start
x: 0
y: 100
next: [远征]
远征:
type: objective
x: 260
y: 100
track-text: 前往北境
goals:
- {type: kill, entity: [STRAY], amount: 10}
next: [完成]
完成:
type: end
x: 520
y: 100
result: complete

条件不够时 /sq start 北境远征 会显示 message 里写的那句话。

全部满足 all​

里面的条件全部满足才成立。列表本来就是全部满足,这个类型用在 any 里面要再分一组的时候。

  • conditions(条件):必填
- type: any
conditions:
- {type: permission, permission: vip.use}
- type: all
conditions:
- {type: level, compare: '>=', value: 20}
- {type: tag, tag: 见过精灵王}

任意一个满足 any​

里面任意一个满足就成立。列表是空的时也算成立。

  • conditions(条件):必填
- type: any
conditions:
- {type: world, world: [world]}
- {type: world, world: [world_nether]}

满足其中几个 count​

里面成立的条件数量在 min 到 max 之间。

  • conditions(条件):必填
  • min(至少几个):默认 1
  • max(至多几个):默认 99
- type: count
min: 1
max: 1
conditions:
- {type: tag, tag: 阵营_光}
- {type: tag, tag: 阵营_影}

上面这个是「两个阵营刚好选了一个」。

随机机率 random​

每次检查时有一定机率成立。

  • chance(机率 %):0 到 100,默认 50
- {type: random, chance: 20}

数字比较 number​

比较两个数字,两边都可以写变量和 %PAPI 变量%。

  • a(数字 A):必填
  • compare(比较):默认 >=
  • b(数字 B):必填
- {type: number, a: '{point:光明声望}', compare: '>', b: '{point:暗影声望}'}

文字比较 text​

  • text(文字):必填,可以写变量
  • compare(方式):= 等于(默认)、!= 不等于、contains 包含、regex 正则表达式、ignorecase 忽略大小写相等
  • value(比较对象):必填,可以写变量
- {type: text, text: '%player_world%', compare: contains, value: dungeon}

会踩的坑​

any、count 不满足时,玩家看到的原因是里面第一个条件的原因,常常看不懂。给外层写一句 message 最清楚。

「数字比较」读不成数字时(变量是空的、PAPI 没装):A 当成 0,B 读不成的话整个条件直接不成立。

「随机机率」放在判断节点里,每走到一次抽一次;放在对话选项上,每次打开对话都重新抽,选项会时有时无。

0:000:00