Pings
Needs the internal running and needs_internal = true in script_info. Without needs_internal = true, both functions return nil.
internal.ping(target) -> true | false | nil
internal.ping_all() -> true | nilSends a real in-game map ping on an enemy. It is the same ping you would make yourself, so your teammates see it.
script_info = {
name = "my_script",
needs_internal = true,
}internal.ping(target)
Pings one enemy.
| Argument | Type | What it is |
|---|---|---|
target | player or integer | A player object from get_players() or a callback, or a pawn entity index |
Pass a player object whenever you have one. The integer form is for when you only have an entity row, such as row.index from entities.by_class("C_CitadelPlayerPawn").
Do not pass p:entity_ptr(). That is a pointer value, not an entity index.
| Returns | Meaning |
|---|---|
true | the ping was queued |
false | no target: nil, 0, or a player object that is no longer valid |
nil | the script did not declare needs_internal = true |
local target = get_players()[1]
if target then internal.ping(target) endinternal.ping_all()
Pings every living enemy, up to 12. It ignores where you are looking and whether you can see them. It takes no arguments.
The pings go out 0.25 seconds apart.
Returns true when queued, nil without needs_internal.
internal.ping_all()Notes
trueonly means the ping was queued. If the internal is not running, nothing is sent, so checkinternal.is_loaded()first.- Call these on a key press or an event, never every tick. Each call goes out straight away, so rate limit your own calls.
- A new call replaces pending pings. Calling either function while
ping_allis still sending cancels the rest of it. - Each ping uses the enemy's position at the moment it is sent, and dead enemies are skipped.
- Scripts work with Misc > Better Pings turned off. That menu toggle only controls the hotkey.
Examples
Ping the lowest-health visible enemy on a key press:
script_info = { name = "ping_weakest", needs_internal = true }
local KEY = 0x56 -- V
function on_tick()
if not internal.is_loaded() or not input.is_key_pressed(KEY) then return end
local best
for _, p in ipairs(get_players()) do
if p:is_alive() and p:is_visible() then
if not best or p:get_health() < best:get_health() then best = p end
end
end
if best then internal.ping(best) end
endPing an enemy when they use their ultimate, at most once every three seconds. A cast shows up as their ult going from ready to not ready:
script_info = { name = "ult_pinger", needs_internal = true }
local was_ready, last = {}, -100
function on_tick()
if not internal.is_loaded() then return end
for _, p in ipairs(get_players()) do
if p:is_enemy() then
local hero, ready = p:hero_name(), p:is_ult_ready()
if was_ready[hero] and not ready and p:is_ult_trained() and clock() - last >= 3 then
last = clock()
internal.ping(p)
end
was_ready[hero] = ready
end
end
endPing every enemy on a key press:
script_info = { name = "ping_all", needs_internal = true }
function on_tick()
if internal.is_loaded() and input.is_key_pressed(0x42) then -- B
internal.ping_all()
end
end