Jump to content
Sign in to follow this  
wiper

Command for checking contact

Recommended Posts

Hi folks,

what i am really missing is a function to check out if a AI unit has contact.

The knowsabout function only works for specified units so its  much time/resource consuming for a larger number of enemy units.

The trigger function "detected by _side_" just does the opposite...

What i am looking for is a function like

_unit knowsabout "EAST"

or a trigger function like

"detectING _side_"

In other words

there IS a function which OFP lets AI units react(fire) to any enemy unit entering its "viewing" radius....

...but how to access it confused.gif

Wouldn't it be a great new feature for one of the next patches ?

any other ideas ?

thanx

ww

Share this post


Link to post
Share on other sites

maybe a script with this command within can do the job:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit countEnemy array

Operand types:

   unit: Object

   array: Array

Type of returned value:

   Number

Description:

   Count how many units from the array are considered enemy by unit.

Example:

   player countEnemy list triggerOne

<span id='postcolor'>

Or maybe a script with the command *too lazy to write the variables* :

;u use a radius thingy with list command and use the getpos to know if u are in range to fire

? (getposition (AI-ennemy)) <= radiustofire: "goto gnagnagnia"

loop thingy

; the AI fire/or target depends u choose dofire or dotarget the man within range

#gnagniagna

AI dofire (ennemy in this list)

Well i give you the general idea... waking up i m not in the mood to write the whole script smile.gif

notice a thing the firing range of AI depends the weapon they got... and the general awareness they got *depends directly their skill*

Share this post


Link to post
Share on other sites

You can try trigger/script that checks behaviour of unit. Noramaly unit has "aware" behaviour but if it knows about enemy then behaviour changes to "combat".

One problem is that it works only with non-playable unit because if player go prone his behaviour changes to combat too.

condition :

behaviour unit == "combat"

Share this post


Link to post
Share on other sites

thanx to both of you !

jawk,

the countEnemy command looks very close to what i was looking for...

[edit Nov 19]

... but doesn't do the job...

what countEnemy simply does is to check the number of how many elements/units of an array are considered enemy.

It does not return if the unit actually has contact to one of them.

[edit end]

smart idea to check contact by scanning unit behaviour Bart :-)

again thanks for your inputs

ww

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  

×