用户:
治愈绾兮查看:21 回复:14 评论:21 创建时间:2020-09-26T15:50:13
world.querySelectorAll(".作者专用").forEach((finder) => {//新建一个叫作者专用的实体,(放在一个隐蔽的地方)
finder.enableInteract = true;
finder.interactRadius = 8;
finder.interactHint = "作者专用";
finder.interactColor = new Box3RGBColor(1, 1, 1);
finder.onInteract(async ({ entity }) => {
const result = await entity.player.dialog({
title: '系统',
type: Box3DialogType.INPUT,
content: `你要关哪个玩家?`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
placeholder: '请输入玩家名', //输入玩家名
confirmText: '确认',
})
const findee = world.querySelector("." + result);
const resu=await entity.player.dialog({
title: '系统',
type: Box3DialogType.SELECT,
content: `找到玩家${findee.player.name}`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
lookEye: entity,
lookEyeOffset: new Box3Vector3(0, 30, 0),
lookTarget: findee,
options:["确认"],
})
if(resu.index==0){
entity.position.set(findee.position.x,findee.position.y+2,findee.position.z)
}
entity.position.set(12,5,116)//监狱的位置
findee.player.dialog({
title: '系统',
type: Box3DialogType.TEXT,
content: `你被管喵关进了监狱`,
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
})
})
})
world.onChat(({ entity, message }) => {
if (message === '作者,我错了') {//对方输入后回到出生点
entity.position.set(122,15,122)//出生点位置
} else if (message === 'shrink') {
entity.player.spawnPoint.set(122,15,122)
}
})
最后,打个广告
顺便求个赞,谢谢!
小小爱htmlTypeError: Cannot read property 'player' of null
at eval ( index.js:77:36 ) at send ( /usr/src/app/build/start.js:178751:53 )点赞0
评论