Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- filename: @fn_spawnHostage.sqf
- Author: J. Schmidt
- Coded for SOG Missions and Campaigns
- */
- params ["_hostage", "_shooter", "_time"];
- private _nearPlayers = [];
- private _ld0 = getUnitLoadout _shooter;
- private _hgun = _ld0 select 2 select 0;
- private _hgunMags = _ld0 select 2 select 4;
- if (alive _hostage && alive _shooter) then {
- _shooter enableAIFeature ["MOVE", false];
- _hostage enableAIFeature ["MOVE", false];
- _hostage setCaptive true;
- _shooter switchMove "acts_executioner_standingloop";
- _hostage switchMove "acts_executionvictim_loop";
- while {(_time > 0) && alive _hostage && alive _shooter} do {
- _time = _time - 1;
- sleep 1;
- if (!alive _shooter) exitWith {
- waitUntil {
- sleep 1;
- _nearPlayers = allPlayers inAreaArray [ASLtoAGL getPosASL _hostage, 2, 2, 0, false, 2];
- count _nearPlayers > 0;
- };
- _hostage setVariable ["hostageVars", [_nearPlayers select 0, _hgun, _hgunMags, _shooter]];
- _hostage addEventHandler ["AnimDone", {
- params ["_unit", "_anim"];
- if (_anim == "acts_executionvictim_unbow") exitWith {
- (_unit getVariable "hostageVars") params ["_nearPlayer", "_hgun", "_hgunMags", "_shooter"];
- [_unit] joinSilent (group _nearPlayer);
- { _shooter removeWeapon _x } forEach weapons _shooter;
- { _shooter removeMagazine _x } forEach magazines _shooter;
- _unit addWeaponGlobal _hgun;
- _unit addMagazines _hgunMags;
- _unit enableAIFeature ["MOVE", true];
- // _unit setCaptive false;
- _unit removeEventHandler ["AnimDone", 0];
- };
- }];
- _hostage playMove "acts_executionvictim_unbow";
- };
- if (!alive _hostage) exitWith {
- _hostage playMove "acts_executionvictim_kill_end";
- };
- if (_time <= 0 && alive _hostage && alive _shooter) then {
- _shooter playMove "acts_executioner_kill_end";
- sleep 2;
- playSound "sn_flare_weapon_fired";
- _shooter playMove "acts_executioner_standingloop";
- _hostage setDamage 0.9;
- _hostage playMove "acts_executionvictim_kill_end";
- sleep 2.75;
- _hostage setDamage 1;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement