Talk:Arma 2: FSM Danger Causes
Are the events linked to internal engine behavior? I am asking as only DCCanFire have execution code in the states. If so, can you please share the reactions to each event type in a brief bullet point list. For example why is DCFire used for / useful for? It is caused at very high rate compared to the other events.
There is a default internal handling, which consists of switching into a combat behaviour, unless they are "careless". (Note: this switching is done for the whole group, it is currently not possible to do it per unit). This is accompanied with a radio message depending on an event: for event Fire, Hit and Explosion the message is "Under fire" or similar. When an enemy is detected, it is "Hostiles", "Contact", or similar. Units may be forced to disembark (when indicated by unloadInCombat config entry).
Are the events/danger.FSM calls only per unit or is there some group interaction?
I have tried to describe this for individual events. Most events are sent to all units regardless on the group, some are sent once per target per group only.
The events are only trigger for infantry units, right? Why is there no danger.FSM (exposed) for vehicles?
The events are triggered for all units and you can defined a danger FSM for vehicles.
What are the conditions to 'combat behaviour'? Can the combat behaviour disabled by scripting? If not, is there a chance for a scripting command to do so?
It can be disabled only by using behaviour careless.
It seems if an enemy is too far away, 'combat behavior' is not triggered. The assumptions comes from DCEnemyDetected triggered again and again. Is that intentional?
It does not seem intentional to me. Any danger even should switch whole group into combat behaviour.
Is DCHit trigger for any vehicle or only hostile? I assume it is triggered only for known vehicles for the given unit?
DCHit should be triggered only to the vehicle being hit.
Can DCDeadBody triggered twice per body? First when seen the kill and later on when moving over the body?
I do not think so.
Is DCScream triggered by any infantry unit or only civilian or some other conditions?
Yes, by any unit. The scream should be audible, therefore it should be possible to test ingame easily.
Why is DCCanFire only triggered 'an unit can fire an enemy for the first time (was not know before)'?
It is intended to handle the "surprise" situation: a new target appears (and can be fired upon).
If it doesn't manage to kill it during '4-8 seconds forceSpeed -1' phase, it will move on rather in most cases rather to engage again it seems - is this desired behavior?
I find it desired (if firing does not work, why firing any more? It makes more sense to get into cover instead), but if someone disagrees, it should be possible to modify the FSM with a different reaction.
What if the unit is firing onto another unit while DCCanFire is triggered for it, is the event effectively dropped? (Fighting another unit = either in a DCCanFire phase already or just returning fire.
If the unit is firing, it means it is stopped. With a default FSM you will therefore not see any reaction, but the event should be triggered.
Why is DCFire higher prio than DCCanFire? It means the later will be dropped when DCFire happens at the same time as DCCanFire. As DCFire happens a lot during combat, there is a high chance for this to happen. Especially during the long DCCanFire state processing (4-8 seconds long), it can easily happen to get a new DCCanFire and at least one DCFire event into the queue. With the new DCCanFire dropped in favor of DCFire.
I think giving CanFire so low priority was a mistake and it should rather have a highest priority.
What is the max distance of the triggering source for DCEnemyNear and DCExplosion?
There is no max distance per se. "Enemy near" depends on units seeing (and detecting) each other, "explosion" depends on being able to see or hear the impact/explosion (distance is computed from impact strength).