SetNpcCombatTarget
setNpcCombatTarget
AVAILABLE FROM UPDATE 0.1.5
This function is available in G1R:MP 0.1.5 and later. The contract below includes the compatibility guarantees introduced in that update.
Starts explicit continuous combat against a player, or stops it.
Syntax
setNpcCombatTarget(npcId, target)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
target |
false | yes | Connected living player ID to target, or false to stop continuous combat. |
Returns
Returns true when accepted, false for a rejected request. Acceptance is not proof of a rendered animation, projectile release or hit.
Examples
setNpcCombatTarget(npcId, playerId)
-- Later:
setNpcCombatTarget(npcId, false)
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Since 0.1.5. This documents the next release; public 0.1.4 does not include these additions.
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- Requires living NPC, drawn supported mode and valid live target. No automatic aggression or retaliation. false stops pursuit/queued preparation and preserves script routes. Already released projectiles may still hit. Targets are players, not NPCs.