Skip to content

Commit

Permalink
Added - respawn single unit to ares scripts. Better structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuel committed Jan 8, 2016
1 parent 02e4910 commit 54d94a9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
23 changes: 16 additions & 7 deletions FP_Template.VR/base/scripts/ares/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@
Description:
Adds FP specific ares functions
*/
#define UTIL "FP Utils"
#define RESPAWN "FP Respawn"

private _path = "base\scripts\ares\";
FP_ares_iedProximity = compile preprocessFileLineNumbers (_path + "ied_proximity.sqf");
FP_ares_cargoEject = compile preprocessFileLineNumbers (_path + "cargo_eject.sqf");
FP_ares_respawnAtPos = compile preprocessFileLineNumbers (_path + "respawn_at_position.sqf");
FP_ares_respawnInCargo = compile preprocessFileLineNumbers (_path + "respawn_in_cargo.sqf");
FP_ares_iedProximity = compile preprocessFileLineNumbers (_path + "ied_proximity.sqf");
FP_ares_respawnSingle = compile preprocessFileLineNumbers (_path + "respawn_single.sqf");


// Spawns an IED
[UTIL, "[IED] Proximity", {_this call FP_ares_iedProximity}] call Ares_fnc_RegisterCustomModule;

private _DISPLAY_NAME = "FP Utils";
// Ejects whatever cargo is inside the vehicle
[_DISPLAY_NAME, "Force eject vehicle cargo", {_this call FP_ares_cargoEject}] call Ares_fnc_RegisterCustomModule;
[UTIL, "Force eject vehicle cargo", {_this call FP_ares_cargoEject}] call Ares_fnc_RegisterCustomModule;

// Respawns and moves all dead players to a position
[_DISPLAY_NAME, "[Respawn] At position", {_this call FP_ares_respawnAtPos}] call Ares_fnc_RegisterCustomModule;
[RESPAWN, "[Respawn] At position", {_this call FP_ares_respawnAtPos}] call Ares_fnc_RegisterCustomModule;

// Respawns and moves all players (that can fit) inside the cargo of a specific vehicle
[_DISPLAY_NAME, "[Respawn] Fill vehicle cargo", {_this call FP_ares_respawnInCargo}] call Ares_fnc_RegisterCustomModule;
// Spawns an IED
[_DISPLAY_NAME, "[IED] Proximity", {_this call FP_ares_iedProximity}] call Ares_fnc_RegisterCustomModule;
[RESPAWN, "[Respawn] Fill vehicle cargo", {_this call FP_ares_respawnInCargo}] call Ares_fnc_RegisterCustomModule;

// Respawns and moves all players (that can fit) inside the cargo of a specific vehicle
[RESPAWN, "[Respawn] Single unit at pos", {_this call FP_ares_respawnSingle}] call Ares_fnc_RegisterCustomModule;
21 changes: 21 additions & 0 deletions FP_Template.VR/base/scripts/ares/respawn_single.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Description:
Respawns a single unit
*/

params ["_pos"];
private _players = [] call FP_JRM_fnc_getSpectators;
if (count _players == 0) exitWith {["ERROR: No dead players"] call ares_fnc_ShowZeusMessage};
private _names = [_players, {name _x}] call ACE_common_fnc_map;

private _args = ["Respawn single unit", [
["Player", _names, 0]
]] call Ares_fnc_ShowChooseDialog;

private _plr = _players select (_args select 0);
private _uid = getPlayerUID _plr;
FP_JRM_savedState = [FP_JRM_savedState, {(_x select 0) != _uid}] call ACE_common_fnc_filter;
publicVariable "FP_JRM_fnc_savedState";

[_pos] remoteExecCall ["FP_JRM_fnc_forceRespawn", _plr];
["Respawned %1 at %2", name _plr, mapGridPosition _pos] call ares_fnc_ShowZeusMessage;

0 comments on commit 54d94a9

Please sign in to comment.