SetMonsterName
Jump to navigation
Jump to search
setMonsterName
AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.
Changes the validated overhead display name of a resource-owned monster.
Syntax
bool setMonsterName(string monsterId, string name)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
monsterId |
string |
yes | The opaque decimal monster identifier returned by spawnMonster or getMonsters.
|
name |
string |
yes | A 3-16 character display name using letters, numbers, single spaces, underscores or hyphens. |
Returns
Returns true when the name is accepted and replicated; otherwise returns false.
Examples
Name an elite encounter:
if setMonsterName(monsterId, "Mine Guardian") then
outputDebugString("Monster named")
end
Notes
- Available only in server-side resource scripts.
- Only the resource that created the monster may rename it.
- The validated name is exposed as
getMonsterData(monsterId).nameand replayed during relevance entry and late join. - When accepted, the server emits
onMonsterNameChange(monsterId, previousName, name, sourceResource).