Jump to content
Sign in to follow this  
Lucky44

Detecting "downed pilots"

Recommended Posts

I'm working on a mission where I want to sort of simulate pilots who are shot down having to deal with hostile ground forces. This is a mainly air combat mission, with some room for Combat Search And Rescue (CSAR). The CSAR team will have to fight off hostiles as they try to extract pilots who are shot down. Players will be in the roles of pilots and CSAR.

(BTW, this must work on a dedicated server...)

So here's my thinking, but I'm open to better ideas.

  1. Detect any BluFor on the ground within a large trigger area (the "enemy territory" zone)
  2. Spawn hostiles on the ground near the BluFor on the ground
  3. Repeat for any other BluFor who are on the ground (even at the same time)

So I have a trigger with the Activation: BluFor, and the Condition:

((getPos(thislist select 0)) select 2) < 1

And in the On Activation box I have:

nul = [(thislist select 0)] execVM "spawnGroundHostiles.sqf";

And I have a script that does a great job of randomizing where the hostiles spawn, how far away, etc.

The only tricky part seems to be making the trigger work for multiple BluFor at the same time. That is, if two pilots are downed in different places, I want to spawn hostile squads for each one. (And when the CSAR team arrives, they might draw more hostiles too.)

How would I set it up to work for multiple simultaneous spawns?

Edited by Lucky44

Share this post


Link to post
Share on other sites

this should add the script to all units found.

{ nul = [_x] execVM "spawnGroundHostiles.sqf";} foreach thislist

update.

Probably better to do it this way

cond

 this

on act

{if  (getPos _x select 2 <1 ) then {nul = [_x] execVM "spawnGroundHostiles.sqf";}} foreach thislist

that should only spawn units on those close to the ground.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Thanks, mate. I'll try that straight away.

---------- Post added at 02:10 AM ---------- Previous post was at 01:33 AM ----------

Hmm, it doesn't seem to work. It works fine when there's only 1 unit in the zone, but it doesn't fire a second time for a second, simultaneous unit.

Share this post


Link to post
Share on other sites

It does and it doesn't work. If the units are standing within the trigger when it fires then it finds two units and activates the script twice.

The problem is if one unit trips the trigger and then a second enters, the trigger won't fire again for the second unit.

I'm not sure a trigger's going to be the best solution for this.

Maybe an array of all the units you want hunted and then randomly spawn units to go after them.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

if its MP, then triggers beheave like local triggers for players afaik.

so a simple condition:

(getPos player select 2) < 2

and on act:

nul = [player] execVM "spawnGroundHostiles.sqf";

should suffice, though you should add in type check or use setVariable getVariable to differenciate "downed pilots" and "CSAR" units, else script will fire for each of players below 2, unless that does not matter for you.

If triggers are set to repeatedly, downed players need to be out of trigger area before it can activate again ofc..

Share this post


Link to post
Share on other sites

Thanks for the further info. I haven't written back because I'm still trying to figure out what I need. That is, it might be more practical for the players to only have the first BluFor unit "downed" have hostiles come at him. But it's probably more realistic to have the hostiles spawn for EACH one who is downed in hostile territory.

I have a few questions though. On a dedicated server, isn't "player" a null object? So the idea above

(getPos player select 2) < 2

wouldn't work, would it?

Share this post


Link to post
Share on other sites

clients can spawn AI no problem, if downed pilot is found on player/client, and he spawns the units no problem.

the above condition will never fire on the server, however this will, but only once until all players are above 2 meter again.

({(getPos _x select 2) < 2} count playableUnits) != 0

Share this post


Link to post
Share on other sites

What about !(vehicle _pilot isKindOf "AIR") instead of checking height?

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  

×