Jump to content
Sign in to follow this  
deadlyhabit

Dynamic Guarded Hostage Rescue

Recommended Posts

Ok so I'm trying to port over a script I made in Arma 2 with almost 90% success and need a little bit of help from some of the scripting wizards on here.

What it's supposed to do:

Randomly place a disarmed hostage that doesn't move along with 4 armed guards in one of 6 named markers on the map.

Hostage has as added action of untie which silently joins him to your group.

Mission ends when hostage is brought to a named Extraction marker.

What is currently happening:

Everything is working fine with the exception of the hostage not staying put and running all over the place of his own AI free will.

The Scripts:

init.sqf

//
execVM "gue_random6.sqf";

if(true) exitWith {};

gue_random6.sqf

/////////////////////////////////////////////////////////
// Randomize placement of a group within 6 spots
// gue_random6.sqf
/////////////////////////////////////////////////////////

// if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.

// Create Group for units to be spawned into; must have group created BEFORE spawning units in.
_SideHQ = createCenter east;
_SideHQ1 = createCenter civilian;
groupAlpha = createGroup east;
groupHostage = createGroup civilian;

// Pick Location ///////////////////////////////////////////////////////////////////////
_markerPos = getMarkerPos format ["markerA%1",round ((random 6) + 0.5)];
_extraction = getMarkerPos "Extraction";

// Show Enemy Spawn Location as a GPS Coord in Hint
_gridPos = mapGridPosition _markerPos;

hint format ["Position %1", _gridPos];

//Generate Hostage
H1 = groupHostage createUnit ["C_man_1", _markerPos, [], 0, "FORM"];

removeAllWeapons H1;

nul = [H1] execVM "Hostage_male.sqf";


//Generate Soldiers

G1 = groupAlpha createUnit ["O_Soldier_AR_F", _markerPos, [], 0, "FORM"];
G1 setdir 360;

G2 = groupAlpha createUnit ["O_soldier_M_F", _markerPos, [], 0, "FORM"];
G2 setdir 360;

G3 = groupAlpha createUnit ["O_Soldier_GL_F", _markerPos, [], 0, "FORM"];
G3 setdir 360;

G4 = groupAlpha createUnit ["O_Soldier_lite_F", _markerPos, [], 0, "FORM"];
G4 setdir 360;  


//Triggers

//Victory
_trgVic = createTrigger ["EmptyDetector" , getMarkerPos "Extraction"];
_trgVic setTriggerArea [50, 50, 0, false];
_trgVic setTriggerType "END1";
_trgVic setTriggerActivation ["ANY", "PRESENT", false];
_trgVic setTriggerTimeout [10, 10, 10, false ];
_trgVic setTriggerStatements ["H1 in thislist", "", ""];

//Loss
_trgLoss = createTrigger["EmptyDetector", getPos H1];
_trgLoss setTriggerArea [0, 0, 0, false];
_trgLoss setTriggerType "LOOSE";
_trgLoss setTriggerActivation ["ANY", "PRESENT", false];
_trgLoss setTriggerTimeout [10, 10, 10, false ];
_trgLoss setTriggerStatements ["!(alive H1)", "", ""];

Hostage_male.sqf

// execute with in units initline.
// _null = [this] execVM "Hostage_male.sqf"
// hostage
_CivnotRescued = true;
_man = _this select 0;
_man setcaptive true;
_hostageact1 = _man addaction ["Untie","Hostagevars.sqf"];

while {_CivnotRescued} do {
_num=(ceil(Random 3));
if (_num==0) then {_man switchmove "civilsitting"};
if (_num==1) then {_man switchmove "civilsitting01"};
if (_num==2) then {_man switchmove "civilsitting02"};
if (_num==3) then {_man switchmove "civilsitting03"};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
};

