#how could i make a reach calculator for combat?

1 messages · Page 1 of 1 (latest)

hushed vesselBOT
#

Description
Calculate distance

Credits
These scripts were written by GlitchyTurtle32

frosty sand
#

@ruby plinth

ruby plinth
#

pythagoras theorem

frosty sand
#

no

#

im dumb

#

@ruby plinth

ruby plinth
#
world.afterEvents.entityHit.subscribe((event) => {
    const location1 = {
      x: event.entity.location.x,
      y: event.entity.location.y,
      z: event.entity.location.z,
    };
    const location2 = {
      x: event.hitEntity.location.x,
      y: event.hitEntity.location.y,
      z: event.hitEntity.location.z,
    };
  
    const distance = Math.pow(
      Math.pow(location2.x - location1.x, 2) +
      Math.pow(location2.y - location1.y, 2) +
      Math.pow(location2.z - location1.z, 2),
      0.5
    );
  });```
viral prawn
frosty sand
#

jayly? bot

#

heller?

#

u die? @hushed vessel

viral prawn
#

It’s not super complicated my man. Just subscribe to entity hit, then calculateDistance(hitEntity, entity)

frosty sand
#

i already got it

viral prawn