Jump to content
Sign in to follow this  
theavonlady

Target prioritization

Recommended Posts

Is there a script available that can control the threat prioritization of targets?

For example, when AI planes attack armor, it would be in their best interest to knock out AA units, such as Shilkas, before toasting the rest.

So if an AI pilot is commanding a plane squadron that the player is in, the AI commander will issue target orders for more threatening units first.

Can this be done in OFP? If so, has anyone done it? rock.gif

TIA.

Share this post


Link to post
Share on other sites

I think the AI should already determine the units to attack first by using the threat values in the unit's config...

Share this post


Link to post
Share on other sites

We all know OFP AI, kegs. ;) It is possible though.

Add all prioritees(?) in an array, all other units in another. Then do a knowsabout check and if the prioritees can be spotted, setcaptive the others.

:beat: *Gets Shot* :beat:

Share this post


Link to post
Share on other sites
We all know OFP AI, kegs. ;)

Well, that's sort of the problem.

If an AI commander detects a BMP first and already issues a TARGET BMP command to, say, AI #2, the AI commander will not current issue a new command to AI #2 if it detects a Shilka, will it?

Assuming that limitation, so:

1. Would Real Armstrong's script idea override OFP's built-in targetting logic?

2. Could this script be implemented from a unit's INIT line or must it be built into an addon's configuration?

3. How soon can you write this up for me? tounge_o.gif

Share this post


Link to post
Share on other sites

For example,

You have a chopper named HELI1

You have 2 shilkas , named SHI1 and SHI2

That should work , at least i hope it should work in SP mode (notice that the important keyword here is "should" ;) )

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#priorityALLdetect

?HELI1 knowsabout SHI1 : goto "prioritykillSHI1"

?HELI1 knowsabout SHI2 : goto "prioritykillSHI2"

~2

goto "priorityALLdetect"

#prioritykillSHI1

HELI1 dotarget SHI1

HELI1 dofire SHI1

?SHI1 not alive : goto "onlySHI2"

~1

goto "prioritykillSHI1"

#prioritykillSH2

HELI1 dotarget SHI2

HELI1 dofire SHI2

?SHI2 not alive : goto "onlySHI1"

~1

goto "prioritykillSH2"

#onlySHI1

?HELI1 knowsabout SHI1 : HELI1 dofire SHI1

?SHI1 not alive : goto "endingscript"

~1

goto "onlySHI1"

#onlySHI2

?HELI1 knowsabout SHI2 : HELI2 dofire SHI2

?SHI2 not alive : goto "endingscript"

~1

goto "onlySH2"

#endingscript

exit

call this script

nameyouwant.sqs

in the editor put

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[HELI1] exec "nameyouwant.sqs"

in the init line of the HELI1 chopper.

Certainly no chance at all to work for a MP mission.

Share this post


Link to post
Share on other sites
I think the AI should already determine the units to attack first by using the threat values in the unit's config...

As I tested before AI choosing target by "cost" values.

Share this post


Link to post
Share on other sites

This the first working version.

Need a trigger:

a=15000;

b=15000;

activationBy="EAST";

repeating=1;

age="UNKNOWN";

expCond="""tank"" CountType ThisList > 0";

expActiv="Enemies = ThisList ";

------------------------------------------------------------------------

;Here is the script:

_myvehicle = heli

;disable heli to target enemy

heli setcombatmode "BLUE"

#Start

;list of vehicles that threatening heli, first is the most dangerous

_threatList = ["ZSU","BMP2","anyothervehicle"]

_enemyvehicleList = []

{if (((typeOf vehicle _x) in _threatList) and (_myvehicle knowsabout vehicle _x > 0.105) and (not ((vehicle _x) in _enemyvehicleList)) ) then {_enemyvehicleList = _enemyvehicleList + [vehicle _x]}} forEach Enemies

_enemyvehicleCount = count _enemyvehicleList

hint format ["Threatening targets: %1",_enemyvehicleCount]

?(_enemyvehicleCount == 0): hint "No Threatening target!"; heli setcombatmode "RED"; exit

~ 2

_tmptarget = Objnull

_i = 0

_j = 0

#Find

_tmptarget = _enemyvehicleList select _i

?(typeOf _tmptarget == _threatList select _j): _target = _tmptarget; goto "Attack"

_i = _i + 1

?(_i == _enemyvehicleCount): _j = _j + 1; _i = 0

?(_j < count _threatList): goto "Find"

exit

#Attack

hint format ["Target found: %1",typeOf _target]

heli dotarget _target

heli dofire _target

~ 2

?(alive _target):goto "attack"

goto "Start"

exit

------------------------------------------------------------------------

Share this post


Link to post
Share on other sites

I will play around with this when I have a chance. Thanks.

Can someone do my shopping for me, too?

Share this post


Link to post
Share on other sites
I will play around with this when I have a chance. Thanks.

Can someone do my shopping for me, too?

I already have the core script but it does opposite thing. Vehicle avoids threatening enemy. tounge_o.gif I rewrote a bit

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  

×