_man removeaction _hostageact1;
_man disableAI "MOVE";
if (alive _man) then {
player attachto [_man,[0,-0.9,0]];
player setdir 0;
player switchmove "AinvPknlMstpSnonWrflDnon_medic";
sleep 3;
player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
player switchmove "";
_man switchmove "SitStandUp";
detach player;
sleep 2;
_man enableAI "MOVE";
// just put // before this if you dont want the unit to join your group
[_man] joinsilent player;
};

Hostagevars.sqf

// set unit not captive
_unit=_this select 0;
_unit setcaptive false;

Download with demo mission:

http://www.mediafire.com/?q6vnjnye97mjphn

Also does anyone know if there is an updated list of Moves akin to this for Arma 2/OA? http://community.bistudio.com/wiki/ArmA2:_Moves

Cheers guys.

Share this post


Link to post
Share on other sites

I have been using this on an AI that is the source for my livefeed.

this disableAI "TARGET"; this disableAI "AUTOTARGET";this allowfleeing 0; this setbehaviour "CARELESS";

Not sure if that is what you wanted, but it may help.

Share this post


Link to post
Share on other sites

Thanks for trying to help, but I actually found my error while attempting to implement your solution.

I had to move

_man disableAI "MOVE";

up in my Hostage_male.sqf file like so

// execute with in units initline.
// _null = [this] execVM "Hostage_male.sqf"
// hostage
_CivnotRescued = true;
_man = _this select 0;
_man setcaptive true;
_man disableAI "MOVE";
_hostageact1 = _man addaction ["Untie","Hostagevars.sqf"];

while {_CivnotRescued} do {
_num=(ceil(Random 3));
if (_num==0) then {_man switchmove "civilsitting"};
if (_num==1) then {_man switchmove "civilsitting01"};
if (_num==2) then {_man switchmove "civilsitting02"};
if (_num==3) then {_man switchmove "civilsitting03"};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
};

_man removeaction _hostageact1;
if (alive _man) then {
player attachto [_man,[0,-0.9,0]];
player setdir 0;
player switchmove "AinvPknlMstpSnonWrflDnon_medic";
sleep 3;
player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
player switchmove "";
_man switchmove "SitStandUp";
detach player;
sleep 2;
_man enableAI "MOVE";
// just put // before this if you dont want the unit to join your group
[_man] joinsilent player;
};

It's working properly now, but going to try to refine it a bit more add some more comments and a readme, then it should be ready for mission makers to use.

Share this post


Link to post
Share on other sites

Ok so I'm trying to refine this a bit more and switch from markers to invisible helipads at least for the hostage * soldier spawn points so they can be placed into buildings and at specific heights.

The issue I'm having now is while I'm still using named objects, my command to randomly generate the position returns a string.

Does anyone know how to convert a string to an object which is needed for getPos?

The closest I could find was in this old thread http://forums.bistudio.com/showthread.php?18567-Converting-string-value-to-object-name!

but it seems to suffer from the forum software being updated and old posting conventions being broken.

I was trying the new to Arma 3 command objectFromNetID but it doesn't seem to do the task (honestly have no real clue what it's for, wishful thinking)

Share this post


Link to post
Share on other sites

Ok so revisiting this is there an easy way to convert a string to an object?

Or am I better off using an if, then or switch structure for my randomization to just bypass that altogether?

Share this post


Link to post
Share on other sites

Just posting to let you know I tried that hostage_male and hostagevars scripts ages ago on arma 2 in a mission I was making, and I had a similar problem then with their behaviour but I was trying to use it on multiplayer, I guess you only made it for singleplayer. The other issue was that they stayed in their sat down position after being released and were sliding around on their ass everywhere. Unless you've changed it there is locality issues in there when it comes to MP missions.

Share this post


Link to post
Share on other sites

Yea the hostage_male I original nicked from that, but I'm in the process of tweaking it and refining it (hell I already did some that I haven't posted yet last night).

