Page MenuHomeFeedback Tracker

setHitIndex / setHitpointDamage not updating damage/getDamage + vice versa (in some cases)
New, NormalPublic

Description

As the title say:
They are not updating the damage, wich results in strange behaviour, when damaging/healing players via setHitIndex/setHitpointDamage.
Means: Players still have Dmg, even when all hitPoints are healed/dmg=0
Results in: "Easy to kill"-Player, since his Damage is still high (e.g. below)

Currently, (when healing players via SetHitIndex) i have to take take all HitpointDmg and divide them by the amount of HPs, then reassign them as Dmg.
Its not optimal/accurate, but it works (so far).
Same, when a player has Dmg, but no HitpointDamage. Take the damage -> Assign them as HitPointDamage.

Would be nice, to have this tweaked/fixed/added.
thx in advance.

Details

Severity
Tweak
Resolution
Open
Reproducibility
Always
Operating System
Windows 7
Category
Engine
Steps To Reproduce

Example 1:
Get in a car ->
drive with some speed against a tree ->
systemchat str ((getAllHitpointDamage player) select 2); //[0,0,0,0,0....]
systemchat str (damage player); //0.123456

Example 2:
player setDamage 0.8;
systemchat str ((getAllHitpointDamage player) select 2); //[0.8,0.8,0.8,0.8,0.8,....]

{player setHitIndex [_ForEachIndex,0];}forEach ((getAllHitpointDamage player) select 0);

systemchat str ((getAllHitpointDamage player) select 2); //[0,0,0,0,0....]
systemchat str (damage player); //0.8 -> Next shot: Player is dead

Event Timeline

Dscha created this task.Sep 12 2016, 11:53 AM
Dscha edited Steps To Reproduce. (Show Details)
Dscha edited Steps To Reproduce. (Show Details)Sep 12 2016, 11:56 AM

I can confirm this happens with vehicles. I found out that the part that depends on the total damage will get reset because Total can only be reset using setDamage.

Example:

Using the RHS MI24P, set damage using "setDamage 0.6"; observe every hitpoint set to 0.6, as in the steps to reproduce.

Follow the rest of the reproduction steps and end up with all hit point damages set to 0.

Enter the vehicle and observe all components are shown as white; start up the engine and the hull immediately turns red/orange. (dependent on the original setDamage value)

Check the getHitPointDamage for "hithull", see it has magically reverted to 0.6 because "Total" can't be changed using hitpoint and is not even a hitpoint.

The only possible fix I see is to make it so that if "hithull" (or whichever hitpoint depends on "Total") gets set, "Total" gets set.

oukej added a subscriber: oukej.EditedFeb 1 2019, 7:51 PM

Heya @NeilZar ! :)
This should only be valid for helicopters - their hitHull HPs are configured with depends = "Total". (May be true for some other or modded vehicles too)
If I do

vehicle player setDamage 0.6;
{vehicle player setHitIndex [_ForEachIndex,0];} forEach ((getAllHitpointsDamage vehicle player) select 0)

on a vanilla tank the hitHull remains 0.0.

Thanks for the reply @oukej

I didn't notice the issue with tanks, indeed. It is still annoying to have to do _vehicle setDamage 0 after having set all hitpoints to 0 on a helicopter.

Is there a reason why only helicopters have the hithull hp depend on the Total hp?

oukej added a comment.Feb 1 2019, 8:18 PM

I am sorry to say we won't be changing the behavior. When altering the damage with script it's needed to take care about both - the HPs and Total damage (or even take the affected vehicle config into account).
We can't change the behavior without affecting already released content and there might be situations when you want to just change one HP without affecting the Total damage.

oukej added a comment.Feb 1 2019, 8:23 PM

@NeilZar Is there a reason why only helicopters have the hithull hp depend on the Total hp? Most probably a legacy thing :/ After the tank damage improvements it would be nice to also take a look at how our other vehicles (e.g. aerial...) were set up, but I'm this will remain only as a wish.

Yea, that would probably be against the current stance of no more engine changes so mods don't get broken every time.