Weak points
Usage guide of combat.weakpoints: localized armor, exposure windows and part health for bosses and monsters, the hit and resolve protocol, settings and defaults, service, events, hooks and a worked example.
Weak points and armor parts (combat.weakpoints) #
What it is for #
combat.weakpoints gives a boss or a monster body parts that each have their own armor, health and vulnerability window. A hit on a part is absorbed by its armor first, the rest is multiplied (more while the part is exposed) and split between the part and the body; a part that reaches zero is disabled and names the capabilities it takes away (flight, a weapon). The kit only computes: the engine finds which part was hit, applies the damage to the body through the combat system, then confirms with resolve.
Turn it on #
Install the kit in a project and set its settings with the tools below; gripforge kit api combat.weakpoints lists every setting, and gripforge docs combat-weakpoints prints this guide offline.
gripforge_gamekit_install { project_id: "gkp_…", id: "combat.weakpoints" }
gripforge_gamekit_configure { project_id: "gkp_…", id: "combat.weakpoints",
config: { "maxExposure": 10, "parts": [
{ "id": "core", "maxHealth": 100, "armor": 20, "bodyShare": 0.5, "capabilities": ["flight"] },
{ "id": "arm", "maxHealth": 50, "armor": 0, "exposedMultiplier": 3 } ] } }
First example #
<!-- test: kits/combat_weakpoints/tests/combat_weakpoints.rs::armor_absorbs_first_and_the_rest_is_split_between_part_and_body --> A boss with a core (armor 20, half of the damage goes to the body) takes a 60-point hit. Nothing is applied until the engine resolves the hit.
combat.weakpoints.request("default", { op: "hit", part: "core", seq: 1, amount: 60 })
// action.effect: { kind: "hit", armorDamage: 20, partDamage: 40, bodyDamage: 20, disabled: false }
combat.weakpoints.request("default", { op: "resolve", token: <action.token>, success: true })
// core: health 60, armor 0
On an entity: hits that find their part #
<!-- test: kits/combat_weakpoints/tests/weakpoints_entities.rs::a_hit_goes_to_the_part_it_lands_on_and_a_broken_valve_costs_a_capability --> Bind an entity and the kit does the driving: every hit combat.core deals to it goes to the part it lands on. Give a part a region (a sphere in the entity's frame, metres, +Y up and +Z forward, turning with it), name a fallback part for hits that know no point (a melee strike) or land outside every region, and install combat.core 1.12 or later.
{ "fallback": "body", "parts": [
{ "id": "plates", "maxHealth": 1000000, "armor": 0, "normalMultiplier": 0.2, "exposedMultiplier": 0.2,
"region": { "offset": [0, 1.4, 0], "radius": 1.0 } },
{ "id": "valve", "maxHealth": 30, "armor": 0, "normalMultiplier": 0.25, "exposedMultiplier": 3,
"capabilities": ["charge"], "region": { "offset": [0, 1.6, -0.5], "radius": 0.3 } },
{ "id": "body", "maxHealth": 1000000, "armor": 0 } ] }
Here a shot on the plates does a fifth of its damage, a shot on the closed valve a quarter, and three times as much while it is open; the valve breaks after 30 points and weakpoints.broken names the capability it costs (charge); a sword cut and a broken valve's hits go to the body as they are. Bind with the archetype component weakpoints (an engine instance), the verb bind_weakpoints { entity?, weakpoints } or bind(entity, binding). kinds limits the combat.core kinds of hit the parts take (default attack, special, enemy). The kit decides last in the combat.damage hook, so a hit that a rule, a guard or a scripted boss end cancelled never reaches a part; the hit then lands for the effect's bodyDamage.
Exposure windows run on the game clock. Open one from content when the boss shows its weak point, after a wait if needed:
{ "id": "decompress", "when": { "event": "boss.pattern", "match": { "pattern": "charge" } },
"then": [{ "wait": 0.5 }, { "type": "expose_weakpoint", "part": "valve", "seconds": 1.5 }] }
Without entity the verb takes the entity of the event. The parts are written on the entity as weakpoints.state (health, max, armor, exposure, and the disabled capabilities) for a boss bar or a marker; parts(entity) reads it. The game reacts to weakpoints.broken to take a capability away (the kit does not).
Settings and defaults #
| Setting | Default | Meaning |
|---|---|---|
maxExposure | 30 | {{s_maxExposure}} |
parts | [{ "id": "core" }] | 1 to 64 parts with unique ids; the default is one part core (fields below) |
parts[] | Default | Meaning |
|---|---|---|
id | required | the hit region id your engine's collision query returns |
maxHealth | 100 | {{p_maxHealth}} |
armor | 25 | armor points absorbed before any multiplier; they come back only through restoreArmor, up to this value |
normalMultiplier | 1 | {{p_normalMultiplier}} |
exposedMultiplier | 2 | {{p_exposedMultiplier}} |
bodyShare | 1 | {{p_bodyShare}} |
capabilities | [] | up to 16 capability ids removed when the part reaches zero health |
Services #
combat.weakpoints(service):create(id, config),request(id, command),remove(id),ids(); on entities (1.2)bind(entity, binding),unbind(entity),parts(entity),expose(entity, part, seconds). The instancedefaultuses the installed settings; other instances are created with their ownconfig(or a preset).- Commands of
request:hit(part,seq,amount;seqmust rise with every hit),expose(part,seconds),restoreArmor(part,amount),step(dt),resolve(token,success),preview(command),status,config,save,load. AhitorrestoreArmoranswers anactionwith atokenand theeffectto carry out; it stays pending, and blocks other commands, untilresolve(token, success). A failed resolution drops the hit and does not consume itsseq.previewshows an outcome without a pending action. - The
effectof a hit carriesarmorDamage,partDamage,bodyDamage(the part damage timesbodyShare),disabledanddisabledCapabilities. The engine appliesbodyDamagethrough the combat system and disables the capabilities itself.
Events #
- combat.weakpoints.created and combat.weakpoints.removed (an instance appeared or went), combat.weakpoints.changed (a decided command applied, with its
opandresult; never a read or astep), combat.weakpoints.refused (a hook cancelled a command, withbyandreason). - On entities (1.2):
weakpoints.hit(entity,source,part,exposed,armorDamage,partDamage,bodyDamage),weakpoints.broken(entity,source,part,capabilities),weakpoints.exposed(entity,part,seconds). The kit listens toentity.despawned(a bound entity's instance goes with it).
Hooks and modding #
combat.weakpoints.create: an instance is about to be created; a tap may change itsconfigor cancel, andcreatethen fails with the reason.combat.weakpoints.request: a decided command (everyopexcept the reads andstep) is about to apply; a tap may change thecommandor cancel, andrequestthen answers{ ok: false, cancelled: true, by, reason }with the instance unchanged.
Using it from content #
Every setting is moddable. A combat_weakpoints_presets document { id, extends?, config } names a ready-made set of parts, and create(id, { preset: "<id>" }) takes it (own keys win). A hook document of a game or a mod looks like this:
{ "id": "no_armor_repair", "hook": "combat.weakpoints.request", "match": { "op": "restoreArmor" }, "cancel": true, "reason": "no_repair" }
Script verbs: the action combat_weakpoints_request sends a command to an instance (default default) through the request hook, and the condition combat_weakpoints_exists tells whether an instance exists. On entities, bind_weakpoints and expose_weakpoint (above).
{ "combat_weakpoints_request": { "command": { "op": "expose", "part": "arm", "seconds": 4 } } }
{ "combat_weakpoints_exists": "default" }
When it does not do what you expect #
| Symptom | Cause and fix |
|---|---|
| A hit changes nothing | The action is still pending: call resolve with its token (the engine confirms what it applied). |
| A command is refused with "part disabled", "pending" or "stale" | The part is at zero health, another action is pending, or the token or seq is old. A seq must be higher than the last accepted hit. |
| A bound entity's parts take nothing | combat.core is older than 1.12 or missing (no contact point, no hook), the hit is of a kind not in kinds, or it lands outside every region with no fallback. |
| Damage does not use the exposure multiplier | The window ran out: send expose again, and advance time with step (dt in seconds) every fixed frame. |
Limits #
- On its own it does not find which part was hit: bound to an entity it uses the regions and the contact point of
combat.core; otherwise your engine's collision query names the part id. - It does not damage the body, drive animations or remove abilities by itself: the engine carries out the
effect. - It has no display module; on entities it emits
weakpoints.hit,weakpoints.brokenandweakpoints.exposed, and takes no capability away by itself.
Versions #
Kit combat.weakpoints 1.2.0 (since 2026-10-29: weak points on entities, driven by combat.damage; 1.1.0 on 2026-10-19: hooks, presets, events and script verbs; 1.0.0 on 2026-10-16). It runs the same Rust rules on KitHost, in WebAssembly and through a native C library.
<!-- kit-services:begin -->
Services this kit uses (and that you can provide) #
| Capability | Required | Methods |
|---|---|---|
engine.content | optional | registerComponent |
engine.hooks | optional | run, tap, untap |
weakpoints.bound | optional | — |
weakpoints.damage | optional | — |
weakpoints.state | optional | — |
Any brick can serve them: a kit, or your engine (Godot provide_service, Unity Provide, Unreal ProvideService, Bevy provide_kit_service, C gfk_provide) — see the guide. <!-- kit-services:end -->