Page MenuHomeFeedback Tracker

Group Event Handlers feedback
New, NormalPublic

Description

  1. KnowsAboutChanged :

Currently the KnowsAboutChanged event handler triggers for more than just valid targets (those returned by targets/targetsQuery commands). For example see this comment: T161515#2281413

Some of those are not valid targets (e.g. misc objects such as modules, decals, props, etc. are returned too)

I can't think of any reason why the scripter should be interested in those objects anyway. So they should be filtered out.


  1. EnemyDetected:

The event handler doesn't seem to trigger at all.


  1. UnitLeft:

if you do [unit] joinSilent someGrp (someGrp can also be grpNull) the group of the left unit is grpNull when the EH triggers. It should trigger after the unit has a group (group of a unit should never be null)


  1. CombatModeChanged:

It only triggers if the Combat Mode changes automatically. It doesn't trigger if you do it via commanding menu or scripting commands (e.g grp setCombatMode "BLUE" or grp setCombatMode "RED" doesn't trigger)


  1. EnableAttackChanged:

Doesn't seem to trigger:
group player enableAttack !attackEnabled group player


  1. Fleeing:

Always shows true for the fleeing value.
Simply create an enemy officer with no weapons, name his group grp and shoot towards him a few times to make him flee:

grp addEventHandler ["Fleeing", {
	systemChat str ["ch", _this];
}];

[] spawn {
        waitUntil {fleeing leader grp};
        systemChat "fleeing";
	waitUntil {!fleeing leader grp};
	systemChat "not fleeing"
}

Feature Requests:

  1. CombatModeChanged: Should also be a unit event handler, since combat mode can be changed per unit (maybe that's why the group version doesn't work?)

  1. BehaviourChanged: Another very useful EH. Should be both a group and unit EH.

  1. CommandChanged: A unit EH that triggers when any parameter in the unit's currentCommand or expectedDestination changes. For a simple use case, it can be used instead of looping to detect when unit is ready: waitUntil {unitReady unit}

Details

Severity
Tweak
Resolution
Open
Reproducibility
Sometimes
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

Leopard20 created this task.Apr 6 2022, 8:54 PM
Leopard20 renamed this task from [Tweak Request] KnowsAboutChanged group EH should preferably only trigger for valid targets to Group Event Handlers feedback.Apr 6 2022, 10:01 PM
Leopard20 updated the task description. (Show Details)
Leopard20 updated the task description. (Show Details)Apr 6 2022, 10:44 PM
Leopard20 updated the task description. (Show Details)
pcc added a subscriber: pcc.Apr 6 2022, 11:58 PM
h- added a subscriber: h-.Apr 8 2022, 5:49 PM
Leopard20 updated the task description. (Show Details)Apr 9 2022, 1:22 AM
dedmen added a subscriber: dedmen.EditedApr 11 2022, 10:38 AM

Currently the KnowsAboutChanged event handler triggers for more than just valid targets (those returned by targets/targetsQuery commands). For example see this comment: T161515#2281413

player targets []
-> [13103a8f6080# 4: cluttercutter_small_f.p3d,13103a8f7580# 2: house_big_02_v1_ruins_f.p3d,13103a8f6b00# 3: garbagewashingmachine_f.p3d]
They are valid targets.

Some of those are not valid targets (e.g. misc objects such as modules, decals, props, etc. are returned too)

Yes, but targets command returns these too.

EnemyDetected:

The event handler doesn't seem to trigger at all.

(group enemyAI) addEventHandler ["EnemyDetected", {systemChat str ([_thisEvent]+_this), copyToClipboard str ([_thisEvent]+_this)}];
-> ["EnemyDetected",O Alpha 1-1,B Alpha 1-1:1 (dedmen)]

UnitLeft:

It should trigger after the unit has a group (group of a unit should never be null)

Due to how internals work thats too much effort.
The new group will be added within the same frame.

I could however fire the EH before the unit actually leaves the group. But that would mess with the past-tense name.

It only triggers if the Combat Mode changes automatically. It doesn't trigger if you do it via commanding menu or scripting commands (e.g grp setCombatMode "BLUE" or grp setCombatMode "RED" doesn't trigger)

setCombatMode doesn't set the combat mode, it sets the "Semaphore"
CombatMode is combatBehaviour/setCombatBehaviour/setBehaviourStrong command

This is so confusing....

EnableAttackChanged:

Correct, that EH is never called, apparently I forgot that one.

Actually this can only be triggered by the script command, nothing else touches the enableAttack state.

It only triggers if the Combat Mode changes automatically. It doesn't trigger if you do it via commanding menu or scripting commands (e.g grp setCombatMode "BLUE" or grp setCombatMode "RED" doesn't trigger)

setCombatMode doesn't set the combat mode, it sets the "Semaphore"
CombatMode is combatBehaviour/setCombatBehaviour/setBehaviourStrong command

This is so confusing....

That's behavior not combat mode...
Combat mode is RED, BLUE, etc. (open fire, hold fire)

BehaviourChanged: Another very useful EH. Should be both a group and unit EH.

Behaviour (CombatModeMajor) is stored per unit, so not a group handler.
It was on the original plan but wasn't done because its not a group thing.

CommandChanged: A unit EH that triggers when any parameter in the unit's currentCommand or expectedDestination changes. For a simple use case, it can be used instead of looping to detect when unit is ready: waitUntil {unitReady unit}

Sounds nice, but command is stored in group/subgroup, not on unit. So making it a group EH sounds doable.

That's behavior not combat mode...

Not in engine.

That's behavior not combat mode...

Not in engine.

Ok, but anyway it should be consistent with scripting command names, since that's what we scripters know. We don't know about the engine

BehaviourChanged: Another very useful EH. Should be both a group and unit EH.

Behaviour (CombatModeMajor) is stored per unit, so not a group handler.
It was on the original plan but wasn't done because its not a group thing.

To clear this up, what I mean is:
Behavior: Stealth, Combat, Careless, etc.
Combat Mode: Red, blue, etc.

That's the terminology I use here. I don't know about the engine

And both can be set per unit. See:
https://community.bistudio.com/wiki/setUnitCombatMode (this sets the combat mode)
https://community.bistudio.com/wiki/setCombatBehaviour (this sets the behavior)

So I think having a unit EH for them is even more useful than group EHs