用户:
145a查看:10 回复:14 评论:10 创建时间:2022-09-24T20:08:44
只是发个帖问一下,国庆才有时间

名字送冷吖Oworld.onPlayerJoin(async({entity})=>{ entity.showHealthBar=0;//默认隐藏 entity.__maxHp__=100;//独立建一个变量 while(!entity.destroyed){//玩家离开之前重复执行 awaitworld.nextTick();//每过一个tick点后更新状态 entity.hp>entity.__maxHp__&&(entity.hp=100);//如果玩家的血量大于最大血量,则设置为最大血量 entity.hp<=0&&[entity.player.forceRespawn(),entity.hp=100];//玩家喵复活 entity.showHealthBar?entity.maxHp=entity.__maxHp__:entity.maxHp=entity.hp;//如果showHealthBar为true,则显示血量,否则隐藏 } });
点赞0
评论
名字送冷吖Oworld.onPlayerJoin(async({entity})=>{
entity.showHealthBar=0;//默认隐藏
entity.__maxHp__=100;//独立建一个变量
while(!entity.destroyed){//玩家离开之前重复执行
await world.nextTick();//每过一个tick点后更新状态
entity.hp>entity.__maxHp__&&(entity.hp=100);//如果玩家的血量大于最大血量,则设置为最大血量
entity.hp<=0&&[entity.player.forceRespawn(),entity.hp=100];//玩家喵(钛合金防屏蔽)亡复活
entity.showHealthBar?entity.maxHp=entity.__maxHp__:entity.maxHp=entity.hp;//如果showHealthBar为true,则显示血量,否则隐藏
}
});点赞0
评论
小鹿UUyM这还不简单?
思路(代码懒得写):
首先呢玩家进入地图后while(1)
(别忘记await sleep(1),不然就重启了)
然后检测玩家血量是否为MaxHp
然后不为MaxHp就先把血量存到一个变量里,(变量初始为MaxHp),然后设置血量为最大
await sleep(3000)这里可写可不写
就这样了
点赞0
评论