(Official) LUA Scripting Documentation
intersect_sphere
Sphere intersection query.
Spec:
intersect_sphere(
double x,
double y,
double z,
double radius,
bool players,
bool npcs,
bool display)
Parameters
x
: The x component of the world position at the center of the sphere.y
: The y component of the world position at the center of the sphere.z
: The z component of the world position at the center of the sphere.radius
: The radius of the sphere specified in blocksplayers
: true = test for players, false = do not test for players. If omitted, the default is truenpcs
: true = test for NPCs, false = do not test for NPCs. If omitted, the default is truedisplay
: true = display an outline showing the sphere of the test. If omitted, the default is false
Returns
bool
: True if there is at least one players/NPC positioned within the sphere
The context target is set as the closest actor inside the sphere
Example
local x,y,z = get_pos()
if intersect_sphere(x,y,z,40)
then
set_context("target")
add_health_effect(-10)
end
Incomplete
This documentation is incomplete