猫史档案馆


【BO3代码】跑酷必备

用户:XiaoLiQAQXiaoLiQAQ查看:7 回复:11 评论:7 创建时间:2022-01-17T17:24:22


由BO3ID:XiaoLi编写QAQ

//复活代码
async function chongsheng (entity) {
    for (let t = 1; t <= 4; t++) {
       entity.player.directMessage(`复活倒计时: ${String(4 - t)}秒后复活`);
       await sleep(1000);    //等待一秒
    }
    entity.player.forceRespawn();  // 让玩家重生
}
world.onDie(async({ entity }) => { 
    await chongsheng(entity)
})
//碰到指定方块掉血
world.onVoxelContact(async({ voxel, entity }) => {
    if(voxel == voxels.id('方块id')){
        entity.enableDamage = true     //允许伤害
        entity.hurt(受到的伤害 要改为数字)
        entity.player.directMessage('踩到方块说的话')
 
    }
    if(voxel == voxels.id('方块id 2')){
        entity.enableDamage = true     //允许伤害
        entity.hurt(受到的伤害 要改为数字)
        entity.player.directMessage('踩到方块说的话')
 
    }
})
//如果你想写碰到液体执行什么命令请看这里
world.onFluidEnter(({entity, voxel}) => {
    if (entity.isPlayer){
        if (voxel === voxels.id('液体名称')) {
            entity.player.directMessage(`碰到指定液体私聊这句话`)
            entity.player.forceRespawn(); //返回重生点
        }
    }  
});
world.addCollisionFilter('player','player'); //关闭玩家之间碰撞
//存档点代码
const points = world.querySelectorAll('.存档点'); 
points.forEach((e)=>{
    e.onEntityContact(({other})=>{
        const spawnPoint = e.position.add({x: 0,y: 2.5,z: 0});
        if(spawnPoint.equals(other.player.spawnPoint))return;
        other.player.spawnPoint = spawnPoint;
        other.player.directMessage('存档成功!');
    })
})


回复

上一页1 页 / 共 1下一页
XiaoLiQAQXiaoLiQAQ

大~佬~勿~喷

点赞2


评论


苏打码苏打码

az,相当Nice! imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8A%A0%E6%B2%B9.gif"alt="emotion_编程猫_加油"width="202"height="202"

点赞1


评论


魔梦魔梦

太棒了

点赞0


评论


魔梦魔梦

太棒了

 

点赞0


评论


魔梦魔梦

加油

点赞0


评论


凌cloud凌cloud

《 B O 3 》

,不是Box3吗

点赞0


评论


灵清帝王吃爆一切厕所灵清帝王吃爆一切厕所

e,xiaoli,你能帮我做个跑酷吗? 

点赞0


评论


春语1kg0春语1kg0

imgsrc="https://static.cod喵/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8E%89%E5%AE%B3%E4%BA%86.gif"alt="emotion_编程猫_厉害了"

点赞0


评论


忠诚的呆鲤鱼JSog忠诚的呆鲤鱼JSog

你这有顺序吗

点赞0


评论


XiaoLiQAQXiaoLiQAQ

dddd

点赞0


评论


堂主の犬堂主の犬

PVP也可以()()()

点赞0


评论