GetNpcCombatState: Difference between revisions
Jump to navigation
Jump to search
Document new NPC/player-mode API and events available from 0.1.5 |
Release G1R:MP 0.1.5 BUILD144 / Protocol 37; update availability and migration |
||
| Line 30: | Line 30: | ||
== Notes == | == Notes == | ||
* Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control. | * Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control. | ||
* Since 0.1.5. | * Since 0.1.5. Use the matching 0.1.5 client and server (Protocol 37). | ||
* Use matching updated client and server. See [[NPC scripting]] for lifecycle, defaults, combat examples and collision limitations. | * Use matching updated client and server. See [[NPC scripting]] for lifecycle, defaults, combat examples and collision limitations. | ||
* phase is a string, rejectReason a numeric subsystem code, target is a player ID or 0. This is not a visual-animation confirmation or complete melee FSM. See [[NPC scripting#Combat status]]. | * phase is a string, rejectReason a numeric subsystem code, target is a player ID or 0. This is not a visual-animation confirmation or complete melee FSM. See [[NPC scripting#Combat status]]. | ||
Latest revision as of 07:33, 26 September 2026
getNpcCombatState
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.
Reads NPC projectile-controller status and resources.
Syntax
getNpcCombatState(npcId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
Returns
Returns table {phase, rejectReason, target, mode, mana, maxMana, arrows, bolts}, or false.
Examples
local state = getNpcCombatState(npcId)
if state then outputDebugString(state.phase) end
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Since 0.1.5. Use the matching 0.1.5 client and server (Protocol 37).
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- phase is a string, rejectReason a numeric subsystem code, target is a player ID or 0. This is not a visual-animation confirmation or complete melee FSM. See NPC scripting#Combat status.