Skip to content

NPC callout spam after avoided combat #32

@some-kind

Description

@some-kind

I encountered an issue where my companion keeps spamming callout messages to a specific enemy NPC even though we avoided combat with that enemy. The companion continues sending messages to the same NPC repeatedly.

I’m not entirely sure how the callout logic works internally, but I temporarily fixed this on my side by adding a distance check in the callout validation function to limit callouts only to nearby enemies.

Here is my fix to the is_valid_callout function:

local MAX_CALLOUT_DISTANCE = 30  -- adjust as needed

function is_valid_callout(npc_obj, target_obj)
    local is_valid =
        (queries.get_game_time_ms() - last_callout_time_ms) > callout_cooldown_ms and
        queries.is_living_character(npc_obj) and
        queries.is_living_character(target_obj) and
        queries.are_enemies(npc_obj, target_obj) and
        not queries.is_in_combat(npc_obj) and
        queries.get_distance_between(npc_obj, target_obj) <= MAX_CALLOUT_DISTANCE

    if is_valid then last_callout_time_ms = queries.get_game_time_ms() end
    return is_valid
end

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions