GetMonsterTarget: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document server-owned monsters and interactions
 
Complete Lua function catalog
 
Line 30: Line 30:
* Available only in server-side resource scripts.
* Available only in server-side resource scripts.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:World Functions]]
[[Category:World Functions]]
[[Category:Monster Functions]]
[[Category:Monster Functions]]

Latest revision as of 09:52, 15 August 2026

getMonsterTarget

Returns the player currently targeted by a server-owned monster.

Syntax

int getMonsterTarget(string monsterId)

Parameters

Name Type Required Description
monsterId string yes The opaque decimal monster identifier returned by spawnMonster or getMonsters.

Returns

Returns a connected player identifier, or 0 when there is no target or the monster is invalid.

Examples

Inspect the current target:

local target = getMonsterTarget(monsterId)
if target ~= 0 then
    outputDebugString("Target player: " .. target)
end

Notes

  • Available only in server-side resource scripts.