Page MenuHomeFeedback Tracker

HitZoneContainerComponent not synchronizing damage states
Closed, ResolvedPublic

Description

Problem: JIP players are not informed of the damage state and or exact health of any hit zone. Meaning a JIP player will see a shot-out vehicle as fully pristine with all windows being not broken.

Current status: The comments on HitZoneContainerComponent hint at this being possibly by design, but if so the design is flawed. This is breaking the gameplay if a player is unable to know if there are windows protecting him or if the next small caliber bullet will go right through and hit him with full force. Not to speak of any customized content that uses hit zone damage states for more than windows (e.g. destroyable doors)

Solution: Either synchronize this in the engine (do not tell me it causes too much traffic, just sync those that are below max health as my example below shows) or make HitZone::SetHealth work on the client (local effect only then of course) so this scripted solution would work. The code below does it's job, it just has no effect yet

modded class SCR_HitZoneContainerComponent
{
	//------------------------------------------------------------------------------------------------
	override protected event bool OnRplSave(ScriptBitWriter writer)
	{
		if (!super.OnRplSave(writer)) return false;

		array<HitZone> hitZones();
		GetAllHitZones(hitZones);
		array<ref Tuple2<int, HitZone>> hitZonesWithDamage();
		foreach (int idx, HitZone hitZone : hitZones)
		{
			if (hitZone.GetHealthScaled() < 1.0)
			{
				hitZonesWithDamage.Insert(new Tuple2<int, HitZone>(idx, hitZone));
			}
		}

		writer.WriteInt(hitZonesWithDamage.Count());

		foreach (Tuple2<int, HitZone> hitZoneInfo : hitZonesWithDamage)
		{
			writer.WriteInt(hitZoneInfo.param1);
			writer.WriteFloat(hitZoneInfo.param2.GetHealth());
		}

		return true;
	}

	//------------------------------------------------------------------------------------------------
	override protected event bool OnRplLoad(ScriptBitReader reader)
	{
		if (!super.OnRplLoad(reader)) return false;

		int count;
		reader.ReadInt(count);

		if (count > 0)
		{
			array<HitZone> hitZones();
			GetAllHitZones(hitZones);
			int idx;
			float health;
			for (int nHitZone; nHitZone < count; nHitZone++)
			{
				reader.ReadInt(idx);
				reader.ReadFloat(health);
				hitZones.Get(idx).SetHealth(health);
			}
		}

		return true;
	}
}

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Sep 1 2022, 2:18 PM
MarioE added a subscriber: MarioE.Sep 1 2022, 5:19 PM
mbamg added a subscriber: mbamg.Sep 1 2022, 8:16 PM
Geez changed the task status from New to Awaiting internal Testing.Sep 5 2022, 9:33 AM
Geez closed this task as Resolved.Sep 15 2022, 12:42 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello Arkensor.
The issue has been fixed internally and the fix will appear in one of the future updates.
Regards,
Geez