OnMonsterTargetChange

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:31, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

onMonsterTargetChange

Triggered when server-owned monster AI changes its player target.

Availability

This event is available in server-side scripts.

Callback signature

onMonsterTargetChange(monsterId, previousPlayerId, targetPlayerId, sourceResource)

Parameters

Name Type Description
monsterId string The monster ID.
previousPlayerId int The previous target player ID, if any.
targetPlayerId int The new target player ID, if any.
sourceResource string The resource associated with the change.

Examples

Handle the event:

addEventHandler("onMonsterTargetChange", root, function(monsterId, previousPlayerId, targetPlayerId, sourceResource)
    outputDebugString("Monster " .. monsterId .. " target=" .. targetPlayerId)
end)