Script for spheres

What command should I write to give my spheres opportunity to damage players if they are in them (like in genji parkour)?

player within radius = true --> damage(players within radius) (damage amount)

or at least that’s how I would go about it

variable(A) is the center of the sphere and variable(B) is the radius of the sphere.
rule: ongoing - each player
condition:

  • distance between(event player, variable(A)) <= variable(B)

action:

  • damage(event player, 10)
  • wait(1)
  • loop if condition is true

NB you might want to reduce the radius slightly if the spheres are very large (e.g. multiply radius by 0.99, to quote a value). The visual radius of the sphere does not 100% match the radius specified for the sphere, you if they are really large you might take damage before actually touching the visual part.

I actually like to increase the radius slightly because imo it does look more comprehensible from first-person-view. Otherwise I sometimes get the feeling that the is-inside effect triggers to late.

I use the following code:

Array Contains ( Players Within Radius ( Vector (X,Y,Z), R, Team1, OFF ), Event Player ) == True