The gue_random6 on is my own little invention with some help from the Arma 2 scripting board back before I knew what I did now, but it's also been refined and now I'm revisiting it with some actual knowledge and hopefully will have something that is MP compatible as well.

Here's the Arma 2 script thread where it started if you want to take a gander http://forums.bistudio.com/showthread.php?94646-Random-spawn-positions-for-AI

I'm gonna run to the store in a bit, grab a 12 pack and sit down and try to get something with some more functionality.

As is in SP it works fine with the marker setup though.

I'm thinking that my initial switch method that the final poster in that thread got working by not using local variables (oopsie on my part) my be the way to go.

Share this post


Link to post
Share on other sites

I just took a quick look, I've tried to remove the large block of if statements, it seems to work.

I also added a few hints for debug..

// execute with in units initline.
// _null = [this] execVM "Hostage_male.sqf"
// hostage
_CivnotRescued = true;
_man = _this select 0;
_man setcaptive true;
_man disableAI "MOVE";
_hostageact1 = _man addaction ["Untie","Hostagevars.sqf"];

while {_CivnotRescued} do {
_num=(ceil(Random 3));
if (_num==0) then {_man switchmove "civilsitting"};
if (_num==1) then {_man switchmove "civilsitting01"};
if (_num==2) then {_man switchmove "civilsitting02"};
if (_num==3) then {_man switchmove "civilsitting03"};

for "_i" from 0 to 9 do { 
sleep 1;
if (not(captive _man) or  not (alive _man) ) then {_CivnotRescued = false;_i=9};
};
};

//if (not alive _man) exitwith {_man removeaction _hostageact1};

_man removeaction _hostageact1;
_man disableAI "MOVE";
if (alive _man) then {
player attachto [_man,[0,-0.9,0]];
player setdir 0;
player switchmove "AinvPknlMstpSnonWrflDnon_medic";
sleep 3;
player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
player switchmove "";
_man switchmove "SitStandUp";
detach player;
sleep 2;
_man enableAI "MOVE";
hint "Hostage freed";
// just put // before this if you dont want the unit to join your group
[_man] joinsilent player;
} else { hint "you failed to free the hostage"};

I don't under stand the bit about changing to helipads and having to convert strings.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Appreciated, ok so currently it uses markers for the zones the hostage and guards are spawned to.

So a command like this works because getMarkerPos calls for a string

_markerPos = getMarkerPos format ["markerA%1",round ((random 6) + 0.5)];

so this works fine when using markers

Now when I switch to the Invisible Helipad unit, I need to use getPos

getPos requires an object for it's argument, so I either need to redo my script to use a random into an if then setup or a switch

Or if I can convert a string to an object it saves me doing that, and a bunch of redundant lines that will be copy pasted for an if then or switch script.

Make sense?

Maybe that old thread when I first started this in Arma 2 may help make a bit more sense http://forums.bistudio.com/showthread.php?94646-Random-spawn-positions-for-AI

Cheers for removing statements and such, I've done such already as this was made when I first started scripting in Arma and looking at it everytime I have bits open in notepad++ I'm tweaking and seeing things to lose and optimize.

Good old motto of always keep learning.

Share this post


Link to post
Share on other sites

Why not just place the names of the pads into an array and then randomly select from that?

_markerPos = getPos ([mk1,mk2,mk3] call BIS_fnc_selectRandom);

Share this post


Link to post
Share on other sites

Because I've never seen that command or documentation on it.

BIS_fnc_selectRandom

can you hook me up with some more info?

Share this post


Link to post
Share on other sites
http://community.bistudio.com/wiki/BIS_fnc_selectRandom

http://www.ofpec.com/COMREF/index.php?action=read&id=231#selectrandom

There isn't an awful lot to know, you just place the elements in the array and it picks one at random.

Weird how'd I miss that, been using this link as my ref for ArmA 3 http://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

You don't happen to have a link to the current or A3 available switchMove available strings do you?

Apparently my gogglefu is lacking

Share this post


