用户:
BlackShadow查看:25 回复:4 评论:25 创建时间:2022-12-17T11:03:07
需要的效果:人物名字:请选择游戏模式,选择:末世生存,传送到一个坐标,我实在不会了(又又又一次)
名探酱// 先在场景中放置一个名称为 NPC 的实体。
const npc = world.querySelector('#NPC');
npc.enableInteract = true; // 允许进行互动
npc.interactRadius = 8; // 实体的互动范围
npc.interactHint = npc.id; // 互动提示框显示实体的名称
npc.interactColor = new Box3RGBColor(1,0,1); // 互动提示的文字颜色
// 玩家与实体进行交互时触发
npc.onInteract(async({entity}) => {
const xz = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: npc.id,
content: `请选择游戏模式:`,
options: ["末世生存"],
})
if (!xz)return;
if (xz.index == 0){
entity.poistion.set(x,y,z)
}
})点赞2
评论
名探酱world.onVoxelContact(async({entity,voxel})=>{
if(voxel!=voxels.id('方块名称')||!entity.isPlayer)return;
entity.poistion.set(Math.random()*随机值,y(如果要改就按照之前的),Math.random()*随机值)
})点赞0
评论
名探酱world.onChat(({ entity, message }) => {
if (message === '/hc') {
const xz = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'MINEZ特殊合成表',
content:'',
options:['选项1','选项2'],
})
if(!xz)return;
if(xz.index == 0){
const hc = await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'选项1',
content:'',
})
}
if(xz.index == 1){
const hc = await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'选项2',
content:'',
})
}
})
onchat后面第一个括号里面加async
点赞0
评论
BlackShadowworld.onChat(async({ entity, message }) => {
if (message === '/hc') {
const xz = await entity.player.dialog({
type:Box3DialogType.SELECT,
title:'MINEZ特殊合成表',
content:'请选择',
options:['木锤','基地核心'],
})
if(!xz)return;
if(xz.index == 0){
const hc = await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'木锤',
content:'木板×2,木棍×1(其它材质的锤子合成方法类似)',
})
}
if(xz.index == 1){
const hc = await entity.player.dialog({
type:Box3DialogType.TEXT,
title:'基地核心',
content:'金锭×7,电路板×1,天线×1',
})
}
})点赞0
评论