猫史档案馆


谁知道密码们怎么做

用户:柚子Gent小号柚子Gent小号查看:3 回复:3 评论:3 创建时间:2021-05-04T13:06:00


当玩家输入密码,提示密码正确,让后传送到某个地方

求大佬们告诉我


回复

上一页1 页 / 共 1下一页
月下樱花雨_中考退月下樱花雨_中考退

谁知道《密码们》怎么做

点赞0


评论


async_functionasync_function

world.querySelectorAll('#模型名').forEach((entity) => {
    entity.enableInteract = true
    entity.interactHint = '名称'
    entity.interactRadius = 5//5是范围
    entity.onInteract(({ entity }) => {
        var key = await entity.player.dialog({
            type: Box3DialogType.INPUT,
            title: '密码机',//当然也可以是别的
            content: '请输入密码',
            placeholder: '输入密码...'
        })

        if (key == null) return

        var value = 1111,//密码
            position = new Box3Vector3(1, 1, 1)//三个数分别输入要传送x,y,z轴的坐标

        if (key == value) {
            entity.position = position
        }
    })
})

点赞1


评论


爱探险的天才猫爱探险的天才猫

c喵t door = world.querySelector('#密码门');

door.enableInteract = true;

door.interactHint = '密码门';

let password=123456;//密码,自己修改

door.onInteract(async({entity})=>{

c喵t d = await entity.player.dialog({

type:Box3DialogType.INPUT,//输入对话框

content:'请输入密码',

confirmText:'确定',

});

if (d) {

if (d==password){

entity.position.set(1,1,1);//这里填位置,分别是x,y,z

await entity.player.dialog({

type:Box3DialogType.TEXT,

content:'密码正确',

});

} else {

await entity.player.dialog({

type:Box3DialogType.TEXT,

content:'密码错误',

});

}

}

点赞0


评论