Page MenuHomeFeedback Tracker

SCR_AIGroupPerception.Event_OnEnemyDetected not always getting invoked
Closed, ResolvedPublic

Description

Currently there seems to be an issue with the SCR_AIGroupPerception class, as the Event_OnEnemyDetected does not always get invoked when a target gets detected.

Following issue:

  1. Player shoots at AI that has not yet detected them
  2. Players' shot gets added via SCR_AIGroupPerception::AddOrUpdateGunshot method
  3. Player (inside method IEntity is called shooter) is now added to m_aTargets and m_aTargetEntities (keep in mind, no Events invoked)
  4. AI turns in direction of player and spots them
  5. AI identifies player as Enemy
  6. SCR_AIGroupPerception::UpdateTargetsFromMembers updates the targets with DETECTED and ENEMY Target Category
  7. Player is now ENEMY, used to be DETECTED, but no Event is invoked

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce
  1. Spawn in ~100m from AI
  2. Shoot AI
  3. AI starts shooting back, yet SCR_AIGroupPerception::Event_OnEnemyDetected didnt fire

Event Timeline

Miep3r created this task.Mar 3 2024, 11:01 PM
Miep3r added a comment.EditedMar 3 2024, 11:56 PM

By adding these lines in a modded class of SCR_AIGroupPerception.c around line 127 I achieved desired behaviour:

if (oldCategory == EAITargetInfoCategory.DETECTED && target.GetTargetCategory() == ETargetCategory.ENEMY)
{
	// Moved from DETECTED (gunshot) to IDENTIFIED (enemy)
	Event_OnEnemyDetected.Invoke(m_Group, oldTargetInfo);
}
Geez closed this task as Resolved.Mar 4 2024, 6:33 PM
Geez claimed this task.