Jump to content

Prathios

Member
  • Content Count

    2
  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About Prathios

  • Rank
    Newbie
  1. Prathios

    [Dr_Cox1911] Hostage Script

    Thanks Dr_Cox1911. I found your script to be very helpful for a mission. I love the random spawns, animation, and the fact that the OPFOR will shoot the hostages after they join your group. I am new to the Arma editing scene. I'm still learning new tricks but when I find a problem, I feel compelled to solve it and give back. I've registered here to assist. I managed to find a couple issues when testing multiplayer/coop. After an long search, covering public variables, CBA, MPF, and Remote Execution to solve the problem, I had an Epiphany. 1. captivevars.sqf which is executed via the addaction changes the hostage's setcaptive status to false. This works perfectly when playing single player or in multiplayer if the host did the Untie action. Unfortunately addaction scripts like captivevars.sqf are executed locally by the person using the addaction. So if another client other than the host executes it, the server cannot update the captive status which does not allow captive.sqf to continue after the waitUntil{not(captive _cap)};. This essentially breaks the script for anyone that would rescue the hostages other than the host. 2. The player based animation was somewhat buggy in Multiplayer. If the host and another player are standing too close to the hostage the wrong player can be forced into the animation. In order to get around these issues, I make the following suggestions. Change captivevars.sqf to: _unit = _this select 0; // Hostage who had the addAction _rescuer = _this select 1; // Rescuer who used the addAction //Animate the person using the untie action. _rescuer attachto [_unit,[0,-0.9,0]]; _rescuer setdir 0; _rescuer switchMove "MountSide"; //Animation while untieing sleep 5; _rescuer switchmove ""; detach _rescuer; // Join Hostage to rescuer's group, silently. [_unit] joinsilent _rescuer; joinSilent works from addaction client executed scripts. So we can use a different waitUntil condition to detect when the captive joins the players group. Then we can finish executing captive.sqf on the server and completing our objectives/tasks. I also removed the player animation from captive.sqf and added it to captivevars.sqf. This appears to work just fine executed from the addaction. Change the last section of captive.sqf to: //waitUntil{not(captive _cap)}; waitUntil{_cap in units group player}; _cap removeaction _captureact1; _cap setcaptive false; // added from captivevars.sqf _cap disableAI "MOVE"; _cap switchmove "SitStandUp"; sleep 2; _cap enableAI "MOVE"; _cap enableAI "autoTarget"; _cap enableAI "ANIM"; _cap setBehaviour "COMBAT"; Finally we have the new waitUntil which fires when _cap joins the player group. Then we can reset _cap to not captive, remove the addaction, and allow them to move after joining the group. So far this method has worked perfectly from a lan listen server. I bet it works just fine on dedicated servers. I also want to share some trigger ideas for fellow hostage mission makers. Example All Hostages Rescued trigger: //Name your hostages and detect when all three are in the player's group. Then complete task_1. //Condition (civ1 in units group player) && (civ2 in units group player) && (civ3 in units group player); //On Act. task_1 setTaskState "Succeeded"; ["TaskSucceeded",["Hostages Rescued!"]] call bis_fnc_showNotification; Example Mission Failure Hostage killed trigger: //Condition !alive civ1 or !alive civ2 //On Act. task_1 setTaskState "Failed"; task_3 setTaskState "Failed"; "obj1" setMarkerColor "ColorRed"; "obj3" setMarkerColor "ColorRed"; ["TaskFailed",["A Hostage was killed! Mission Failed."]] call bis_fnc_showNotification; Thank Kylania for one of the best ideas for Mission Complete with hostages trigger: //name and array the hostages POWS = [civ1,civ2] on the player init. //When all POWS are in the helicopter named rescue1 and alive, remove the hostages from the players group and end the mission. //Condition (({alive _x && (_x in rescue1)} count POWS == {alive _x} count POWS) && (alive civ1 && alive civ2 && alive civ3)) //On Act. hint "POWs rescued!";{[_x] joinSilent grpNull} forEach POWS One thing is for sure anyone searching for an Arma 3 hostage script has found the right place with Dr_Cox1911. Happy Editing!
  2. MacScottie, Thank you for the outstanding tutorials. Your time and dedication are much appreciated.
×