SetNpcMana
Jump to navigation
Jump to search
setNpcMana
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.
Sets NPC current mana.
Syntax
setNpcMana(npcId, mana)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
mana |
number |
yes | Finite 0..100000, clamped to maxMana. |
Returns
Returns true when accepted, false for a rejected request. Acceptance is not proof of a rendered animation, projectile release or hit.
Examples
setNpcMana(npcId, 100)
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.
- May cancel pending projectile preparation. Do not refill every tick while testing resource consumption.