跳到主要内容

玩家动作

对玩家本人做事:执行指令、传送、加效果、弹飞。这一页的 20 种类型在编辑器的「玩家」分类里。

例子​

进入密林时天色变暗、加上夜视,再传送到入口:

plugins/StarQuest/quests/示例/进入密林.yml
format: 1
id: 进入密林
name: '&2进入密林'
category: 示例
icon: OAK_SAPLING
settings:
start: {command: true}
repeat: {mode: unlimited}
nodes:
开始:
type: start
x: 0
y: 100
next: [入林]
入林:
type: action
x: 260
y: 100
actions:
- {type: player-time, time: 18000}
- {type: effect, effect: night_vision, duration: 60s, level: 1}
- {type: teleport, location: {world: world, x: 300.5, y: 70, z: -120.5, yaw: 90, pitch: 0}, delay: 1s}
- {type: command, as: console, commands: ['say {player} 走进了密林']}
next: [完成]
完成:
type: end
x: 520
y: 100
result: complete

/sq start 进入密林 后只有你自己的天空变成午夜,一秒后被传送到入口,后台替你说一句话。之后要恢复时间,再执行一次 {type: player-time, time: -1}。

执行指令 command​

  • commands(指令,不用加 /):必填,列表,一行一个。{player} = 玩家名,可写 %PAPI 变量%
  • as(执行者):console 后台(默认)、player 玩家自己、op 玩家(暂时 OP)
- {type: command, as: console, commands: ['eco give {player} 100', 'lp user {player} parent add vip']}

让玩家说话 chat​

替玩家在聊天栏说一句话。开头写 / 就变成让玩家执行指令。

  • text(内容):必填
- {type: chat, text: '我愿意加入守林人!'}

传送 teleport​

  • location(位置):必填,可以带 yaw、pitch 决定面朝方向
- {type: teleport, location: 'world,100,64,-20,90,0'}

药水效果 effect​

  • effect(效果):必填,例如 speed、night_vision、slowness
  • duration(持续):默认 30s
  • level(等级):默认 1
  • particles(显示粒子):默认 true
  • icon(显示图示):默认 true
- {type: effect, effect: speed, duration: 2m, level: 2, particles: false}

移除药水效果 remove-effect​

  • effect(效果):可写多个,不写 = 全部移除
- {type: remove-effect, effect: [poison, wither]}

治疗 heal​

  • amount(回复生命):不写或 0 = 补满
  • food(同时吃饱):默认 false
- {type: heal, food: true}

饱食度 food​

  • mode(操作):give 增加、take 减少、set 设定(默认)
  • amount(数值):默认 20
- {type: food, mode: take, amount: 6}

造成伤害 damage​

  • amount(伤害):默认 2 = 一颗心
- {type: damage, amount: 4}

杀死玩家 kill​

没有参数。

- {type: kill}

着火 burn​

  • duration(时长):默认 5s
- {type: burn, duration: 3s}

推动 / 弹射 velocity​

给玩家一个速度,做跳台、击退。

  • x、y(向上)、z:默认 0、1、0
  • direction(方向):absolute 世界方向(默认)、relative 以玩家面朝方向(z 是往前,x 是往右)、relative-y 同上但只算水平方向
  • add(加在原本速度上):默认 false
- {type: velocity, x: 0, y: 1.2, z: 1.5, direction: relative-y}

游戏模式 gamemode​

  • mode(模式):必填,survival 生存、creative 创造、adventure 冒险、spectator 旁观
- {type: gamemode, mode: adventure}

允许飞行 fly​

  • allow(允许):默认 true,false 会让正在飞的玩家掉下来
- {type: fly, allow: false}

发光 glow​

  • duration(时长):默认 10s
- {type: glow, duration: 30s}

指南针指向 compass​

  • location(位置):不写 = 世界出生点
- {type: compass, location: 'world,400,72,120'}

关闭界面 close-inventory​

关掉玩家正开着的箱子、菜单。没有参数。

- {type: close-inventory}

玩家看到的时间 player-time​

只改这位玩家看到的时间,做过场用。

  • time(时间,tick):默认 18000 午夜,-1 = 恢复成世界时间
- {type: player-time, time: 6000}

玩家看到的天气 player-weather​

  • weather(天气):clear 晴(默认)、rain 雨、reset 恢复
- {type: player-weather, weather: rain}

打开云界面画面 cloudui​

需要云界面 CloudUI。

  • screen(画面 ID):必填
- {type: cloudui, screen: cosmetics}

打开任务日志 open-log​

打开星月纪事的任务日志,没有参数。

- {type: open-log}

会踩的坑​

command 的 as: op 是执行那一瞬间给 OP 再拿掉。能不用就不用,大部分指令用 console 执行、带上 {player} 就够了。

player-time 和 player-weather 会一直维持到恢复为止,过场结束记得写一个 time: -1 / weather: reset。

teleport 的坐标写整数时会站在方块的角上,要站在方块正中间就写 .5。

0:000:00