Jump to content
Sign in to follow this  
Shape01

Setcaptive (Hostage rescue)

Recommended Posts

Multiplayer map where a player (bluefor) is held captive by OPFOR (so far so good using the setcaptive command).

However, OPFOR is transporting the prisoner to a location. I want the "setcaptive" command to end when the rescue team (BLUEFOR) detects the prisoner.

I have read a lot of places but havnt found anything about this. Can someone please point me in the right direction?

Share this post


Link to post
Share on other sites

What about a loop that keeps checking if the nearest unit is friendly or enemy? If it's enemy he most probably still is a prisoner, and if it's friendly then he was saved already.

A lot more foolproof this way i think.

Share this post


Link to post
Share on other sites

Well I havent solved this issue yet... However I believe that the command nearestobject could make this happen, that is...

- If Bluefor comes close enough to Prisoner then setcaptive = 0.

But how on earth would I be able to work this out? Im about to give up...

Help me BI-forum, your my only hope :-)

Share this post


Link to post
Share on other sites

Good thing I'm feeling lazy this morning, uhh afternoon, because I just thought of a much better and easier method.

Here are the steps to detect if a hostage has been rescued:

1. Make a trigger

- Size= 100x100

- Activation= Seized by BLUFOR

- Once

- Name= trigHostage

- On Act= hostage setcaptive false; hostage setcaptive false; hostage sideChat "Hey, Thanks for saving my ass!";

2. Make a hostage

- Name= hostage

- Init= doStop this; removeAllWeapons this; this setCaptive true; trigHostage attachTo [hostage, [0,0,0]];

How this works is that you make a seize zone (detects whoever has the upperhand in that particular zone), and you attach it to the hostage, so it move along with him. This should work in MP, but do test it just to be sure.

Share this post


Link to post
Share on other sites
However I believe that the command nearestobject could make this happen, that is...

- If Bluefor comes close enough to Prisoner then setcaptive = 0.

definitely a good idea.

but you said you want blufor to have *detected* the prisoner.

personally i'd go for a combination of knowsabout (=detection) and distance (say 25m), because nearestobject (or nearestobjects) requires a specific unit/side definition which might be uncomfortable at some point of the mission design:

Prisoner setcaptive true;
_captive=true;
while{_captive}do{
  {
    if((_x distance Prisoner <25) and (_x knowsabout Prisoner > 0))then{
       Prisoner setcaptive false;
       _captive=false;
    };
  }foreach units RescueGroup;
  sleep 3;
}; 

where RescueGroup is your rescueteam you can define with

RescueGroup = group this

in the init of one of the team members in the editor.

Edited by Wiper

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  

×