Home   Help Search Login Register  

Author Topic: Unit under fire  (Read 1060 times)

0 Members and 2 Guests are viewing this topic.

True Immortal

  • Guest
Unit under fire
« on: 30 Sep 2002, 19:24:10 »
is there a way to find out if a unit is fired upon?

i thought of using nearestObject to do it but since that function doesnt work in Resistance i have no way to do it

BitFlix

  • Guest
Re:Unit under fire
« Reply #1 on: 30 Sep 2002, 21:51:53 »
One possible solution is to store arrays of all units in your mission, and query their ammo in a script. If a unit has opened fire you then have to check it against all other units to see if he's facing him (you can do that using getdir and trigonometry, or maybe using vectors and dotproduct).

This isn't very reliable though, and its also quite complicated to script.


True Immortal

  • Guest
Re:Unit under fire
« Reply #2 on: 30 Sep 2002, 22:28:05 »
yah it's too complicated and tottaly not what i want.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Unit under fire
« Reply #3 on: 01 Oct 2002, 01:21:31 »
Welcome to the forums, guys

You could try the behaviour command...

If your units were set to safe, then when fired upon they will go into combat mode. The behaviour command will detect this.
If they were set to aware, hopefully they go into combat mode... I'm not too sure ;). Anyway, give it a go... the syntax for a group would be is:

"behaviour _x == ""combat""" count (units group) > 0