Link to post
Share on other sites

Only the animation viewer, you need to run it from a trigger

[] call BIS_fnc_animViewer;

Take a look in the game there are lists of fucntions to play with although they can be a little difficult to work out how to use them.

Share this post


Link to post
Share on other sites
Only the animation viewer, you need to run it from a trigger

[] call BIS_fnc_animViewer;

Take a look in the game there are lists of fucntions to play with although they can be a little difficult to work out how to use them.

Thanks man, any tips on finding the ones I'm apparently missing?

Share this post


Link to post
Share on other sites

Alright I have it working like I want and I think it should be MP compatible if anyone wants to test it.

Usage: Place 6 Invisible Helipads units on the map named Hostage1, Hostage2, Hostage3 etc and one marker named Extraction.

A hostage guarded by 4 OPFOR soldiers will be spawned at one of these 6 locations, he won't move and has an untie action bound to him which will cause him to stand, and silently join your group.

Get him to the Extraction marker zone to execute the trigger in the script (in this case Victory, but that can obviously be tweaked), or if he is killed failure.

Download with demo mission

Download

random6.sqf

/////////////////////////////////////////////////////////
// Randomize placement of a group within 6 spots
// gue_random6.sqf
/////////////////////////////////////////////////////////

if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.

// Create Group for units to be spawned into; must have group created BEFORE spawning units in.
_SideHQ = createCenter east;
_SideHQ1 = createCenter civilian;
groupAlpha = createGroup east;
groupHostage = createGroup civilian;

// Pick Location ///////////////////////////////////////////////////////////////////////
_posHostage = [Hostage1, Hostage2, Hostage3, Hostage4, Hostage5, Hostage6] call BIS_fnc_selectRandom;
_extraction = getMarkerPos "Extraction";

// Show Enemy Spawn Location as a GPS Coord in Hint
_gridPos = mapGridPosition _posHostage;

hint format ["Position %1", _gridPos];

//Generate Hostage
H1 = groupHostage createUnit ["C_man_1", _posHostage, [], 0, "FORM"];

removeAllWeapons H1;

nul = [H1] execVM "Hostage_male.sqf";


//Generate Soldiers

G1 = groupAlpha createUnit ["O_Soldier_AR_F", _posHostage, [], 0, "FORM"];
G1 setdir 360;

G2 = groupAlpha createUnit ["O_soldier_M_F", _posHostage, [], 0, "FORM"];
G2 setdir 360;

G3 = groupAlpha createUnit ["O_Soldier_GL_F", _posHostage, [], 0, "FORM"];
G3 setdir 360;

G4 = groupAlpha createUnit ["O_Soldier_lite_F", _posHostage, [], 0, "FORM"];
G4 setdir 360;  


//Triggers

//Victory
_trgVic = createTrigger ["EmptyDetector" , getMarkerPos "Extraction"];
_trgVic setTriggerArea [50, 50, 0, false];
_trgVic setTriggerType "END1";
_trgVic setTriggerActivation ["ANY", "PRESENT", false];
_trgVic setTriggerTimeout [10, 10, 10, false ];
_trgVic setTriggerStatements ["H1 in thislist", "", ""];

//Loss
_trgLoss = createTrigger["EmptyDetector", getPos H1];
_trgLoss setTriggerArea [0, 0, 0, false];
_trgLoss setTriggerType "LOOSE";
_trgLoss setTriggerActivation ["ANY", "PRESENT", false];
_trgLoss setTriggerTimeout [10, 10, 10, false ];
_trgLoss setTriggerStatements ["!(alive H1)", "", ""];

Hostage_male.sqf

// execute with in units initline.
// _null = [this] execVM "Hostage_male.sqf"
// hostage
_CivnotRescued = true;
_man = _this select 0;
_man setcaptive true;
_man disableAI "MOVE";
_man disableAI "ANIM";
_man action ["SITDOWN",_man];
_hostageact1 = _man addaction ["Untie","Hostagevars.sqf"];

