Jump to content
Sign in to follow this  
Wire

About HVT capturing missions (High Value Target)

Recommended Posts

Hi guys,

Im real new to making missions that incorporate .sqf files and actions, but would love some help with this one.

So far, I have found an old mission script from Norrin "POW Capture/Join Group" script. I am currently trying to modify it to create a capture HVT mission, similar to those special forces operations in Afghanistan.

At its most basic, all I want to mission to do is approach the enemy (who is setcaptive true), get to about 5m of him, and have the action menu pop up with "Arrest HVT" (To which case, he joinsilent my team, and we evac).

Heres what I got so far:

Start init.sqf

*/

waitUntil{player == player};

//run script that creates all triggers required for the revive script

[] execVM "HVT_sqf\trigger_mkr.sqf";

sleep 0.5;

//Variables required for onConnect script and triggers

onConnect = true;

PublicVariable "onConnect";

Start HVT_Join_action.sqf

*/

if (!local player) exitWith {};

_group = group player;

_c = 0;

HVT_capture = false;

sleep 0.5;

//Body of the script

while {true} do

{

while {!HVT_capture && alive player} do

{

//Check to see if unit from group is within 5 metres of HVT

_d = 0;

{if (_x distance pow1 <= 5 && alive HVT) then {_d = _d + 1}} forEach units _group;

//add capture action to group leader if unit from _group is within 5 metres of HVT

if(player == leader _group && _d > 0 && _c == 0) then

{

call compile format ["myaction_capture_%1 = %1 addAction [""Capture HVT"", ""HVT_sqf\capture.sqf"",_group, 0, false, true]", player];

_c = _c + 1;

};

//Check to see if unit from group is within 5 metres of HVT

_e = 0;

{if (player == leader _group && _x distance HVT <= 5 && alive HVT) then {_e = _e + 1}} forEach units _group;

//remove capture action if unit from _group is not within 5 metres of HVT

if(player == leader _group && _c == 1 && _e == 0) then

{

call compile format ["%1 removeAction myaction_capture_%1;", player];

_c = 0;

sleep 2;

};

sleep 2;

};

//if the group leader dies remove action

if (!HVT_capture && !alive player) then

{

call compile format ["%1 removeAction myaction_capture_%1;", player];

_c = 0;

sleep 2;

};

//Exit script if HVT joins group or if HVT is dead

if (POW1_capture || !alive pow1) exitWith

{

call compile format ["%1 removeAction myaction_capture_%1;", player];

};

};

begin capture.sqf

*/

_group = _this select 3;

[HVT] joinsilent _group;

player sideChat "WE HAVE THE HIGH VALUE TARGET. OUT.";

HVT_capture = true;

publicVariable "HVT_capture";

sleep 8;

if (true) exitWith {};

So basically, does this work first of all? and secondly, how do you get it to work in the mission? >.< coz ive tried everything, and everytime I approach the HVT the action doesnt appear.

Help would be really appreciated guys, thanks alot!

Wire

Share this post


Link to post
Share on other sites

I would imagine this question has cropped up a few times already on the forums but I need something like this in a mission i am working on so if i can help you i also have something to use myself :rolleyes:

first off, i think the very first line will return an error (at least Squint did):

Start HVT_Join_action.sqf
*/

there is no command "start" - so i suppose this is meant to be a comment line

if you want to make a block of comments do this (i think):

/*
Start HVT_Join_action.sqf
*/

but as it's only one line of comment just use double slash and get rid of the */ bit

//Start HVT_Join_action.sqf

{if (_x distance pow1 <= 5 && alive HVT) then {_d = _d + 1}} forEach units _group;

^ this is weird - seems to be referring to two units "pow1" and "HVT" - i think you just want "HVT", name of highvalue unit in the editor

perhaps you changed one to "HVT" and missed the other

the script seems to be checking if any unit in the player's group is within 5m which is more flexible and allows the player to send a team member over to the HVT instead of going themself. but is all that really necessary for you? i must admit i am stuggling to follow this script - probably the hangover

for a simple single player mission would be much easier to just check the player's position, as he is responsible for the capture IMHO and he will be given the action.

i can't get my head round this one so made something simpler, have tested it and it works fine. 3 sqf files needed in the root of your mission folder. to test just create your squad + a civilian unit with name HVT in the editor. this works fine for a civilian but i can't get close enough to an armed opponent to capture him before being killed or my men light him the fook up! you mentioned HVT will be setCaptive but bear in mind "If you make a unit captive, that unit will still fire on the enemy, but the enemy will not fire back." http://community.bistudio.com/wiki/setCaptive

init.sqf

nul=[]execVM "captureHVTloop.sqf";

captureHVTloop.sqf

if (!local player) exitWith {};

private ["_exitloop","_actionadded","_id"];

_exitloop=false;
_actionadded=false;
sleep 0.5;

while {!_exitloop} do {   //keep running thru loop until HVT dead or captured

   //check to see if player close enough and action not already added and HVT still alive - if so add the action
   if (player distance HVT <= 5 && !_actionadded && alive HVT) then {
_id=player addAction ["Capture HVT", "capture.sqf"];
_actionadded=true;
   };
   //if the action was previously added and the player moved away then remove the action
   if (player distance HVT > 5 && _actionadded) then {
player removeAction _id;
       _actionadded=false;
   };

   //if the HVT has joined player's group then remove the action and prepare to exit the loop
   if (group player ==  group HVT) then {
       _exitloop=true;
player removeAction _id;
   };

   //if HVT is dead then prepare to exit the loop
   if (!alive HVT) then {
       _exitloop=true;
       //remove the action if it was previously added
       if (_actionadded) then {
player removeAction _id;
};
   };

   sleep 0.1;
};

capture.sqf

[HVT] join group player;
HVT setCaptive true;
removeAllWeapons HVT;
exit;

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  

×