用户:
XiaoLiQAQ查看: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('存档成功!');
})
})
苏打码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
评论
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
评论