(Official) LUA Scripting Documentation
intersect_box
Box (cubic region) intersection query.
Spec:
intersect_box(
double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
bool players,
bool npcs,
bool display)
Parameters
x1
: The x component of the box (region) min world positiony1
: The y component of the box (region) min world positionz1
: The z component of the box (region) min world positionx2
: The x component of the box (region) max world positiony2
: The y component of the box (region) max world positionz2
: The z component of the box (region) max world positionplayers
: 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 box region of the test. If omitted, the default is false
Returns
bool
: True if there is at least one players/NPC positioned within the box region
The context target is set as the closest actor inside the box
Example
local x,y,z = get_pos()
if intersect_box(x-20,y,z-20,x+20,y+10,z+20)
then
set_context("target")
add_health_effect(-10)
end
Incomplete
This documentation is incomplete