Jump to content
Sign in to follow this  
tophe

Dead body detection.

Recommended Posts

I would like to be able to script for AI to react to dead bodies.

Something like this.

_unit = _this select 0;
if (_unit seeBody) then {freakOut _unit; andOtherCoolStuff};

It would really do wonders to blackop missions if AI did react to dead bodies. Then you could script a simple search and destroy waypoint around the dead body.

That way you'd think twice before killing a unit.

Any solutions for this?

Share this post


Link to post
Share on other sites

The problem with dead bodies is that they aren't targetable by AI (necessary for true 'detection'). Easy solution could be to create a unique AI targetable object (perhaps create a simple config-only addon) on the body's position when the unit dies. After that, you could probably use knowsAbout or something.

Share this post


Link to post
Share on other sites

Is it possible to do some kind of knowsAbout on a game logic? Then one could place a logic at the body and have units do a procedure when the know about the logic. The logic would then disappear when body is hidden.

I know it is possible to do this only by script. I've seen it done in OFP in a very good script package that. (I think it was called SKY Ai or something)

There, when a unit saw another dead unit it would run over, kneel and check him. Then he would shoot in the air to alert nearby units and they all came running to start searching.

Share this post


Link to post
Share on other sites

Very nice idea Tophe. That would be a great addition. Im reminded of Splinter Cell where it was in your best interest to try and hide dead bodies to avoid alerts.

In ArmA II, upon body detection, the AI could do all manner of cool stuff like you point out. Like popping flares at night or switching on alarms and searchlights, conducting sweeps and just generally flapping their arms and shouting lots.

Im a noob as far as scripting goes but could you have a trigger of a certain size placed around a dead body and when an enemy AI reached said trigger it would fire off the panic sequence? Im sure there are much better ways to do this of course.

Edited by *TCF*Jackal

Share this post


Link to post
Share on other sites
Is it possible to do some kind of knowsAbout on a game logic?

Game logics are not AI targetable, so I doubt it.

As for scripted solutions, I never dismissed them, I simply said it would be easier to do it using the AI's already present ability to detect targetable objects.

A scripted solution would require all sorts of tracking and checking, and probably wouldn't give you results as good as if you used a targetable object. You would probably have to keep track of all the living units, wait for them to die, then keep track of their bodies, what side they were on (since dead bodies don't retain any of this information), where all the nearest living units are, whether they can see the body (and it's practically impossible to check line of sight). Dead bodies are pretty much ignored by AI; well they're nothing more than ammo crates to them at least, except ammo crates are still AI targetable... lol

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites

I've heard somewhere that bodies are turned into civilian units... Sounded a bit weird.

I'll have a look at the old Sky scripts tonight and try to sort out how it was done back then.

Share this post


Link to post
Share on other sites

Actually, I could be wrong myself. I can't check right now, but bodies might actually be AI targetable. Try using knowsAbout and see if it works, no promises though. It still might be easier to use a 'dead body' object though...

Share this post


Link to post
Share on other sites

You could try spawning a trigger on the death of a unit. It's not the same as the unit "seeing" it, but it might suffice your needs.

Share this post


Link to post
Share on other sites

That's a good idea... I will consider that idea.

Share this post


Link to post
Share on other sites
I've heard somewhere that bodies are turned into civilian units... Sounded a bit weird.

True, dead bodies are on no side and therefor treated as civilian.

Like Big Dawg said, I would test to see if "knowsAbout" works for bodies... atleast I would have expected it to work. Spawning some tiny object at the body would be the solution if it doesnt work.

The way to do all this would be an script that adds an "killed" eventhandler to all soldiers on the map (easy since we have this command now: http://www.arma2.com/comref/full.html#allUnits) The script would have to loop about every minute or so to check if all soldiers have the eventhandler/readd it (in case anything spawns late).

The eventhandler would then spawn a script for every soldier that gets killed. The script could however have an timelimit, so it stops after maybe 10 minutes or so. (since were already doing this, we can also use it to remove the corpse when the script ends, to avoid clutter)

Basically this all sounds very much doable, so all we need to know is if "knowsAbout" works for dead bodies.

Heres an alternate Idea I've just had...

This may, or may not work. It's very improvised and I can't try it myself right now.

We could try this command:

http://www.arma2.com/comref/full.html#ObjectfindCoverArray

I've never used it but it says that it is able to perform an visibility check when searching for cover. So if we let the soldier who is nearest to the corpse do an "findCover" with a maxRange of less than 1 meter combined with an visibilitycheck on the position of the corpse... maybe we could use the result of this command to determine wether he can see the corpse or not. Might be possible, but I'm sure its going to be tricky. Just a thought.

Share this post


Link to post
Share on other sites

I was thinking to do the same thing: Raise alert when a dead body is found within a base. I expected this to be somewhat easy ... well, when is it ever easy, hm? ;)

Unfortunately I'm kind of new to ArmA scripting, so I might have done something wrong, but this is what I tried: I made a square trigger in the size of the base and selected "OPFOR" + "Detected by OPFOR" + !alive this. That didn't do anything though.

My other attempt after reading this thread was the following:

Give the victim a name and bind a trigger to a certain other unit, then set this as condition:

"!alive targetSoldier && spotty knowsAbout targetSoldier > 0"

This actually works, but has some flaws:

- both soldiers must be named

- This trigger only works for this special case when spotty finds the dead targetSoldier

- knowsAbout is inaccurate; Spotty seemed to be able to look through a "large wall" before actually coming around the corner.

Anyway, maybe I'll find something that works for my base setup.

This brings me to a basic question: How can I access the unit that triggered the trigger? As you can see I tried stuff with "this" but it doesn't seem to work.

Edited by Atrocious

Share this post


Link to post
Share on other sites
This brings me to a basic question: How can I access the unit that triggered the trigger? As you can see I tried stuff with "this" but it doesn't seem to work.

I think "this" refers to the trigger itself. If you wish to access the items that are part of the triggering criteria, you use "thislist" which is an array of all items that have triggered the trigger. Hopefully the first time this happens it should contain only one item - your spotter.

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  

×