Skip to content

Instantly share code, notes, and snippets.

@commy2
Last active August 3, 2019 12:11
Show Gist options
  • Save commy2/14b0b21d6af6eb65fb70dfa8a7b4c596 to your computer and use it in GitHub Desktop.
Save commy2/14b0b21d6af6eb65fb70dfa8a7b4c596 to your computer and use it in GitHub Desktop.

Place marker and name it "respawn_west", and/or any of the other side's marker names accordingly

In mission folder, create file, name it "description.ext", open it and enter:

// description.ext
respawn = 3;
respawnDelay = 1e9;

class Extended_PreInit_EventHandlers {
    mission_ZeusRespawnAll = "call compile preprocessFile 'XEH_preInit.sqf'";
};

class Extended_DisplayLoad_EventHandlers {
    class RscDisplayCurator {
        mission_ZeusRespawnAll = "call compile preprocessFile 'initDisplayZeus.sqf'";
    };
};

Create another file, name it "XEH_preinit.sqf", open it and enter:

// XEH_preinit.sqf
if (hasInterface) then {
    // event to respawn immediately when dead
    ["mission_respawn", {
        if (!alive player) then {
            setPlayerRespawnTime 0.01;
        };
    }] call CBA_fnc_addEventHandler;

    // disable respawn again every time control changes to a new character
    ["unit", {
        setPlayerRespawnTime 1e9;
    }] call CBA_fnc_addPlayerEventHandler;

};

Create another file, name it "initDisplayZeus.sqf", open it and enter:

// initDisplayZeus.sqf
params ["_display"];

private _createButton = _display displayCtrl 16105;
ctrlPosition _createButton params ["", "", "_width", "_height"];
ctrlPosition ctrlParentControlsGroup _createButton params ["_left", "_top"];

private _respawnAll = _display ctrlCreate ["RscButton", -1];

_respawnAll ctrlSetPosition [
    _left - _width,
    _top,
    _width,
    _height
];
_respawnAll ctrlCommit 0;

_respawnAll ctrlSetText toUpper "Respawn All";

_respawnAll ctrlAddEventHandler ["ButtonClick", {
    "mission_respawn" call CBA_fnc_globalEvent;
}];

Requires @CBA_A3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment