Page MenuHomeFeedback Tracker

assignedTarget only updates when the unit has attacked the target
Acknowledged, NormalPublic

Description

Please note this is only an issue when an AI group/squad leader/effectiveCommander is assigning the target, if done by scripting it works as intended.
This is a regression that happened around the oldman update (v1.98) and was previously working as intended, similarly the new getAttackTarget command only updates when the unit/gunner is able to fire.

CURRENT STATE
When an AI leader assigns the target to a subordinate, the subordinate engages as desired but assignedTarget will remain <NULL-OBJECT> until the subordinate has fired at it.
getAttackTarget does the same, even if a subordinate is engaging at their own will the script command will ONLY update when they fire at them.

EXPECTED OUTCOME
AssignedTarget should update when the commander assigns a target, this is how it worked at least in V1.96 and prior to it.
getAttackTarget should update when the subordinate selects a target to engage at their own will.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

  1. Launch reproduction mission - You are inside the tank group as driver so you can hear the commander order the gunner to target the enemy tank
  2. use the reveal addaction to make your tank aware of the enemy tank
  3. Watch in third person as:
    • The tank commander tells the gunner to engage the enemy tank, note the hint will remain null-object for both commands
    • Note the turret is turning to the target, it is still null-object
    • Sometimes the AI will open up with the MG, getAttackTarget will now return the correct object, but assignedTarget is still null
    • When the cannon is fired, assignedTarget will update
Additional Information

Additionally I have a old video from v1.96 where I was testing a script using assignedTarget, while it doesn't have any debug information the script was monitoring assignedTarget and it's the reason the gun is turned around by the AI to engage the tank cresting the hill:
https://www.youtube.com/watch?v=IODgN4kAJ3o
I have tested the exact same script and mission in v1.98 and V2.00 and it's completely non-functional

Event Timeline

KercKasha edited Steps To Reproduce. (Show Details)
KercKasha edited Steps To Reproduce. (Show Details)
dedmen changed the task status from New to Acknowledged.Oct 16 2020, 2:30 PM
dedmen set Ref Ticket to AIII-53426.
LouMontana added a project: Restricted Project.Oct 22 2020, 12:40 AM
dedmen added a subscriber: dedmen.EditedMay 6 2024, 3:58 PM

Ugh this is a mess.

The output of targetAssigned is correct. Because the target is not assigned to the gunner.
The gunner gets told to shoot the target, by the commander. The gunner does not shoot the target by themselves (which happens when they are assigned to the target)
The command and vehicle target the unit, not really the gunner unit.

The weapon the unit is using, knows what its told to shoot at.
We could say "If you are told to shoot something, that should be considered target"
That would be doable, if unit has no assigned target, check if its weapon is told to shoot at something and use that instead..

But that would be better suited for getAttackTarget, instead of assignedTarget.
Mostly because the assignedTarget wiki description has more specifics that I'd rather not mess up.

getAttackTarget really is the target we last shot at. So its only set by the short being fired.
So instead of "last fired at" we turn that into "last fired at, or commanded to fire at next"

I would leave assignedTarget in the current state. so attackTarget can be used instead in this case? Is that good enough?

When the cannon is fired, assignedTarget will update

The target assigning is delayed and seems to happen just at the same time when the cannon fires, bot because the cannon fires.

It looks rather the other way around, the assigned target is set, before the main cannon fires.

dedmen added a comment.May 6 2024, 6:05 PM

Repro mission is a bit meh, only updating every 0.5s
replacing with a onEachFrame makes it much easier to see

The weapon the unit is using, knows what its told to shoot at.
We could say "If you are told to shoot something, that should be considered target"
That would be doable, if unit has no assigned target, check if its weapon is told to shoot at something and use that instead..

Would it be better to add a new command then if technically the existing ones are correct? Especially in instances where it might have an assignedTarget but also another weapon target

dedmen added a comment.May 8 2024, 9:54 AM

getAttackTarget isn't well defined.
So it returning the "target the unit is told to attack" seems correct.
We're switching from "the target that was last shot at" to "the target we are going to shoot at". I think that fits.

KercKasha added a comment.EditedMay 8 2024, 9:57 AM

We're switching from "the target that was last shot at" to "the target we are going to shoot at". I think that fits.

Works for me