Lua · Variables · World

map

The baked map: line of sight and wallbang damage.

Uses the same collision data as Wallbang Damage. Nothing is asked from the game; the map is baked on your PC. map.ready() is false until the bake for the current map is loaded.

FunctionWhat it does
map.ready()True when map data is loaded.
map.name()The map that is loaded.
map.visible(a, b)True when nothing solid is between two points.
map.penetrate(a, b[, bullet])Damage a bullet from a to b would do through walls.
map.trace(a, b[, radius])Casts a ray (or a ball when radius is set) from a to b against the map.
map.ground(pos[, depth])The floor under a point.

#map.ready

map.ready()

True when map data is loaded.

Returns

boolean
-

#map.name

map.name()

The map that is loaded.

Returns

string
-

#map.visible

map.visible(a, b)

True when nothing solid is between two points.

Arguments

a, bvector
-

Returns

boolean
-
Example
local me = entity.local_player()
for _, p in ipairs(entity.players()) do
    if p.enemy and me and p.bones and map.visible(me.bones.head, p.bones.head) then
        esp.add_text(p.slot, "OPEN", color(255, 220, 90))
    end
end

#map.penetrate

map.penetrate(a, b[, bullet])

Damage a bullet from a to b would do through walls.

Arguments

a, bvector
From, to.
bullettableoptional
damage (36), armor_ratio (1.55), range_modifier (0.98), penetration (2), headshot_multiplier (4), armored (false), headshot (false). Defaults are an AK-47.

Returns

table
damage (number), surfaces (walls crossed), reachable (boolean).
  • Without a bullet table it uses the weapon in your hands (AK-47 numbers when that cannot be read).
Example
local r = map.penetrate(me.bones.head, p.bones.chest, { armored = p.armor > 0 })
if r.reachable and r.damage >= 20 then esp.add_text(p.slot, math.floor(r.damage) .. " dmg") end

#map.trace

map.trace(a, b[, radius])

Casts a ray (or a ball when radius is set) from a to b against the map.

Arguments

a, bvector
From, to.
radiusnumberoptional
Ball radius in units, 0 to 32. Default 0.

Returns

table
hit (boolean), sky (boolean), fraction (0..1), pos (vector, the hit point or b), normal (vector, surface facing), distance (units).
Example
local r = map.trace(a, b)
if r.hit then world.marker(r.pos, { text = "wall" }) end

#map.ground

map.ground(pos[, depth])

The floor under a point.

Arguments

posvector
-
depthnumberoptional
How far down to look. Default 4096.

Returns

vector | nil
nil when there is no floor.