while {_CivnotRescued} do {
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
};

_man removeaction _hostageact1;
if (alive _man) then {
player attachto [_man,[0,-0.9,0]];
player setdir 0;
player switchmove "AinvPknlMstpSnonWrflDnon_medic";
sleep 3;
player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
player switchmove "";
_man enableAI "ANIM";
_man switchmove "SitStandUp";
detach player;
sleep 2;
_man enableAI "MOVE";
// just put // before this if you dont want the unit to join your group
[_man] joinsilent player;
};

Hostagevars.sqf

// set unit not captive
_unit=_this select 0;
_unit setcaptive false;

Share this post


Link to post
Share on other sites

Quick little revision to Hostage_male.sqf if you want the hostage to be in the surrender animation stance instead of sitting:

// execute with in units initline.
// _null = [this] execVM "Hostage_male.sqf"
// hostage
_CivnotRescued = true;
_man = _this select 0;
_man setcaptive true;
_man disableAI "MOVE";
//_man action ["SITDOWN",_man];
_man switchMove "AmovPercMstpSsurWnonDnon";
_man disableAI "ANIM";
_hostageact1 = _man addaction ["Untie","Hostagevars.sqf"];

while {_CivnotRescued} do {
if (not(captive _man)) then {_CivnotRescued = false};
if (not alive _man) exitwith {_man removeaction _hostageact1};
sleep 1;
};

_man removeaction _hostageact1;
if (alive _man) then {
player attachto [_man,[0,-0.9,0]];
player setdir 0;
player switchmove "AinvPknlMstpSnonWrflDnon_medic";
sleep 3;
player switchmove "AinvPknlMstpSnonWrflDnon_medicEnd";
sleep 1;
player switchmove "";
_man enableAI "ANIM";
_man switchmove "SitStandUp";
detach player;
sleep 2;
_man enableAI "MOVE";
// just put // before this if you dont want the unit to join your group
[_man] joinsilent player;
};

If you want to have the hostage sitting, just remove the comment bit on //_man action ["SITDOWN",_man]; and add it to _man switchMove "AmovPercMstpSsurWnonDnon";

Share this post


Link to post
Share on other sites

A tip for using this.

Do not use invisible helipads if your placing the hostage in a building and also planning on calling AI helo transportation support as the AI will use the invisible helipad to try and land on.

Me and a few buddies successfully completed a mission to perfection. I then called in 3 blackhawk transports to evac us and all 3 attempted to land on triangular roof buildings........all crashing.

Share this post


Link to post
Share on other sites

hey great job thus far. I have some questions

I tried adding more opfor guards and "nato" HVT to "random 6", I know I have left some stuff out. But after adding this stuff so far, it cont's to just load the single civ HVT and 4 opfor. what else do I need to include. Under "loss" trigger, I wasnt sure if I needed to add more to "getPos", I am sure you do, also, do you need to assign opfor to different HVT? AND comas, brackets etc...

/////////////////////////////////////////////////////////

// Randomize placement of a group within 6 spots

// gue_random6.sqf

/////////////////////////////////////////////////////////

if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.

// Create Group for units to be spawned into; must have group created BEFORE spawning units in.

_SideHQ = createCenter east;

_SideHQ1 = createCenter nato;

groupAlpha = createGroup east;

groupHostage = createGroup nato;

// Pick Location ///////////////////////////////////////////////////////////////////////

_posHostage = [Hostage1, Hostage2, Hostage3, Hostage4, Hostage5, Hostage6] call BIS_fnc_selectRandom;

_extraction = getMarkerPos "Extraction";

// Show Enemy Spawn Location as a GPS Coord in Hint

_gridPos = mapGridPosition _posHostage;

hint format ["Position %1", _gridPos];

//Generate Hostages

H1 = groupHostage createUnit ["B_recon_F", _posHostage, [], 0, "FORM"];

