Page MenuHomeFeedback Tracker

AreaDamageManager events
Need More Info, NormalPublic

Description

I did some debug for a new AreaDamage events and seems like they do not manage insiders correctly.

You may have 3 or 4 OnEnter events without any OnLeave events at all. Or you get OnEnter event when leaving the trigger.
Because of that, damage and everything in event-methods is not calculated correctly.

And on top of that there is a lack of understanding different events.
f.e. you can't really tell the difference between those:

OnEnterBeginEvent
OnEnterServerEvent
OnEnterClientEvent
OnEnterEndEvent

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
2004
Category
General
Steps To Reproduce

Create new custom class:

class AreaDamageCustom extends AreaDamageManager

Add debug prints for next methods:

	override void OnTriggerCreated()
	override void OnTriggerDestroyed()

	override void OnEnterBeginEvent(TriggerInsider insider)
	override void OnEnterServerEvent(TriggerInsider insider)
	override void OnEnterClientEvent(TriggerInsider insider)
	override void OnEnterEndEvent(TriggerInsider insider)
	
	override void OnStayStartBeginEvent(int nrOfInsiders)
	override void OnStayStartServerEvent(int nrOfInsiders)
	override void OnStayStartClientEvent(int nrOfInsiders)
	override void OnStayStartEndEvent(int nrOfInsiders)
	
	override void OnStayBeginEvent(TriggerInsider insider, float deltaTime)
	override void OnStayServerEvent(TriggerInsider insider, float deltaTime)
	override void OnStayClientEvent(TriggerInsider insider, float deltaTime)
	override void OnStayEndEvent(TriggerInsider insider, float deltaTime)
	
	override void OnStayFinishBeginEvent()
	override void OnStayFinishServerEvent()
	override void OnStayFinishClientEvent()
	override void OnStayFinishEndEvent()
	
	override void OnLeaveBeginEvent(TriggerInsider insider)
	override void OnLeaveServerEvent(TriggerInsider insider)
	override void OnLeaveClientEvent(TriggerInsider insider)
	override void OnLeaveEndEvent(TriggerInsider insider)
	
	override bool OnEvaluateDamage(TriggerInsider insider, float damageCoef)

	override void PreDamageActions()
	override void PostDamageActions()

My setup was:

protected ref AreaDamageManager 	m_AreaDamage;
...
m_AreaDamage = new AreaDamageCustom( this );
m_AreaDamage.SetDamageComponentType(AreaDamageComponentTypes.HITZONE);
m_AreaDamage.SetDamageableTypes( {Man, DayZCreature, DayZPlayer, DayZInfected});
m_AreaDamage.SetExtents("-2 0 -2", "2 2 2");
m_AreaDamage.SetHitZones( {"Head","Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot"} );
m_AreaDamage.SetAmmoName( "CustomDmg" );  // Can use MeleeDamage for testing purposes
m_AreaDamage.Spawn();

Now get in game and run through trigger. I got 3 OnEnterServerEvent while running straight through.

Additional Information

The way damage was called was the same as in vanilla AreaDamageOnce:

override void OnEnterServerEvent(TriggerInsider insider)
	{
		super.OnEnterServerEvent(insider);
		
		OnEvaluateDamageEx(insider, 1);
	}

Event Timeline

Moonny created this task.Jul 19 2021, 2:14 PM
Moonny edited Additional Information. (Show Details)Jul 19 2021, 2:19 PM
Moonny added a comment.EditedJul 19 2021, 3:16 PM

Did some more testing. Vanilla AreaDamageOnce with my setup did call damage event when leaving a trigger aswell. And it should not because damage dealing is bind to OnEnterServerEvent. So even withour doing another debug I assume this method isn't called properly.

EDIT: AreaDamageLooped doesn't seems to use loop timer set via SetLoopInterval at all. It does instakill a player even if I set interval to 4 seconds.

EDIT2: AreaDamageLoopedDeferred seems working fine

Geez changed the task status from New to Assigned.Jul 20 2021, 11:31 AM
Geez added a subscriber: Geez.Feb 1 2022, 11:28 AM

Hello Moonny.
Can you please retest on latest experimental and let us know if there are any issues?
Regards,
Geez

Geez changed the task status from Assigned to Need More Info.Feb 1 2022, 11:28 AM