Jump to content
Sign in to follow this  
crashdome

Group engaged?

Recommended Posts

Does anyone have a solid and reliable method of determining if a group (or the leader) is engaged in combat? i am not looking for if they "fired' or if they are "prone". There is a point in which a group walking safely along the road has seen enemy units and draws their weapon. Does the Combat Mode change accordingly? What if a group is already in "combat mode" via script?

I guess what I am asking is:

Has someone found a reliable method of finding out that moment a group discovers an enemy and stops following their waypoint (without large overhead of scanning every unit)?

Share this post


Link to post
Share on other sites
(without large overhead of scanning every unit)?

You mean like checking the "knowsAbout" thingy?

Share this post


Link to post
Share on other sites

Hmm... countEnemy is of no use as you need to supply an array of units, but findNearestEnemy has potential.

Are you saying that findNearestEnemy is always null when they are not engaged? What about aircraft?

This is an interesting command by itself, I wonder about the limits and potential. On the other hand, I was always thinking of nearTargets. The problem is that it requires a distance.

I really don't want to be concerned about distances, arrays of units, or threshold values. What I would like is simply to know when a unit has departed from a waypoint/actions as a result of combat/survival. Simple true/false equation. I realize I am asking something and putting in severe limits as to options, but there is good reason:

I want to execute something *only* when a unit is in combat. Whether it is aggressive or defensive... whether it is man or vehicle.... etc.. etc.. I dont care. I will find that information out once I execute, but my dilemma is figuring out *when* to execute. I impose limits in that I want it to be a simple check - no fancy loops or triggers or having to store arrays of units. One single function call every brief couple of seconds called on an AI leader unit or the 'group'. That is my goal!

I encourage wild ideas smile_o.gif but no elaborate work-arounds using some voodoo method that isn't guaranteed to work 99.9% of the time sad_o.gif

[edit]

Quote[/b] ]Just did a very small test with

CurrentCommand

while AI was moving the return was "MOVE",as soon he spotted me it changed to "ATTACK"

Donno if that can help ya

I saw this after I posted...

Yes! this is similar to what I am looking for, but I am not sure it is good. For one, there were some indications of when the current command was "NoPlan" or whatever. I wasn't sure if this is because they are not engaged or simply that they haven't been given their next target. What I mean to say is... does "ATTACK" hold true for all units engaged at every moment of the engagement?

I must test this when i get home smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Does the Combat Mode change accordingly?

Close. A group doesn't change combatmode, but it does change its behaviour.

A group will automatically change their behaviour to "combat" when they see/engage enemies. After they decide the engagement is over, they will switch back to whatever mode they were previously in.

The only exception is if they are in "careless" or "stealth" behaviours. In this case, they will stay in these behaviours, even if they engage in combat.

Share this post


Link to post
Share on other sites

Find nearest enemy only returns known enemies crash. Therefore, if findnearest enemy returns nothing, the unit does not know of any enemies.

The only problem with that is that it doesn't help with knowing when an enemy knows about them, but they don't know about him, if you know what I mean wink_o.gif.

Ohh, last time i checked this behaviour, it was in the first patch for the german version of the game. It's possible that it's since been changed, but not likely. It's easy to do a simple test of this.

Share this post


Link to post
Share on other sites

@General Barron

Excellent idea! but as you can see I am concerned about the stealth mode in particular. If AI units are in stealth mode, I cannot determine if they engaged in combat, HOWEVER, it is by far the best option right now. I could perhaps resolve my thinking that even though a group is in "Stealth" movement they are "engaged"... but the question is then "with whom?"

@ColSandersLite

Also excellent idea but with one flaw... if the units are not engaged with a known enemy, it will return a false positive... examples:

Patrolling units perceive an A-10 fly overhead.

UH-60 sees a convoy of trucks on the road enroute to waypoint.

At a brief moment it could return a positive, even though none of the units are likely to engage. I could add additional checks, like combine it with Gen Barron's idea... hmm.. maybe it has merit but only in combo with other commands.

@Everyone who posted

Excellent discussion so far! I hope to resolve this seemingly simple concept.

Share this post


Link to post
Share on other sites

Unless you've actually tested it and can say with definition that it works like that, I would be inclined to disagree.

I would think that what you're talking about is when the potential target's side status is "unknown". I should think that it does not return unknowns as enemies.

Again, it would be easy to test.

I would make an enemy squad walk towards your squad and use a waitUntil loop without a delay (that would synchronise it to the frame rate) to check constantly for when exactly it returns a positive. If it goes off when the AI says something like "12 o'clock, unkown man at 300", it doesn't work in the manner I'm describing. If it only goes off after the AI says something like "12 o'clock, enemy rifleman at 300", it works as I'm describing. Also, try vehicles and planes too just to be sure.

Share this post


Link to post
Share on other sites

OK... I performed my tests and came to a reasonable solution.

Being the good statistics student, I tested for the null hypothesis by testing all three dependant variables (Behavior Mode, FindNearestEnemy, and CurrentCommand).

Preface:

I found it unusual that simply placing an enemy Camel aircraft overhead causes a unit to immediately go prone and follow the aircraft as if engagign it, but then I gave it second thought and figured that exactly the behavior that should happen. The unit should perform a type of recon or observation in a "this could be dangerous" state.

IMO, this is NOT engaging the enemy, **however** observation can be construed as a form of engagement in some circumstances.

