GetNpcCombatConfig: Difference between revisions
Document upcoming 0.1.7: optional server TTS, 33 functions, 4 events, English voice/setup guides and NPC meleeSkillTier; not a release |
Release 0.1.9 / BUILD264 / Protocol42: availability and download setup; preserve experimental limits |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 29: | Line 29: | ||
== 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. | ||
* Introduced in 0.1.5. Use matching client/server versions; the meleeSkillTier extension below requires | * Introduced in 0.1.5. Use matching client/server versions; the meleeSkillTier extension below requires 0.1.7. | ||
* 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. | ||
* Does not include combat movement; use getNpcCombatMovement. | * Does not include combat movement; use getNpcCombatMovement. | ||
| Line 38: | Line 38: | ||
<!-- melee017:start --> | <!-- melee017:start --> | ||
== NPC melee skill tiers ( | == NPC melee skill tiers (since 0.1.7) == | ||
The functions themselves remain available since 0.1.5. '''Only the additions below are new in | The functions themselves remain available since 0.1.5. '''Only the additions below are new in 0.1.7'''; they require matching 0.1.7 client/server support. | ||
* [[setNpcCombatConfig]] accepts optional <code>meleeSkillTier</code>: integer 0 (untrained, default), 1 (trained) or 2 (master). [[getNpcCombatConfig]] includes this field in its result table. | * [[setNpcCombatConfig]] accepts optional <code>meleeSkillTier</code>: integer 0 (untrained, default), 1 (trained) or 2 (master). [[getNpcCombatConfig]] includes this field in its result table. | ||
| Line 57: | Line 57: | ||
<!-- melee017:end --> | <!-- melee017:end --> | ||
<!-- upcoming019:start --> | |||
== Item-type armor bonuses (from 0.1.9) == | |||
[[Item type stats]] adds explicit armor bonusHealth/bonusMana/bonusStrength/bonusDexterity contributions for equipped scripted NPCs, plus the armor protection profile. Unconfigured native bonuses do not silently change existing NPC balance. Base stats and bonuses are separate; raising maxima does not heal/refill and lowering maxima clamps current values without reviving dead NPCs. | |||
setNpcMaxHealth/setNpcMaxMana set BASE maxima; getNpcMaxHealth/getNpcMaxMana return EFFECTIVE maxima. setNpcCombatConfig/getNpcCombatConfig dexterity is BASE dexterity. getNpcData adds baseMaxHealth, baseMaxMana, baseDexterity, mana, maxMana, dexterity, armorHealthBonus, armorManaBonus, armorStrengthBonus and armorDexterityBonus. | |||
NPC melee includes explicit armor strength and ranged combat uses effective dexterity. Numeric refresh preserves accepted attack/projectile snapshots; it does not reload ammo or restart prepared casts. NPC toughness and NPC jewelry are not implemented by this addition. These are extensions to existing APIs, not new names or a replacement for their earlier contracts. | |||
<!-- upcoming019:end --> | |||
Latest revision as of 13:27, 20 October 2026
getNpcCombatConfig
Reads NPC projectile configuration.
Syntax
getNpcCombatConfig(npcId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
npcId |
int |
yes | Server-assigned NPC ID returned by spawnNpc; not a player ID. |
Returns
Returns table {range, dexterity, skillTier, aimTimeMs, cooldownMs, consumeAmmo, consumeMana}, or false.
Examples
local config = getNpcCombatConfig(npcId)
Notes
- Server-side only. Mutations require the NPC to belong to the calling resource; getters do not grant control.
- Introduced in 0.1.5. Use matching client/server versions; the meleeSkillTier extension below requires 0.1.7.
- Use matching updated client and server. See NPC scripting for lifecycle, defaults, combat examples and collision limitations.
- Does not include combat movement; use getNpcCombatMovement.
NPC melee skill tiers (since 0.1.7)
The functions themselves remain available since 0.1.5. Only the additions below are new in 0.1.7; they require matching 0.1.7 client/server support.
- setNpcCombatConfig accepts optional
meleeSkillTier: integer 0 (untrained, default), 1 (trained) or 2 (master). getNpcCombatConfig includes this field in its result table. skillTierremains the separate ranged-combat tier. Changing the melee tier does not overwrite ranged settings. Omitted fields keep their existing values; invalid/unknown fields reject the entire change.- This selects ordinary melee presentation/timing for the NPC's equipped family, not its weapon or damage. It does not enable combat, select a target or increase strength/damage. Existing resource ownership and combat controls still apply.
- A strike already admitted keeps its captured animation/impact deadline. A melee-only or unchanged update does not restart unrelated projectile preparation; changing ranged settings still affects that separate configuration.
- Use matching updated client/server support to see the new tier presentation, including observers and late join. Players continue using the existing setPlayerSkill API; no new setPlayerCombatStyle function was added.
-- npcId is an existing NPC owned by this server resource.
local ok = setNpcCombatConfig(npcId, {meleeSkillTier=2})
if ok then
local config = getNpcCombatConfig(npcId)
if config then outputDebugString("NPC melee tier: " .. config.meleeSkillTier) end
end
Item-type armor bonuses (from 0.1.9)
Item type stats adds explicit armor bonusHealth/bonusMana/bonusStrength/bonusDexterity contributions for equipped scripted NPCs, plus the armor protection profile. Unconfigured native bonuses do not silently change existing NPC balance. Base stats and bonuses are separate; raising maxima does not heal/refill and lowering maxima clamps current values without reviving dead NPCs.
setNpcMaxHealth/setNpcMaxMana set BASE maxima; getNpcMaxHealth/getNpcMaxMana return EFFECTIVE maxima. setNpcCombatConfig/getNpcCombatConfig dexterity is BASE dexterity. getNpcData adds baseMaxHealth, baseMaxMana, baseDexterity, mana, maxMana, dexterity, armorHealthBonus, armorManaBonus, armorStrengthBonus and armorDexterityBonus.
NPC melee includes explicit armor strength and ranged combat uses effective dexterity. Numeric refresh preserves accepted attack/projectile snapshots; it does not reload ammo or restart prepared casts. NPC toughness and NPC jewelry are not implemented by this addition. These are extensions to existing APIs, not new names or a replacement for their earlier contracts.