Page MenuHomeFeedback Tracker

TargetAcquired event handler
Closed, ResolvedPublic

Description

Requesting TargetAcquired event handler that triggers every time when group receives a new target. These targets would be same as the targets acquired by the nearTargets command.

The new EH would help with performance impact since you don't need to poll nearTargets all the time

The new EH could look like this:

addEventHandler ["TargetAcquired", 
{ 
params ["_group", "_targetUnit"];
}];

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

gc8 created this task.Jan 22 2024, 10:12 AM
gc8 updated the task description. (Show Details)
dedmen added a subscriber: dedmen.Jan 23 2024, 3:27 PM

You're writing about new command. But all I see is new eventhandler?

gc8 renamed this task from TargetAcquired Command to TargetAcquired event handler.EditedJan 23 2024, 4:27 PM

You're writing about new command. But all I see is new eventhandler?

sorry was calling it command for some reason. fixed now

h- added a subscriber: h-.Jan 23 2024, 5:12 PM
gc8 updated the task description. (Show Details)Jan 23 2024, 5:31 PM
dedmen set Ref Ticket to AIII-56224.Jan 25 2024, 2:24 PM

Newtarget is not feasible.
Target is already detected before its known. NewTarget triggers, while nearTargets still returns empty list.
Then when unit becomes known, it appears in nearTargets, but NewTarget wouldn't trigger, because the target has already been in the list, it was just updated. And for that we already have KnowsAboutChanged.
Looks like a won't do.

gc8 added a comment.Sat, Jan 27, 4:27 PM

Newtarget is not feasible.
Target is already detected before its known. NewTarget triggers, while nearTargets still returns empty list.
Then when unit becomes known, it appears in nearTargets, but NewTarget wouldn't trigger, because the target has already been in the list, it was just updated. And for that we already have KnowsAboutChanged.
Looks like a won't do.

ok but Im unsure if i can achieve same affect with those EHs than what I'm doing now.
What I do now is that I check targets using the nearTargets command and if one of those targets meet required condition i call forgetTarget on that and then the target is no longer listed by nearTargets.

this works but its bit slow because I have to do few loops to get it working, which is why this new EH would be handy

gc8 added a comment.Sun, Jan 28, 9:52 AM

I tried with the two EHs but this code did not prevent the tigris from shooting my pawnee:

this addEventHandler ["KnowsAboutChanged",
{
 params ["_group", "_targetUnit", "_newKnowsAbout", "_oldKnowsAbout"];

 systemchat format ["knows changed %1 %2", _group, time];

_group forgetTarget _targetUnit;


}];

this addEventHandler ["EnemyDetected",
{
 params ["_group", "_newTarget"];

 systemchat format ["EnemyDetected %1 %2", _group, time];

_group forgetTarget _newTarget;

}];

AFAIK forgetTarget is only temporary - aka when the enemy is still within view/distance/can be noticed again, the enemy will become known again

so for permanent you would need the said ignoreTarget or similar

ignoreForTargeting _unit or _unit setKnowledgeLimit 0 would be nice as well

dedmen closed this task as Resolved.Mon, Feb 12, 11:18 AM
dedmen claimed this task.

you really want T178693 so we'll do that there