Skip to content

Courage.Attention#

require("Courage.Attention") controls actor attention parameters, including lock-on icons, talk prompts, BMG message assignment, offset positions, and Z-target hint requests.

Loading the module#

local Attention = require("Courage.Attention")
import * as Attention from "Courage.Attention"

API#

Function Returns Description
Attention.enroll(actor, opts?) boolean Register actor (native pointer) with custom attention parameters. Returns true on success.
Attention.withdraw(actor) boolean Remove custom attention enrollment for actor (native pointer). Returns true if an entry was removed.
Attention.set_message(actor, msgId) boolean Set the BMG message ID triggered when talking to actor (native pointer).
Attention.set_offset(actor, x, y, z) boolean Set the 3D position offset of the attention point relative to actor (native pointer).
Attention.is_talking(actor) boolean Returns true if actor (native pointer) is currently engaged in a message flow interaction.
Attention.z_hint(actor, priority?) boolean Request a Z-target camera hint focusing on actor (native pointer).

Enroll options table#

The second argument to Attention.enroll is an optional table with these fields:

Field Type Default Description
type string "talk" Attention type: "talk", "lock", "battle", "speak", "check", or "none".
distance integer -1 Maximum interaction distance in GameCube units (-1 for default).
can_talk boolean true Enable talk condition checking.
message integer 0 BMG message ID to display when talk is triggered.
offset { x, y, z } { 0, 0, 0 } Positional offset for the target marker.

Example#

local Hook      = require("Augment.Hook")
local Attention = require("Courage.Attention")

local s_enrolled = {}

Hook["fopAcM_create"]:"after"(function(ctx)
    local actor = ctx.ret
    if not actor or s_enrolled[actor] then return end

    Attention.enroll(actor, {
        type = "talk",
        message = 0x0107,
        offset = { 0.0, 150.0, 0.0 },
        can_talk = true,
    })
    s_enrolled[actor] = true
end)
import * as Hook      from "Augment.Hook"
import * as Attention from "Courage.Attention"

const enrolled = new Set<any>()

Hook.fopAcM_create.after((ctx) => {
    const actor = ctx.ret
    if (!actor || enrolled.has(actor)) return

    Attention.enroll(actor, {
        type: "talk",
        message: 0x0107,
        offset: [0.0, 150.0, 0.0],
        can_talk: true,
    })
    enrolled.add(actor)
})

See also#

  • Courage.Bmg: Override message text displayed during talk interactions
  • Courage.Actors: Spawn custom actors to attach attention to