H2 = groupHostage createUnit ["B_recon_TL_F", _posHostage, [], 0, "FORM"];

H3 = groupHostage createUnit ["B_recon_exp_F", _posHostage, [], 0, "FORM"];

H4 = groupHostage createUnit ["B_recon_M_F", _posHostage, [], 0, "FORM"];

removeAllWeapons H1;

removeallweapons H1;

removeallassigneditems H1;

removeVest H1;

removebackpack H1;

removeheadgear H1;

removegoggles H1;

removeAllWeapons H2;

removeallweapons H2;

removeallassigneditems H2;

removeVest H2;

removebackpack H2;

removeheadgear H2;

removegoggles H2;

removeAllWeapons H3;

removeallweapons H3;

removeallassigneditems H3;

removeVest H3;

removebackpack H3;

removeheadgear H3;

removegoggles H3;

removeAllWeapons H4;

removeallweapons H4;

removeallassigneditems H4;

removeVest H4;

removebackpack H4;

removeheadgear H4;

removegoggles H4;

nul = [H1] execVM "Hostage_male.sqf";

nul = [H2] execVM "Hostage_male.sqf";

nul = [H3] execVM "Hostage_male.sqf";

nul = [H4] execVM "Hostage_male.sqf";

//Generate Soldiers

G1 = groupAlpha createUnit ["O_Soldier_AR_F", _posHostage, [], 0, "FORM"];

G1 setdir 360;

G2 = groupAlpha createUnit ["O_soldier_M_F", _posHostage, [], 0, "FORM"];

G2 setdir 360;

G3 = groupAlpha createUnit ["O_Soldier_GL_F", _posHostage, [], 0, "FORM"];

G3 setdir 360;

G4 = groupAlpha createUnit ["O_Soldier_lite_F", _posHostage, [], 0, "FORM"];

G4 setdir 360;

G5 = groupAlpha createUnit ["O_recon_M_F", _posHostage, [], 0, "FORM"];

G5 setdir 360;

G6 = groupAlpha createUnit ["O_recon_LAT_F", _posHostage, [], 0, "FORM"];

G6 setdir 360;

G7 = groupAlpha createUnit ["O_recon_TL_F", _posHostage, [], 0, "FORM"];

G7 setdir 360;

G8 = groupAlpha createUnit ["O_recon_medic_F", _posHostage, [], 0, "FORM"];

G8 setdir 360;

//Triggers

//Victory

_trgVic = createTrigger ["EmptyDetector" , getMarkerPos "Extraction"];

_trgVic setTriggerArea [50, 50, 0, false];

_trgVic setTriggerType "END1";

_trgVic setTriggerActivation ["NATO", "PRESENT", false];

_trgVic setTriggerTimeout [10, 10, 10, false ];

_trgVic setTriggerStatements ["H1,H2,H3,H4 in thislist", "", ""];

//Loss

_trgLoss = createTrigger["EmptyDetector", getPos H1];

_trgLoss setTriggerArea [0, 0, 0, false];

_trgLoss setTriggerType "LOOSE";

_trgLoss setTriggerActivation ["NATO", "PRESENT", false];

_trgLoss setTriggerTimeout [10, 10, 10, false ];

_trgLoss setTriggerStatements ["!(alive H1 OR H2 OR H3 OR H4)", "", ""];

---------- Post added at 19:02 ---------- Previous post was at 17:38 ----------

Ok, the 8 opfor spawn, now I need some help with the HVT's. Thanks in advance.

Share this post


Link to post
Share on other sites

anyone have ideas on the last post here? I need it to spawn the 4 nato hvt's, may be even clean it up some. Not sure what I would need to do.

Thanks.

Share this post


Link to post
Share on other sites

No response from original creator. Anyone here take a look and see what else I need to change for HVT x 4 to spawn.

