SetMonsterTarget: 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 31: Line 31:
* A nonzero target must refer to a currently connected player.
* A nonzero target must refer to a currently connected player.


[[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:55, 15 August 2026

setMonsterTarget

Sets or clears the authoritative player target of a server-owned monster.

Syntax

bool setMonsterTarget(string monsterId, int playerId)

Parameters

Name Type Required Description
monsterId string yes The opaque decimal monster identifier returned by spawnMonster or getMonsters.
playerId int yes A connected player identifier, or 0 to clear the target.

Returns

Returns true when the target change is accepted; otherwise returns false.

Examples

Order a monster to attack a player:

setMonsterAggressive(monsterId, true)
setMonsterTarget(monsterId, playerId)

Notes

  • Available only in server-side resource scripts.
  • A nonzero target must refer to a currently connected player.