mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e59f0ce822
Type 0 worked, but the mission didn't end when all players were killed. Type 1 didn't work because isPlayer isn't true for seagulls. So spectator virtual state is now entirely unassociated from objects in the game.
45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
/*
|
|
* Author: SilentSpike
|
|
* The ace_spectator respawn template, handles killed + respawn
|
|
* Can be used via BI's respawn framework, see:
|
|
* https://community.bistudio.com/wiki/Arma_3_Respawn
|
|
*
|
|
* Arguments:
|
|
* 0: Corpse/New Unit <OBJECT>
|
|
* 1: Killer/Old Unit <OBJECT>
|
|
* 2: Respawn Type <NUMBER>
|
|
* 3: Respawn Delay <NUMBER>
|
|
*
|
|
* Return Value:
|
|
* None <NIL>
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]];
|
|
private ["_vision","_pos"];
|
|
|
|
// End mission when all are dead with respawn type "None"
|
|
if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith {
|
|
[["endDeath",false],"BIS_fnc_endMission"] call EFUNC(common,execRemoteFnc);
|
|
};
|
|
|
|
if (isNull _killer) then {_killer = _unit};
|
|
_vision = [-2,-1] select (sunOrMoon < 1);
|
|
_pos = (getPosATL _unit) vectorAdd [0,0,5];
|
|
|
|
if (alive _unit) then {
|
|
if (_respawn == 1) then {
|
|
[_unit,QGVAR(isSeagull)] call EFUNC(common,hideUnit);
|
|
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
|
|
[true] call FUNC(setSpectator);
|
|
} else {
|
|
[false] call FUNC(setSpectator);
|
|
};
|
|
} else {
|
|
[2,_killer,_vision,_pos,getDir _unit] call FUNC(setCameraAttributes);
|
|
[true] call FUNC(setSpectator);
|
|
};
|