GalacticTwinkles 16 Posted August 5, 2016 Hey guys! First script I've ever put up on the forums, but as far as I know no one has posted a hostage script using the new HoldAction function. I needed it for a mission and figured it may be helpful to some! I'm not sure if it works in MP yet, 2 AM so I haven't gotten to test.Tested and working in MP! For me anyway. Any bugs or blatant mis-coding, let me know! Features: Random hostage animation. AI joins player group after release. Uses Arma 3 Hostage Icons. Multiplayer Compatible (JIP should work too) Random interruption and completion dialogue from hostage. Nothing too fancy! Just simple. INSTRUCTIONS/CODE: Just put the following in the init box of the unit you want to be a hostage: null = [this] execVM "hostageScript.sqf"; And either create an SQF and copy and paste the below code or put the downloaded SQF in your mission folder. SCRIPT: // Set AI Hostage Script // By Galactic Twinkles // Define Captive _captive = _this select 0; // Select random animation _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; // Set Captive Settings _captive setCaptive true; // Remove Items removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive switchMove _anim; // SwitchMove to random animation // Set unit as hurt if it's the Execution animation if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; _captive disableAI "MOVE"; // Disable AI Movement _captive disableAI "AUTOTARGET"; // Disable AI Autotarget _captive disableAI "ANIM"; // Disable AI Behavioural Scripts _captive allowFleeing 0; // Disable AI Fleeing _captive setBehaviour "Careless"; // Set Behaviour to Careless because, you know, ARMA AI. // Add Hold Action to Free Hostage [ /* 0 object */ _captive, /* 1 action title */ "Free Hostage", /* 2 idle icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 3 progress icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 4 condition to show */ "true", /* 5 condition for action */ "true", /* 6 code executed on start */ {}, /* 7 code executed per tick */ {}, /* 8 code executed on completion */ { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { _this select 0 playMove "Acts_ExecutionVictim_Unbow"; } else { _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; }; _complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"]; ["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"]; sleep 5.5; (_this select 0) enableAI "MOVE"; (_this select 0) enableAI "AUTOTARGET"; (_this select 0) enableAI "ANIM"; (_this select 0) setBehaviour "SAFE"; [(_this select 0)] joinSilent player; [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove",[0,-2] select isDedicated,true]; }, /* 9 code executed on interruption */ { _intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."]; ["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"]; }, /* 10 arguments */ [_anim], /* 11 action duration */ 3, /* 12 priority */ 0, /* 13 remove on completion */ true, /* 14 show unconscious */ false ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true]; For use on units spawned via script, see @davidoss's wonderful example right here. Changelogs: Ver. 0.1: Added execution loop animation. Set unit as hurt if using execution loop animation. Added random interruption dialogue from the hostage. Added random completion dialogue from the hostage. Updated a few settings to make functionality work in MP, as far as I can tell it's all good. Ver. 0.0: Created. For those who just want a download link: DOWNLOAD HERE (Google Drive) 11 2 Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted August 5, 2016 Neat example. You could easily replace the switch and _number = floor random lines with this: _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05"]; _captive switchMove _anim; and remove the sleep 0.001, since it's absolutely not necessary to have a sleep in here, this function can be called without any performance impact. Cheers 2 Share this post Link to post Share on other sites
GalacticTwinkles 16 Posted August 5, 2016 Neat example. You could easily replace the switch and _number = floor random lines with this: _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05"]; _captive switchMove _anim; and remove the sleep 0.001, since it's absolutely not necessary to have a sleep in here, this function can be called without any performance impact. Cheers Ah! SelectRandom! I could not think of or find that command for the life of me at the time, so I just went with a switch. I'll update it now. Thanks! 2 Share this post Link to post Share on other sites
davidoss 552 Posted August 6, 2016 Nice and easy. Thanks Here an example how to get it working using scripted units: hostage.sqf: fnc_release = { // Set AI Hostage Script // By Galactic Twinkles // Define Captive _captive = _this select 0; // Select random animation _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; // Set Captive Settings _captive setCaptive true; // Remove Items removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive switchMove _anim; // SwitchMove to random animation // Set unit as hurt if it's the Execution animation if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; _captive disableAI "MOVE"; // Disable AI Movement _captive disableAI "AUTOTARGET"; // Disable AI Autotarget _captive disableAI "ANIM"; // Disable AI Behavioural Scripts _captive allowFleeing 0; // Disable AI Fleeing _captive setBehaviour "Careless"; // Set Behaviour to Careless because, you know, ARMA AI. // Add Hold Action to Free Hostage [ /* 0 object */ _captive, /* 1 action title */ "Free Hostage", /* 2 idle icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 3 progress icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 4 condition to show */ "true", /* 5 condition for action */ "true", /* 6 code executed on start */ {}, /* 7 code executed per tick */ {}, /* 8 code executed on completion */ { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { _this select 0 playMove "Acts_ExecutionVictim_Unbow"; } else { _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; }; _complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"]; ["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"]; sleep 5.5; (_this select 0) enableAI "MOVE"; (_this select 0) enableAI "AUTOTARGET"; (_this select 0) enableAI "ANIM"; (_this select 0) setBehaviour "SAFE"; [(_this select 0)] joinSilent player; [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove"]; }, /* 9 code executed on interruption */ { _intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."]; ["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"]; }, /* 10 arguments */ [_anim], /* 11 action duration */ 3, /* 12 priority */ 0, /* 13 remove on completion */ true, /* 14 show unconscious */ false ] remoteExec ["bis_fnc_holdActionAdd"]; }; //init.sqf [] call compile preprocessFileLineNumbers "hostage.sqf"; //some script _hostageGroup = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; {[_x] spawn fnc_release} forEach (units _hostageGroup); 1 Share this post Link to post Share on other sites
GalacticTwinkles 16 Posted August 6, 2016 Nice and easy. Thanks Here an example how to get it working using scripted units: hostage.sqf: fnc_release = { // Set AI Hostage Script // By Galactic Twinkles // Define Captive _captive = _this select 0; // Select random animation _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; // Set Captive Settings _captive setCaptive true; // Remove Items removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive switchMove _anim; // SwitchMove to random animation // Set unit as hurt if it's the Execution animation if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; _captive disableAI "MOVE"; // Disable AI Movement _captive disableAI "AUTOTARGET"; // Disable AI Autotarget _captive disableAI "ANIM"; // Disable AI Behavioural Scripts _captive allowFleeing 0; // Disable AI Fleeing _captive setBehaviour "Careless"; // Set Behaviour to Careless because, you know, ARMA AI. // Add Hold Action to Free Hostage [ /* 0 object */ _captive, /* 1 action title */ "Free Hostage", /* 2 idle icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 3 progress icon */ "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", /* 4 condition to show */ "true", /* 5 condition for action */ "true", /* 6 code executed on start */ {}, /* 7 code executed per tick */ {}, /* 8 code executed on completion */ { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { _this select 0 playMove "Acts_ExecutionVictim_Unbow"; } else { _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; }; _complMessage = selectRandom ["I thought I was gonna die in here!","Thank you so much man.","I think I shit my pants...","Can I hug you?","I'M ALIVE.","Where the hell am I?"]; ["Hostage", _complMessage] remoteExec ["BIS_fnc_showSubtitle"]; sleep 5.5; (_this select 0) enableAI "MOVE"; (_this select 0) enableAI "AUTOTARGET"; (_this select 0) enableAI "ANIM"; (_this select 0) setBehaviour "SAFE"; [(_this select 0)] joinSilent player; [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove"]; }, /* 9 code executed on interruption */ { _intrMessage = selectRandom ["Hey! I don't wanna die here!","Don't leave me here man! Please!","THEY'RE EATING PEOPLE. GET ME OUT OF HERE.","*Mumbles* Shit shit shit..."]; ["Hostage", _intrMessage] remoteExec ["BIS_fnc_showSubtitle"]; }, /* 10 arguments */ [_anim], /* 11 action duration */ 3, /* 12 priority */ 0, /* 13 remove on completion */ true, /* 14 show unconscious */ false ] remoteExec ["bis_fnc_holdActionAdd"]; }; //init.sqf [] call compile preprocessFileLineNumbers "hostage.sqf"; //some script _hostageGroup = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; {[_x] spawn fnc_release} forEach (units _hostageGroup); Awesome! I don't script in units much, but I'm sure this will be helpful to others who do! ...And if I ever need it in the future. :D Share this post Link to post Share on other sites
Jsempri 12 Posted October 10, 2016 This works perfectly! Share this post Link to post Share on other sites
Deathrow Bo Dean 4 Posted October 31, 2016 !Hello There; I just found Your Hostage Script and I hope it is what i need for a mission I'm making. I'm still a bit new to Arma 3 so my questions may seem noobish. I have not installed the Hostage Script yet but I will attempt to use it tonight. However, I do have a few ?'s for You --> 1. Lets say I use the Stratis map and place 1 Bluefor Nato Officer (Blue) with myself as the 'Player' about 100 yards away from 1 Optfor Russian AI Sharpshooter (Red) who will be guarding the hostage. Can I use a Bluefor AI or Civilian AI as the hostage? 2. How close does the Optfor Sharpshooter need to be to the hostage? 3. Will killing the Optfor AI guard release the hostage or do I have to do something else? 4.Where in the Arma3 folder do I place the Scripts folder You mension in your readme?--> "Or better yet, put it inside a folder called "scripts" and change the path above to "scripts\hostageScript.sqf" (Where do I put this scripts folder?) C:\user]doucments\Arma3\? 5.What and Where is the path I'm to change located? C:\user\documents\Arma3\? Share this post Link to post Share on other sites
snakeplissken 96 Posted November 1, 2016 !Hello There; I just found Your Hostage Script and I hope it is what i need for a mission I'm making. I'm still a bit new to Arma 3 so my questions may seem noobish. I have not installed the Hostage Script yet but I will attempt to use it tonight. However, I do have a few ?'s for You --> 1. Lets say I use the Stratis map and place 1 Bluefor Nato Officer (Blue) with myself as the 'Player' about 100 yards away from 1 Optfor Russian AI Sharpshooter (Red) who will be guarding the hostage. Can I use a Bluefor AI or Civilian AI as the hostage? 2. How close does the Optfor Sharpshooter need to be to the hostage? 3. Will killing the Optfor AI guard release the hostage or do I have to do something else? 4.Where in the Arma3 folder do I place the Scripts folder You mension in your readme?--> "Or better yet, put it inside a folder called "scripts" and change the path above to "scripts\hostageScript.sqf" (Where do I put this scripts folder?) C:\user]doucments\Arma3\? 5.What and Where is the path I'm to change located? C:\user\documents\Arma3\? If you place the file within the mission folder, then you use... null = [this] execVM "hostageScript.sqf" Now if you create a folder named "script" and put that file in it, then you use.. null = [this] execVM "script \ hostageScript.sqf" :D The script creator, could make the action appear when it is less than 3m hostage? Share this post Link to post Share on other sites
Deathrow Bo Dean 4 Posted November 1, 2016 !Thank's for the Quick Reply, I will give that Scrip thinggy a try. But please let me give You a !BRAVO & WELL DONE for Your the Hostage Script. It works just as You state. Aster installing it this is how I tested it: ----------------------------------------------------------------------------------------------------------------------------------------------- 1. I placed on a Altis map, 1 NATO Bluefor Officer (Playable) (me) about 1000 yds away from a house with 1 Optfor Rus Officer (AI) and 1 Bluefor Engineer Sgt. as the Hostage. After several failed attempts I managed to kill the Optfor officer and approach the hostage. I found him just where i had placed him standing up wearing a blood soaked bandage. However, he standing there with his rifle. I then resolved to replace him with a civilian. 2. For my next attempt I gave the Optfor officer 6 guards and added 5 men and a car to the Bluefor side. After winning this fight, I approached the civilian hostage and tried to get him to follow me, then I realized that this is ARMA and not Counter Strike.. 3. I went back to the editor and placed a End 1 Trigger near where the hostage was standing to end the mission. ----------------------------------------------------------------------------------------------------------------------------------------------- So here are some features I'd like to see added to Your Hostage script. 1. If a Soldier is used remove all of his weapons. (I don't know how to do this yet) 2. Having the hostage sitting down or standing with his hands on top of his head would be nice. 3. Have the hostage loot or grab a weapon from a dead soldier. That's all i can think of at this moment. ------------------------------------------------------------------------------------------------------------------------------------------------ I do have a few more ?'s. 1. Should the AI Hostage be made Playable when in a SP Game 2. Included in the download were what looked to be some sample missions. How do I play them? Are they SP 0r MP? 3. After the rescue, i'd like to have the hostage follow me or move to a location for his evacuation. How do I give the hostage a Waypoint? ------------------------------------------------------------------------------------------------------------------------------------------------ So, even without the tweaks i suggest Your Hostage script is !VERY NICE. Share this post Link to post Share on other sites
snakeplissken 96 Posted November 2, 2016 !Thank's for the Quick Reply, I will give that Scrip thinggy a try. But please let me give You a !BRAVO & WELL DONE for Your the Hostage Script. It works just as You state. Aster installing it this is how I tested it: ----------------------------------------------------------------------------------------------------------------------------------------------- 1. I placed on a Altis map, 1 NATO Bluefor Officer (Playable) (me) about 1000 yds away from a house with 1 Optfor Rus Officer (AI) and 1 Bluefor Engineer Sgt. as the Hostage. After several failed attempts I managed to kill the Optfor officer and approach the hostage. I found him just where i had placed him standing up wearing a blood soaked bandage. However, he standing there with his rifle. I then resolved to replace him with a civilian. 2. For my next attempt I gave the Optfor officer 6 guards and added 5 men and a car to the Bluefor side. After winning this fight, I approached the civilian hostage and tried to get him to follow me, then I realized that this is ARMA and not Counter Strike.. 3. I went back to the editor and placed a End 1 Trigger near where the hostage was standing to end the mission. ----------------------------------------------------------------------------------------------------------------------------------------------- So here are some features I'd like to see added to Your Hostage script. 1. If a Soldier is used remove all of his weapons. (I don't know how to do this yet) 2. Having the hostage sitting down or standing with his hands on top of his head would be nice. 3. Have the hostage loot or grab a weapon from a dead soldier. That's all i can think of at this moment. ------------------------------------------------------------------------------------------------------------------------------------------------ I do have a few more ?'s. 1. Should the AI Hostage be made Playable when in a SP Game 2. Included in the download were what looked to be some sample missions. How do I play them? Are they SP 0r MP? 3. After the rescue, i'd like to have the hostage follow me or move to a location for his evacuation. How do I give the hostage a Waypoint? ------------------------------------------------------------------------------------------------------------------------------------------------ So, even without the tweaks i suggest Your Hostage script is !VERY NICE. So, I used the script for save of hostage, he enters your group, so you have the power to command him (pick up a gun, get in or out of a vehicle, sending it to go anywhere on the map) for this use the control keys on the keyboard (F1, F2, ..) to select the character, and key (1, 2, 3, 4 ..) keyboard to give the order. Share this post Link to post Share on other sites
djotacon 190 Posted November 2, 2016 A blantant uncredited copy of my Easy Hostage Script, even with similar name. Why this code stealers are making again and again the same script copy instead created a new one? Why dont credited the idea? I think is more easy be a "code thief" and steal the work of others than create your own work or properly credited the works of others. Share this post Link to post Share on other sites
Frankdatank1218 39 Posted March 18, 2017 When I use this script in an MP scenario, only the host can rescue the hostage. Other players do it and it the untie animation plays but when it is done, the hostage resets to sitting down bound again. If I, the host, does it the hostage releases fine. Share this post Link to post Share on other sites
davidoss 552 Posted January 5, 2018 Here is my MP edit of this script. spawn or put in editor an group named hostagegrp. execution from init.sqf if (isServer) then { fnc_release = compileFinal preprocessFileLineNumbers "path\to\file\contains_this_script.sqf"; {null = [_x] spawn fnc_release} forEach (units hostagegrp); }; // Set AI Hostage Script // By Galactic Twinkles edit for MP by DaVdoSS // Define Captive private _captive = _this select 0; private _anim = selectRandom [ "Acts_AidlPsitMstpSsurWnonDnon01", "Acts_AidlPsitMstpSsurWnonDnon02", "Acts_AidlPsitMstpSsurWnonDnon03", "Acts_AidlPsitMstpSsurWnonDnon04", "Acts_AidlPsitMstpSsurWnonDnon05", "Acts_ExecutionVictim_Loop" ]; if !(captive _captive) then { _captive setCaptive true; }: removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive disableAI "MOVE"; _captive disableAI "AUTOTARGET"; _captive disableAI "ANIM"; _captive allowFleeing 0; _captive setBehaviour "Careless"; sleep 1; null = [_captive,_anim] remoteExec ["switchMove", 0, _captive]; if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; if (isNil {_captive getVariable "captured"}) then { _captive setVariable ["captured",true,true]; }; null = [ _captive, "Free Hostage", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "(_this distance _target) < 5 && alive _target", "true", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { null = [(_this select 0),"Acts_ExecutionVictim_Unbow"] remoteExec ["playMove", 2, false]; } else { null = [(_this select 0),"Acts_AidlPsitMstpSsurWnonDnon_out"] remoteExec ["switchMove", 0, false]; }; _complMessage = selectRandom [ "I thought I was gonna die in here!", "Thank you so much man.", "I think I shit my pants...", "Can I hug you?", "I'M ALIVE.", "Where the hell am I?" ]; null = ["Hostage", _complMessage] call BIS_fnc_showSubtitle; sleep 5.5; null = [(_this select 0),"MOVE"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"AUTOTARGET"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"ANIM"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"SAFE"] remoteExec ["setBehaviour", 2, false]; null = [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated,(_this select 0)]; (_this select 0) setVariable ["captured",false,true]; }, { _intrMessage = selectRandom [ "Hey! I don't wanna die here!", "Don't leave me here man! Please!", "THEY'RE KILLING PEOPLE. GET ME OUT OF HERE.", "*Mumbles* Shit shit shit..." ]; null = ["Hostage", _intrMessage] call BIS_fnc_showSubtitle; }, [_anim], 3, 0, true, false ] remoteExec ["bis_fnc_holdActionAdd", [0,-2] select isDedicated, _captive]; 1 1 Share this post Link to post Share on other sites
-XFIRE- 4 Posted January 6, 2018 i will try create mission use this Scripts Thanks Share this post Link to post Share on other sites
Ulmann 45 Posted January 13, 2018 On 06.01.2018 at 1:31 AM, davidoss said: Here is my MP edit of this script. spawn or put in editor an group named hostagegrp. execution from init.sqf if (isServer) then { fnc_release = compileFinal preprocessFileLineNumbers "path\to\file\contains_this_script.sqf"; {null = [_x] spawn fnc_release} forEach (units hostagegrp); }; // Set AI Hostage Script // By Galactic Twinkles edit for MP by DaVdoSS // Define Captive private _captive = _this select 0; private _anim = selectRandom [ "Acts_AidlPsitMstpSsurWnonDnon01", "Acts_AidlPsitMstpSsurWnonDnon02", "Acts_AidlPsitMstpSsurWnonDnon03", "Acts_AidlPsitMstpSsurWnonDnon04", "Acts_AidlPsitMstpSsurWnonDnon05", "Acts_ExecutionVictim_Loop" ]; if !(captive _captive) then { _captive setCaptive true; }: removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive disableAI "MOVE"; _captive disableAI "AUTOTARGET"; _captive disableAI "ANIM"; _captive allowFleeing 0; _captive setBehaviour "Careless"; sleep 1; null = [_captive,_anim] remoteExec ["switchMove", 0, _captive]; if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; if (isNil {_captive getVariable "captured"}) then { _captive setVariable ["captured",true,true]; }; null = [ _captive, "Free Hostage", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "(_this distance _target) < 5 && alive _target", "true", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { null = [(_this select 0),"Acts_ExecutionVictim_Unbow"] remoteExec ["playMove", 2, false]; } else { null = [(_this select 0),"Acts_AidlPsitMstpSsurWnonDnon_out"] remoteExec ["switchMove", 0, false]; }; _complMessage = selectRandom [ "I thought I was gonna die in here!", "Thank you so much man.", "I think I shit my pants...", "Can I hug you?", "I'M ALIVE.", "Where the hell am I?" ]; null = ["Hostage", _complMessage] call BIS_fnc_showSubtitle; sleep 5.5; null = [(_this select 0),"MOVE"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"AUTOTARGET"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"ANIM"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"SAFE"] remoteExec ["setBehaviour", 2, false]; null = [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated,(_this select 0)]; (_this select 0) setVariable ["captured",false,true]; }, { _intrMessage = selectRandom [ "Hey! I don't wanna die here!", "Don't leave me here man! Please!", "THEY'RE KILLING PEOPLE. GET ME OUT OF HERE.", "*Mumbles* Shit shit shit..." ]; null = ["Hostage", _intrMessage] call BIS_fnc_showSubtitle; }, [_anim], 3, 0, true, false ] remoteExec ["bis_fnc_holdActionAdd", [0,-2] select isDedicated, _captive]; Hello! I use you version of script, but when I try to check it and launch mission in editor I have only infinity loading and nothing. UPD: On LAN server same problem. I just change: fnc_release = compileFinal preprocessFileLineNumbers "Scripts\hostageScript.sqf"; And nothing else. Thanks! Share this post Link to post Share on other sites
davidoss 552 Posted January 13, 2018 i think you are missing execution for hostage units {null = [_x] spawn fnc_release} forEach (units hostagegrp); Share this post Link to post Share on other sites
Ulmann 45 Posted January 13, 2018 6 hours ago, davidoss said: i think you are missing execution for hostage units {null = [_x] spawn fnc_release} forEach (units hostagegrp); If I right understand, on map I have hostagegrp (squad leader in init have : HostageGrp = Group this;) Share this post Link to post Share on other sites
davidoss 552 Posted January 14, 2018 Sorry i just tested this and its works like charm editor objects: player, marker "hpos", idependent group where leader init field contains hostageGroup = group this; init.sqf Spoiler if (isServer) then { fnc_release = compileFinal preprocessFileLineNumbers "hostage.sqf"; _hostageGroup0 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup1 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup2 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup = [_hostageGroup0,_hostageGroup1,_hostageGroup2,hostageGroup]; {{[_x] spawn fnc_release} forEach (units _x)} forEach _hostageGroup; }; hostage.sqf Spoiler // Set AI Hostage Script // By Galactic Twinkles edit for MP by DaVdoSS // Define Captive private _captive = _this select 0; private _anim = selectRandom [ "Acts_AidlPsitMstpSsurWnonDnon01", "Acts_AidlPsitMstpSsurWnonDnon02", "Acts_AidlPsitMstpSsurWnonDnon03", "Acts_AidlPsitMstpSsurWnonDnon04", "Acts_AidlPsitMstpSsurWnonDnon05", "Acts_ExecutionVictim_Loop" ]; if !(captive _captive) then { _captive setCaptive true; }: removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive disableAI "MOVE"; _captive disableAI "AUTOTARGET"; _captive disableAI "ANIM"; _captive allowFleeing 0; _captive setBehaviour "Careless"; sleep 1; null = [_captive,_anim] remoteExec ["switchMove", 0, _captive]; if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; if (isNil {_captive getVariable "captured"}) then { _captive setVariable ["captured",true,true]; }; null = [ _captive, "Free Hostage", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "(_this distance _target) < 5 && alive _target", "true", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { null = [(_this select 0),"Acts_ExecutionVictim_Unbow"] remoteExec ["playMove", 2, false]; } else { null = [(_this select 0),"Acts_AidlPsitMstpSsurWnonDnon_out"] remoteExec ["switchMove", 0, false]; }; _complMessage = selectRandom [ "I thought I was gonna die in here!", "Thank you so much man.", "I think I shit my pants...", "Can I hug you?", "I'M ALIVE.", "Where the hell am I?" ]; null = ["Hostage", _complMessage] call BIS_fnc_showSubtitle; sleep 5.5; null = [(_this select 0),"MOVE"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"AUTOTARGET"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"ANIM"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"SAFE"] remoteExec ["setBehaviour", 2, false]; null = [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated,(_this select 0)]; (_this select 0) setVariable ["captured",false,true]; }, { _intrMessage = selectRandom [ "Hey! I don't wanna die here!", "Don't leave me here man! Please!", "THEY'RE KILLING PEOPLE. GET ME OUT OF HERE.", "*Mumbles* Shit shit shit..." ]; null = ["Hostage", _intrMessage] call BIS_fnc_showSubtitle; }, [_anim], 3, 0, true, false ] remoteExec ["bis_fnc_holdActionAdd", [0,-2] select isDedicated, _captive]; 1 Share this post Link to post Share on other sites
Ulmann 45 Posted January 19, 2018 On 14.01.2018 at 5:02 PM, davidoss said: Sorry i just tested this and its works like charm editor objects: player, marker "hpos", idependent group where leader init field contains hostageGroup = group this; init.sqf Hide contents if (isServer) then { fnc_release = compileFinal preprocessFileLineNumbers "hostage.sqf"; _hostageGroup0 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup1 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup2 = [getMarkerPos "hpos", CIVILIAN, [ "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_man_p_shorts_1_F", "C_man_p_beggar_F", "C_Man_casual_4_F", "C_man_sport_2_F", "C_journalist_F", "C_Driver_3_F" ] ,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _hostageGroup = [_hostageGroup0,_hostageGroup1,_hostageGroup2,hostageGroup]; {{[_x] spawn fnc_release} forEach (units _x)} forEach _hostageGroup; }; hostage.sqf Hide contents // Set AI Hostage Script // By Galactic Twinkles edit for MP by DaVdoSS // Define Captive private _captive = _this select 0; private _anim = selectRandom [ "Acts_AidlPsitMstpSsurWnonDnon01", "Acts_AidlPsitMstpSsurWnonDnon02", "Acts_AidlPsitMstpSsurWnonDnon03", "Acts_AidlPsitMstpSsurWnonDnon04", "Acts_AidlPsitMstpSsurWnonDnon05", "Acts_ExecutionVictim_Loop" ]; if !(captive _captive) then { _captive setCaptive true; }: removeAllWeapons _captive; removeBackpack _captive; removeVest _captive; removeAllAssignedItems _captive; _captive disableAI "MOVE"; _captive disableAI "AUTOTARGET"; _captive disableAI "ANIM"; _captive allowFleeing 0; _captive setBehaviour "Careless"; sleep 1; null = [_captive,_anim] remoteExec ["switchMove", 0, _captive]; if (_anim == "Acts_ExecutionVictim_Loop") then { _captive setDamage .5; }; if (isNil {_captive getVariable "captured"}) then { _captive setVariable ["captured",true,true]; }; null = [ _captive, "Free Hostage", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "(_this distance _target) < 5 && alive _target", "true", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { null = [(_this select 0),"Acts_ExecutionVictim_Unbow"] remoteExec ["playMove", 2, false]; } else { null = [(_this select 0),"Acts_AidlPsitMstpSsurWnonDnon_out"] remoteExec ["switchMove", 0, false]; }; _complMessage = selectRandom [ "I thought I was gonna die in here!", "Thank you so much man.", "I think I shit my pants...", "Can I hug you?", "I'M ALIVE.", "Where the hell am I?" ]; null = ["Hostage", _complMessage] call BIS_fnc_showSubtitle; sleep 5.5; null = [(_this select 0),"MOVE"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"AUTOTARGET"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"ANIM"] remoteExec ["enableAI", 2, false]; null = [(_this select 0),"SAFE"] remoteExec ["setBehaviour", 2, false]; null = [(_this select 0),(_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated,(_this select 0)]; (_this select 0) setVariable ["captured",false,true]; }, { _intrMessage = selectRandom [ "Hey! I don't wanna die here!", "Don't leave me here man! Please!", "THEY'RE KILLING PEOPLE. GET ME OUT OF HERE.", "*Mumbles* Shit shit shit..." ]; null = ["Hostage", _intrMessage] call BIS_fnc_showSubtitle; }, [_anim], 3, 0, true, false ] remoteExec ["bis_fnc_holdActionAdd", [0,-2] select isDedicated, _captive]; Did I need do something else if I already have three placed hostages on map? Share this post Link to post Share on other sites
Reaper_Is_Taken 0 Posted January 19, 2018 I'll just go ahead and steal this, thank youuu very much. But in all seriousness, this is amazing! Share this post Link to post Share on other sites
davidoss 552 Posted January 19, 2018 4 hours ago, Ulmann said: Did I need do something else if I already have three placed hostages on map? Well, not much. First of all give them a name in editor For example: hostage_1, hostage_2, hostage_3 Then in init.sqf put this: if (isServer) then { fnc_release = compileFinal preprocessFileLineNumbers "hostage.sqf"; {0 = [_x] spawn fnc_release} forEach [hostage_1, hostage_2, hostage_3]; }; 1 Share this post Link to post Share on other sites
Cpt.ScottMiller836 3 Posted August 8, 2020 Hi, just a pass through. Can the player do action while releasing the Hostage, and if possible what is the best way to do it. Share this post Link to post Share on other sites
SSgtK9 0 Posted November 12, 2020 I know this is an old thread, but my AI team members have the action, but do not perform it. They walk away and say "ready", but the hostage is not freed. Only I can free him. Thoughts? Share this post Link to post Share on other sites