Page MenuHomeFeedback Tracker

When damage is applied to HitPoints via script, dependent Hitpoints do not update accordingly
Reviewed, NormalPublic


In case one uses setHit["selection",<number>] or setHitPointDamage ["HitPointClass",<number>], the Hitpoints that depend on the hitselection/Hitpointclass that where damaged (via config dependency token) do not update appropriately.

_unit setHitPointDamage ["HitFace",0.2]; // or _unit setHit ["face_hub",0.2];
Resulting damage on unit:
"HitFace" = 0.2
"HitHead" = 0 (should be 0.2 because dependency in config is >> depends="HitFace max HitNeck";

Once the unit receives damage from a bullet for example, (i.e. to the leg) the dependency is accounted for internally. So if "HitFace" = 1.0 due to a script, the next time the unit receives damage by bullets, it gets killed - because HitHead depends on HitFace and that is 1.0, means unit dead. HOWEVER, HitHead still will not have damage of 1.0 when returned via getHit or getHitPointDamage


Operating System
Windows 7
Additional Information

somewhat related: "invulnerable" infantry due to "max" operator in hitpoint dependencies

Event Timeline

Fennek created this task.Oct 27 2016, 6:51 PM

I would imagine this is because setHit, setHitIndex and setHitpointDamage provide direct access to hitpoint/part damage manipulation. It would be quite strange if you want to modify exact hitpoint damage but unable to do this because this affects another hitpoint,

However, having said that, you can always get the dependency from config and modify all dependent hitpoints manually.

Fennek added a comment.EditedOct 28 2016, 2:00 PM

It might be arkward, but it is alot less arkward, than setting damage 1 to the Neck of a soldier and have nothing happen. One look at the Hitpoint configs will tell you what hitpoints you should damage and which ones not.

the problem is that currently it breaks the damage system if you use setHit or similar on anything. Because it already is considered in the dependency calculation. But it is not immediate (reaction will follow only on next hit by real bullet/ explosive), and what you read via getHit and similar does not match with the internal values anymore. Example: setHit ["HitAbdomen",1]; -> nothing happens to soldier (he should die). Now shoot him with a gun with very low damage into the foot -> he dies. But HitBody still reads as 0 (but internally it is 1, otherwise the soldier wouldnt have died)

With the new hitpoint system, some hitpoints are not meant to be damaged via external means anymore. Intentionally. HitBody for example. It has incredibly high HP to prevent direct damage to it, so that it only receives damage through dependency.

Also, the way the dependency is set up for Inf. currently is not very good. You can shot and damage HitHead. If you damage HitFace after that however, damage from HitHead = HitFace (because of dependency), so it forgot the original damage. This is a config/ setup issue, not one related to scripts.

Manually going through all the hitpoints, their dependencies and formulas, updating them sounds very inefficient to me.

BIS_fnc_KK added a comment.EditedOct 30 2016, 2:12 PM

This is not going to work and will change functionality of setHitXXXX commands which will result in backwards incompatibility. For example you want head damage to update when you hit face lets say with 0.5. Ok

the total damage for head will be

head max face max neck
0 max 0.5 max 0 = 0.5

the head is now 0.5 and face is 0.5

Now you want to reduce damage to the head: head setHit 0.1 but it doesn't work!

head max face max neck
0.1 max 0.5 max 0 = 0.5

head is still 0.5. Maybe you can reduce damage to the face instead?

head max face max neck
0.5 max 0.1 max 0 = 0.5

No! So in fact to reduce damage you have to go backward, first reduce damage on all dependent hitpoints and only then reduce damage to the head. This is as equally awkward if not more.

Bottom line, nice idea, complicated practical implementation

Fennek added a comment.EditedNov 1 2016, 8:57 PM

Then decouple the updating from setHit and give us a script command that enforces an update to the hitpoints, so the hitpoints we read with getHit match the internal values, and also trigger hardcoded game functionality (death, handshaking, limping, vehicle engine damage, etc) in case a child hitpoint was damaged enough to trigger the parent.

Using "max" in the infantry hitpointsystem was a horrible idea in the first place. You can take 4x0.9 damage to the torso if you are lucky before you die with the current system... seperate ticket will follow:

Fennek edited Additional Information. (Show Details)Nov 1 2016, 9:21 PM
razazel claimed this task.Nov 2 2016, 11:22 AM
razazel changed the task status from New to Reviewed.

Alternative (more workintensive) to untangle this issue: define damage states independantly, that way we can get rid of Hitpoint dependency entirely.

There is a function on dev that allows to set hit with dependency

PiepMGI added a subscriber: PiepMGI.Mar 8 2017, 4:29 AM

There is also a remaining damage problem along with used caliber and vehicle type. Go directly to 2min10 of this video: (One of my firsts, sorry).