I know I have left some stuff out. the way its set now, the nato troops do not spawn, do I need to change each units position? And I added to the 2 triggers, are the brackets correct and with loss under create trigger do I "getPos" for each HVT?

Any help is appreciated.

thanks.

/////////////////////////////////////////////////////////

// Randomize placement of a group within 6 spots

// gue_random6.sqf

/////////////////////////////////////////////////////////

if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.

// Create Group for units to be spawned into; must have group created BEFORE spawning units in.

_SideHQ = createCenter east;

_SideHQ1 = createCenter nato;

groupAlpha = createGroup east;

groupHostage = createGroup nato;

// Pick Location ///////////////////////////////////////////////////////////////////////

_posHostage = [Hostage1, Hostage2, Hostage3, Hostage4, Hostage5, Hostage6] call BIS_fnc_selectRandom;

_extraction = getMarkerPos "Extraction";

// Show Enemy Spawn Location as a GPS Coord in Hint

_gridPos = mapGridPosition _posHostage;

hint format ["Position %1", _gridPos];

//Generate Hostages

H1 = groupHostage createUnit ["B_recon_F", _posHostage, [], 0, "FORM"];

H2 = groupHostage createUnit ["B_recon_TL_F", _posHostage, [], 0, "FORM"];

H3 = groupHostage createUnit ["B_recon_exp_F", _posHostage, [], 0, "FORM"];

H4 = groupHostage createUnit ["B_recon_M_F", _posHostage, [], 0, "FORM"];

removeAllWeapons H1;

removeallweapons H1;

removeallassigneditems H1;

removeVest H1;

removebackpack H1;

removeheadgear H1;

removegoggles H1;

removeAllWeapons H2;

removeallweapons H2;

removeallassigneditems H2;

removeVest H2;

removebackpack H2;

removeheadgear H2;

removegoggles H2;

removeAllWeapons H3;

removeallweapons H3;

removeallassigneditems H3;

removeVest H3;

removebackpack H3;

removeheadgear H3;

removegoggles H3;

removeAllWeapons H4;

removeallweapons H4;

removeallassigneditems H4;

removeVest H4;

removebackpack H4;

removeheadgear H4;

removegoggles H4;

nul = [H1] execVM "Hostage_male.sqf";

nul = [H2] execVM "Hostage_male.sqf";

nul = [H3] execVM "Hostage_male.sqf";

nul = [H4] execVM "Hostage_male.sqf";

//Generate Soldiers

G1 = groupAlpha createUnit ["O_Soldier_AR_F", _posHostage, [], 0, "FORM"];

G1 setdir 360;

G2 = groupAlpha createUnit ["O_soldier_M_F", _posHostage, [], 0, "FORM"];

G2 setdir 360;

G3 = groupAlpha createUnit ["O_Soldier_GL_F", _posHostage, [], 0, "FORM"];

G3 setdir 360;

G4 = groupAlpha createUnit ["O_Soldier_lite_F", _posHostage, [], 0, "FORM"];

G4 setdir 360;

G5 = groupAlpha createUnit ["O_recon_M_F", _posHostage, [], 0, "FORM"];

G5 setdir 360;

G6 = groupAlpha createUnit ["O_recon_LAT_F", _posHostage, [], 0, "FORM"];

G6 setdir 360;

G7 = groupAlpha createUnit ["O_recon_TL_F", _posHostage, [], 0, "FORM"];

G7 setdir 360;

G8 = groupAlpha createUnit ["O_recon_medic_F", _posHostage, [], 0, "FORM"];

G8 setdir 360;

//Triggers

//Victory

_trgVic = createTrigger ["EmptyDetector" , getMarkerPos "Extraction"];

_trgVic setTriggerArea [50, 50, 0, false];

_trgVic setTriggerType "END1";

_trgVic setTriggerActivation ["NATO", "PRESENT", false];

_trgVic setTriggerTimeout [10, 10, 10, false ];

_trgVic setTriggerStatements ["H1,H2,H3,H4 in thislist", "", ""];

