#how to run something every 10 ticks

6 messages · Page 1 of 1 (latest)

crude iris
#

I want to run this code every ten ticks but I don't know what XYZ.abc(e => .... I put it in, also I don't know how to detect if the player is within a range of blocks from any entity of a specific tag. This is for a boss fight I'm making with kubejs because it's easier to understand JS than it is to understand and manipulate commands.

PlayerEvents.tick(event => {
    const player = event.player;
    const level = player.level;
  
    if (!level.isClientSide) {

      // how to detect if the player is within 5 blocks of any mob with the tag of "zombie_boss" or "skeleton_boss" or "spider_boss"
      
      if (detected) {
        player.hurt('minecraft:generic', 2);
      }
    }
});
strange vortexBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

main mica
#
if(player.age % 10) return
//code
#

no need to check client side, it's server script

#
const {x, y, z} = player;
const aabb = AABB.of(x+5, y-2, z+5, x-5, y+2, z-5);
const checkMob = level.getEntitiesWithin(aabb).some(e => e.tags.contains('asd'))

detect mob

#

that's two questions, create two tickets next time