Home   Help Search Login Register  

Author Topic: Detecting if unit is safe  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

Knowlife

  • Guest
Detecting if unit is safe
« on: 25 Feb 2005, 16:32:58 »
I have a slight problem. I'm making a script that is making a group patrol randomly between a number of gamelogics, that's all fine. The problem is after they encounter an enemy and kills him. Before combat they're in safe mode, but afterwards they proceed with their guns in their hands.

I need a way to detect if a unit is still fighting an enemy, or if they're done (or dead). Is'nt there a command that return an array of enemys known to a unit or something like that?

??? Please help me out. :)

(I've allready tried '_unit knowsabout enemy', but since 'enemy' returns a side, and 'knowsabout' only takes objects as parameters, it don't work.)
« Last Edit: 25 Feb 2005, 16:41:13 by Knowlife »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Detecting if unit is safe
« Reply #1 on: 25 Feb 2005, 17:38:44 »
Am I correct in thinking that you want the patrol to return to safe mode after the end of their firefight?

If so, here's what you do.   Create a trigger, repeating, West (or whoever the enemy is) not present.     Use a script or gamelogic loop to attach the trigger to the leader of the patrol group.  The trigger will look somethng like this

Area:  experiment.   maybe 150x150
Activation:   West not present    Repeatedly
Condition:   this and trig1On
On activation:   trig1On=false; leader patrolGrp1 setBehaviour "safe"

The variable trig1On is set to true (by the script or another trigger) when the patrol has a contact.    This is not at all guaranteed by the way, I'm just making it up.

Plenty of reviewed ArmA missions for you to play

Knowlife

  • Guest
Re:Detecting if unit is safe
« Reply #2 on: 25 Feb 2005, 17:53:19 »
Am I correct in thinking that you want the patrol to return to safe mode after the end of their firefight?

Yes, precisly.

But the thing is, I'm going to have A LOT of patrols all over the island, and I'm asuming that making a trigger for each of them (or giant trigger to cover the entire island) will consume a lot of resources...

It was actually my initial plan to have a trigger like that, covering the hole map. Then I could use the 'list' command to gather unit handlers and test for potential enemies with the 'knowsabout' command. If anybody knows a more optimal way of doing this, please tell me.
« Last Edit: 25 Feb 2005, 17:54:19 by Knowlife »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Detecting if unit is safe
« Reply #3 on: 25 Feb 2005, 20:38:36 »
Hmm... well, I know that when the AI sees enemies, they automatically go into behaviour = "COMBAT". Perhaps they will revert to behaviour = "AWARE" after they no longer see any enemies? It would be worth checking into.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Knowlife

  • Guest
Re:Detecting if unit is safe
« Reply #4 on: 25 Feb 2005, 20:47:58 »
I just tried that out, and yes, as soon as the AI stops fighting he goes back into aware mode. (Though he waits a little after the last enemy was killed, just to be sure ;)).