//Loss

_trgLoss = createTrigger["EmptyDetector", getPos H1];

_trgLoss setTriggerArea [0, 0, 0, false];

_trgLoss setTriggerType "LOOSE";

_trgLoss setTriggerActivation ["NATO", "PRESENT", false];

_trgLoss setTriggerTimeout [10, 10, 10, false ];

_trgLoss setTriggerStatements ["!(alive H1 OR H2 OR H3 OR H4)", "", ""];

---------- Post added at 19:02 ---------- Previous post was at 17:38 ----------

Ok, the 8 opfor spawn, now I need some help with the HVT's. Thanks in advance.

Share this post


Link to post
Share on other sites

I'm not fully sure I know what your after but this may get you going a little.

/////////////////////////////////////////////////////////
// Randomize placement of a group within 6 spots
// gue_random6.sqf
/////////////////////////////////////////////////////////

if (! isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers.

// Create Group for units to be spawned into; must have group created BEFORE spawning units in.
_SideHQ = createCenter east;
_SideHQ1 = createCenter west;
groupAlpha = createGroup east;
groupHostage = createGroup west;

// Pick Location ///////////////////////////////////////////////////////////////////////
_posHostage = [Hostage1, Hostage2, Hostage3, Hostage4, Hostage5, Hostage6] call BIS_fnc_selectRandom;
_extraction = getMarkerPos "Extraction";

// Show Enemy Spawn Location as a GPS Coord in Hint
_gridPos = mapGridPosition _posHostage;

hint format ["Position %1", _gridPos];

//Generate Hostages
H1 = groupHostage createUnit ["B_recon_F", _posHostage, [], 0, "FORM"];
H2 = groupHostage createUnit ["B_recon_TL_F", _posHostage, [], 0, "FORM"];
H3 = groupHostage createUnit ["B_recon_exp_F", _posHostage, [], 0, "FORM"];
H4 = groupHostage createUnit ["B_recon_M_F", _posHostage, [], 0, "FORM"];

{
// _x setcaptive true; // enable if you don't want them killed
removeAllWeapons _x;
removeallweapons _x;
removeallassigneditems _x;
removeVest _x;
removebackpack _x;
removeheadgear _x;
removegoggles _x;
nul = [_x] execVM "Hostage_male.sqf";
} foreach [H1,H2,H3,H4];

//Generate Soldiers using dynamic naming
_i=1;
{
_unit = groupAlpha createUnit [_x, _posHostage, [], 0, "FORM"];
_unit setdir 360;
missionNamespace setVariable ["G" + str(_i),_unit];
_i=_i+1;
} foreach  ["O_Soldier_AR_F","O_soldier_M_F","O_Soldier_GL_F","O_Soldier_lite_F","O_recon_M_F","O_recon_LAT_F","O_recon_TL_F","O_recon_medic_F"];

//Triggers

//Victory
_trgVic = createTrigger ["EmptyDetector" , getMarkerPos "Extraction"];
_trgVic setTriggerArea [50, 50, 0, false];
_trgVic setTriggerType "END1";
_trgVic setTriggerActivation ["WEST", "PRESENT", false];
_trgVic setTriggerTimeout [10, 10, 10, false ];
_trgVic setTriggerStatements ["{_x in thislist} foreach  [H1,H2,H3,H4]", "", ""];

//Loss
_trgLoss = createTrigger["EmptyDetector", getPos H1];
_trgLoss setTriggerArea [0, 0, 0, false];
_trgLoss setTriggerType "LOOSE";
_trgLoss setTriggerActivation ["NONE", "PRESENT", false];
_trgLoss setTriggerTimeout [10, 10, 10, false ];
_trgLoss setTriggerStatements ["{alive _x} count  units groupHostage != 4 ", "'", ""];

Share this post


Link to post
Share on other sites

hey thanks that looks really good. I will test ASAP

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  

×