Conclusion:

findNearestEnemy

Works well, except that even in a unit in a careless state a known enemy will be returned (not engaging because "careless"). Since this generates a false positive, I tested no further.

behavior

Exactly as Gen barron described. Combat and Stealth ensure that engagement will happen. Unfortunately, setting a unit to these modes even though there are no enemies generates a fals positive. Tested no further.

currentCommand

Empty the whole test. Only when I forced a unit to attack by targetting a unit and telling them to "Attack" did it return a value. Opposite of false positive, but still fails to capture all conditions. Not significant.

behavior + findNearestEnemy

So far this is the best method. Assuming a careless state, even though FNE(findNearestEnemy) might return a value we can conclude that *only* in the situation where:

[*]Behavior = COMBAT or STEALTH

[*]findNearestEnemy count > 0

do we have engagement... Note: The non-threatening aircraft such as an empty MI-17 will generate engagement in this formula, BUT if we can combine with perhaps nearTargets or some other method of threat detection we can get more accurate results of whether or not the units will actually fire on the other unit given the chance. CurrentCommand could be used, but I had instances of firing without any result from currentCommand registering. I am going to fiddle with nearTarget by taking the array from findNearestenemy and comparing the threat values. I want to see what type of threat values are returned and how they stack up to different types... i.e. is a SU-34 more threatening to another aircraft versus a ground soldier.

[EDIT] btw.. findNearestEnemy always generates actual object - it does not ever generate an "unknown".

Share this post


Link to post
Share on other sites

Another idea that might work, though you will have to do some testing:

Try the assignedTarget command.

I'm not sure exactly when the AI starts assigning targets, but I would assume it would be right as soon as enemies are spotted. So basically, if anyone in the group has an assigned target, then the group is engaged. Again, you should defineately look into testing this, I'm just making some assumptions (though I have used this command before).

Share this post


Link to post
Share on other sites

Just tested.... excellent find! (How did I miss that one?)

At first appearance, it would seem it has same effect as findNearestEnemy. It doesn't. A unit will engage another unit and assignedtarget will appear to return a result *unless* the unit CANNOT engage it. For example, the MI-17 was a result for findNearest.. but not for assignedTarget.

This would leave us to believe we could replace findNearest... with assignedTarget but I am thinking that in times of danger.. using both would be beneficial.

For example:

[*]IF behavior = COMBAT or STEALTH :  Moving with aggressive/defensive intent

[*]AND findNearestEnemy count > 0 : Danger!! (perhaps run away? observe activity?)

[*]AND assignedTarget not null : Engaging a unit!!

Share this post


Link to post
Share on other sites

Well, using your hypothetical empty hind, the AI would attempt to blow it up I believe, and therefore a guy with an at capable weapon would still return an assigned target. Also, if there's an empty hind laying around, it's likely to be gaurded logically, so I don't necessarilly see a contradiction there.

I have a few questions though:

Does assigned target still apply if the unit you're running it on is alone?

Is there *always* an assigned target when the AI are in combat? Even if say the squad has no AT weapons, and they've spotted a tank? How about when they've spotted a heli flying overhead and have no weapons they are going to fire at it?

Can you give us some kind of idea as to what this is likely to be used for? I think if we knew more specifically what you're trying to achieve, we could probably provide guidelines more closely associated with that goal.

For example, if it was something like you want to make reinforcements move towards the nearest hostile contact to support their friends, simple nearest enemy would do in 99% of cases I think. If you're trying to achieve a specific effect with special considerations however, it would be nice to know what those considerations are.

Share this post


Link to post
Share on other sites

no no no.. not empty hind... a non threatening (i.e. pilot w/ no gunner) vehicle. You are taking my tests out of context.

My goal is as I stated above. I want to execute a script *only* when a unit is engaging another unit. NOT when he simply knows about them.. NOT when they are simply near them... and NOT just because they are enemies.

I ran another test and removing weapons from a friendly unit and watching his assigned target (never changed) in the presence of enemies.... it is like I thought. ONLY when the unit CAN engage an enemy (i.e. he has a weapon capable of damaging the unit) does he get assigned a target. So a rifleman will never have a T72 as an assigned target - even if they are threatening him biggrin_o.gif. This is what makes it more useful to me. It would seem the AI leader will do the assignment, but as long as a player is not the leader, he will have an assigned target before engaging (this includes running to and using grenades and such). IF the player IS the leader... then assigned target doesn't really work but my script is only for AI leaders anyways. In theory, I could use assignedTarget alone for my purpose... but I think the other commands provide better context of the situation.

As beneficial as it is, assigned target fails when it comes to simply checking for units on the defensive (i.e. being shot at) because the T72 can be shelling a unit and his assigned target might be nil because he has no rockets. That is where findNearestEnemy comes in handy. However, I am wondering if nearTargets would be better because it shows threat 'value'. I just don't know what it means by "more important of a target". Is a T72 important if the unit is a rifleman? (Just tested... appears it is)

To sum up, this is not necessarily about a specific target or group of targets. I simply want to know if a unit is engaged in battle. Behavior is a big help but too broad. AssignedTarget is the best, but fails when a unit cannot fight back (this can also be a benefit as in my case where I want to filter out defensive/retreating engagements). The best to wrap it up is either nearTargets and/or findNearestEnemy to conclude the context of the situation and determine if it is a defensive/retreating engagement.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×