#how to get a specific entity as a variable in my script

1 messages ยท Page 1 of 1 (latest)

sage raptor
#

world.getDimension('overworld').getEntities()

placid basin
#

Assuming dimension is defined.

const entities = dimension.getEntities();

for(const entity of entities) {
     entity.applyKnockback();
}
balmy wolf
balmy wolf
shadow mist
#
import { world, system } from "@minecraft/server";

system.runInterval(() => {
  const dimension = world.getDimension('overworld');
  for (const entity of dimension.getEntities()) {
    entity.applyKnockback(entity.location.x, entity.location.z, 2, 2)
  }
});

// applyKnockback(directionX, directionZ, horizontalStrength, verticalStrength)
balmy wolf
#

how can i execute that knockback only one time

shadow mist
#

bruh

balmy wolf
#

also, i want to apply the knockback to an item

shadow mist
#

learn js pls

balmy wolf
#

:c

#

i know that the bucle for makes it constant

#

but how tf i stop the bucle

shadow mist
#

for simple js like this, you can ask to gpt for guide

balmy wolf
#

Actually

#

lmao why u just didnt told me, nobody was born knowing everything

sage raptor
#

What do you want to know?

fast peak
#

@balmy wolf what are you trying to do?

scenic ginkgo
#

First

shadow mist
balmy wolf
shadow mist
#

๐Ÿ’ช