Vocation
懂的,因为她是个 voca- 算了
Vocation 是一个关于在屏幕上显示文本(以及配音)消息的模组。查看该视频以获取一个简短(不到1分钟)的演示。此模组旨在供整合包开发者等使用。这是我某天在直播中大约7-8小时内制作的模组,所以可能不是特别出色。
演示中显示的“教程”不包含在模组内。
如何开始:
- 安装 Vocation(该模组需同时存在于服务器和客户端)
- 运行游戏一次
- 在模组和配置文件夹旁边找到 vocation_data 文件夹
- 在该文件夹内创建一个新文件夹,名称随意,将你的内容放入其中
- 如果你想要配音或音效,请在刚才创建的新文件夹中建立一个名为 "audio" 的文件夹
- 在您创建的文件夹中(不是“audio”)创建一个文件,您可以随意命名,但必须是 .json 文件。您可以创建任意数量的此类文件。
- 将你的消息放入你创建的 .json 文件中。你可以拥有任意数量的消息,也可以将它们放在任意位置。支持多条消息的功能只是为了让你更好地组织内容。
- 确保服务器端和客户端的文件一致。服务器端可以缺少音频文件,但 .json 文件必须保持一致。
消息格式:
你可以获取一个示例文件(即演示视频中使用的文件),点击这里。建议你在阅读完本文其余部分后再查看该示例,以便更好地了解如何使用此功能。
消息采用标准 JSON 格式。文件的根节点必须是一个简单的数组:
在数组内部,你可以添加任意数量的消息。以下是单条消息的格式:
{
"id": "(此消息的 ID)",
"message": "(显示在屏幕上的消息内容)",
"narrator": "(显示在消息上方的名称)",
"time": "(希望该消息在屏幕上停留的刻数)",
"voiceover": "(当此消息出现时播放的音效,必须是位于你音频文件夹中的 .ogg 文件名,可选)",
"requirements": (一个消息 ID 数组,玩家必须至少看过一次这些消息,此消息才会在触发事件后出现,可选),
"triggers": (触发此消息显示的条件,这些条件之间是“或”的关系,即满足其中任意一个时消息就会显示,可选,触发器格式将在后文展示)
"actions": (消息显示时将执行的操作,可选,操作格式将在后文展示)
}
虽然 "message" 不是必填项,但你可以将其留空。如果留空,消息将不会显示,但仍会被视为已查看,且其关联的操作仍会执行。你可以利用这一点来在特定条件下触发某些效果,或者构建更复杂的需求链。
触发器也是可选的,因为存在用于显示消息的命令;如果你不想使用触发器,可以直接使用该命令。以下是触发器的格式。
"triggers": [
{
"trigger": "message_seen (当玩家已看过 Vocation 模组的另一条消息时触发)",
"key": "(要检查的消息 ID)"
},
{
"trigger": "stat_above (当玩家的某项统计数据高于指定值时触发)",
"key": "(要检查的统计数据名称)",
"value": "(该统计数据必须达到的最低值,才能触发此条件)"
},
{
"trigger": "item_pickup (当玩家拾取物品时触发)",
"stack": (要检查的物品堆栈,物品堆栈格式将在后文展示)
},
{
"trigger": "item_craft (当玩家合成物品时触发)",
"stack": (要检查的物品堆栈,物品堆栈格式将在后文展示)
},
{
"trigger": "mob_kill (当玩家杀死生物时触发)",
"key": "(需要被杀死的生物名称)"
}
]
一旦消息被触发,其关联的操作(如果有)将会执行。你可以添加任意数量的操作。目前可用的操作不多,但它们应该能处理大多数常见情况。以下是操作的格式。
"actions": [
{
"action": "give_item (向玩家给予物品)",
"stack": (要给予玩家的物品堆栈,物品堆栈格式将在后文展示)
},
{
"action": "run_command (运行一条命令,权限等同于命令方块,执行位置为玩家所在位置)",
"param": "(在此处填写要执行的命令,包含 /)"
}
]
最后,以下是堆栈的格式。
"stack": {
"id": "(物品的 ID,包含模组 ID,例如:minecraft:log)",
"metadata": "(此物品的元数据。可选。如果未提供,物品元数据将为零;如果在触发器中使用该堆栈,则不会检查元数据)"
"stackSize": "(此堆栈的大小。可选。如果未提供,堆叠大小将为 1。对于触发器来说完全无关紧要)",
"nbt": (此物品的 NBT JSON 对象,类似于你在使用 /give 命令时会使用的格式。可选。如果未提供且在触发器中使用该堆栈,则不会检查 NBT)
}
指令
该模组还附带了一些指令,可通过 run_command 动作、命令方块或服务器管理员使用:
- /vocation-review - 任何人都可以使用此指令,重新发送玩家上次看到的职业消息,不执行任何操作
- /vocation-reload - 管理员指令,重新加载所有职业文件
- /vocation-clear <player> - 命令方块+ 指令,清除玩家的职业数据
- /vocation-set-seen <player> <id> <true/false> - 命令方块+ 指令,设置玩家的消息(按消息 ID)已读或未读标志(这样它以后就不会显示,或者如果你希望它多次显示,它就会显示)。这不会触发操作,但如果在你将其设置为 false 之后发生了触发器,操作将再次发生。
- /vocation-show <player> <id> [do-actions] - 命令方块+ 指令,向发送的玩家显示给定的消息(按消息 ID)。末尾的 "do-actions" 是可选的,但如果存在且消息尚未被阅读,则会执行操作并将消息标记为已读。如果不存在,消息将不会被标记为已读。
- /vocation-check <player> <id> - 命令方块指令,如果玩家已经阅读了该消息(按消息 ID),则发出比较器信号。其工作原理类似于 /testfor,如果你熟悉后者的话。
源代码
如果你对该模组有任何问题,或者只是想联系我,你可以在 Twitter (@Vazkii) 或 IRC (irc.esper.net 上的 #vazkii) 上找到我。
Vocation
Get it, cuz she's a voca- nevermind
Vocation is a mod about text (and voice acted) messages appearing on screen. Check out that video for a short (under 1 minute) demo. The mod is intended for pack developers and similar. This is a mod I made in around 7-8 hours on a stream one day, so it might not be super amazing.
The "Tutorial" shown in the demo is not included with the mod.
How to get started:
- Install Vocation (mod needs to be present on both the server and client)
- Load the game once
- Find the vocation_data folder next to your mods and config folders
- Create a folder inside there. Name it whatever you want. You'll put your stuff inside
- If you want voice acting or sounds, create an "audio" folder inside that new folder you made
- Create a file in the folder you made (not "audio"), you can name it whatever you want, but it must be a .json file. You can make as many of these as you want.
- Put your messages on the .json files you made. There's no limit to how many you can have or where they need to be. The ability to have multiple is just for organizing yourself better.
- Make sure the files on the server and client are the same. Audio files can be missing on the server, but .jsons need to be the same.
Message format:
You can get an example file, the one used in the demo video, right here. I would advise you to do so after you're read through the rest of this so you can get a good idea on how to use this.
Messages are in a normal JSON format. The base of the file must be a simple array:
[
(your messages go here)
]
Inside your array, you can put as many messages as you want. Here's the format for a message:
{
"id": "(the ID of this message)",
"message": "(the message to show up on screen)",
"narrator": "(the name to show up above the message)",
"time": "(how long, in ticks, you want this message to stay on screen)",
"voiceover": "(the sound to play when this message appears, must be the name of an .ogg file located in your audio folder, optional)",
"requirements": (an array of message IDs that the player needs to have seen at least once for this message to appear once a trigger happens, optional),
"triggers": (the things that will trigger this message to appear, this is an "or" when any of these are fulfilled, the message will appear, optional, trigger format will be shown later),
"actions": (the things that will happen when this message appears, optional, action format will be shown later)
}
While "message" is not optional, you can leave it empty. If you do, the message will not display, but it'll still count as seen, and its actions will still be performed. You can use this for having stuff happen on condition or just to create more complex requirement chains.
Triggers are also optional, as there is a command to show a message, you can use that if you don't want a trigger. Here's the trigger format.
"triggers": [
{
"trigger": "message_seen (this trigger happens whether another message from Vocation has been seen)",
"key": "(the ID of the message to check for)"
},
{
"trigger": "stat_above (this trigger happens whenever a player's stat is above a value)",
"key": "(the name of the stat to check)",
"value": "(the value that the stat has to be, at the least, for this trigger to happen)"
},
{
"trigger": "item_pickup (this trigger happens when the player picks an item up)",
"stack": (the item stack to check for, stack format will be shown later)
},
{
"trigger": "item_craft (this trigger happens when the player crafts an item)",
"stack": (the item stack to check for, stack format will be shown later)
},
{
"trigger": "mob_kill (this trigger happens when the player kills a mob)",
"key": "(the name of the mob that needs to be killed)"
}
]
Once a message is triggered, its actions will occur, if there's any. You can have as many as you want. There aren't many actions now, but they should take care of most possible things. Here's the action format.
"actions": [
{
"action": "give_item (this action gives an item to the player)",
"stack": (the item stack to give the player, stack format will be shown later)
},
{
"action": "run_command (this action runs a command, with command block level privilege at the position of the player)",
"param": "(the command to run here, including the /)"
}
]
Lastly, here's the stack format.
"stack": {
"id": "(the id of the item, including the mod id, example: minecraft:log)",
"metadata": "(the metadata of this item. Optional. If not present, item metadata will be zero, if the stack is used in a trigger, metadata will not be checked against)"
"stackSize": "(the size of this stack. Optional. If not present, stack size will be 1. Doesn't matter at all for triggers)",
"nbt": (a json object of this item's NBT, similar to what you'd use if you were running the /give command. Optional. If not present and the stack is used in a trigger, NBT will not be checked against)
}
Commands
The mod also comes with commands that can be used with the run_command action, by command blocks or server admins:
- /vocation-review - Anybody can use this command, sends the last vocation message that player saw again, doesn't do actions
- /vocation-reload - Admin command, reloads all vocation files
- /vocation-clear <player> - Command Block+ command, clears all vocation data of a player
- /vocation-set-seen <player> <id> <true/false> - Command Block+ command, sets the message (by message id) flag on a player as seen or not (so it won't show up later, or will, if you want it to show up multiple times). This won't trigger the actions, but if a trigger were to happen after you set this to false, the actions will happen again.
- /vocation-show <player> <id> [do-actions] - Command Block+ command, shows the given message (by message id) to the player sent. "do-actions" at the end is optional, but if present, actions will be done, if the message hasn't been seen yet, and the message will be marked as seen. If not present, the message will NOT be marked as seen.
- /vocation-check <player> <id> - Command Block command, sends out a comparator signal if the player has seen the message (by message id). Works in a similar matter to /testfor, if you're into that.
Source Code
If you have any problems with the mod or just want to contact me, you can find me on Twitter (@Vazkii) or IRC (#vazkii on irc.esper.net).
评论 0
登录后参与评分
还没有评论,来抢沙发吧