Task-Force-Raider / Mission-Template

0 stars 2 forks source link

Add purgatory mode whilst unconscious #12

Open McFurSun opened 3 years ago

McFurSun commented 3 years ago

Nearing final completion of this.

Need to:

Once that is done it is then time to test in MP environment

McFurSun commented 3 years ago

Too buggy for v1.0 release.

Too many errors to bother writing them out.

McFurSun commented 3 years ago

Progress to date

//initPlayerLocal.sqf

//Spectate whilst Unconcious, delete if not a feature of your mission

["ace_unconscious", 
    {
        params ["_unit", "_state"];
        _unit = (_this select 0);
        _state = (_this select 1);
        _curators = call BIS_fnc_listCuratorPlayers;

        if (_unit in _curators) exitWith {};

        if (_state == true && isPlayer _unit) then {
            [0, "BLACK", 3, 1] remoteExec ["BIS_fnc_fadeEffect", 0, true];
            [1, "BLACK", 3, 1] remoteExec ["BIS_fnc_fadeEffect", 0, true];
            //[ mode,[specatator,whitelistedSides,allowAi,allowFreeCamera,allow3PPCamera,showFocusInfo,showCameraButtons,showControlsHelper,showHeader,showLists] ] call BIS_fnc_EGSpectator;
            ["Initialize", [_unit, [], false, false, true, true, false, true, true, true ]] call BIS_fnc_EGSpectator;
            [true] call acre_api_fnc_setSpectator;

        }else{
            ["Terminate"] call BIS_fnc_EGSpectator;
            [false] call acre_api_fnc_setSpectator;
        };
    }
] call CBA_fnc_addEventHandler;
McFurSun commented 3 years ago
//initPlayerLocal.sqf

//Spectate whilst Unconcious, delete if not a feature of your mission

["ace_unconscious", 
    {
        params ["_unit", "_state"];
        _unit = (_this select 0);
        _state = (_this select 1);

        if (_state == true && isPlayer _unit) then
        {
            _timeFuture = serverTime + 5;
            //waitUntil {serverTime >= _timeFuture};
            [true, true, false] call ace_spectator_fnc_setSpectator;
            [false] call ace_common_fnc_disableUserInput;
            [[west], [east,independent,civilian]] call ace_spectator_fnc_updateSides;
            [[player], [allplayers]] call ace_spectator_fnc_updateUnits;
            [[1,2], [0]] call ace_spectator_fnc_updateCameraModes; //Allowed[1=First, 2=Third],Not Allowed[0=Free]
            [[-1,-2], [0,1,2,3,4,5,6,7]] call ace_spectator_fnc_updateVisionModes //Allowed[-1=Normal, -2=Night],Not Allowed[thermal]

        }else
        {

            [false] call ace_spectator_fnc_setSpectator;

        };
    }
] call CBA_fnc_addEventHandler;
//onPlayerkilled.sqf

[false] call ace_spectator_fnc_setSpectator;
[true] call acre_api_fnc_setSpectator;

Current iteration.

The waitUntil is commented out until i can figure out why its not working. Could be local MP not counting as serverTime.

When a player goes unco, all players enter ace specator.

The non unco players can move etc, but are just stuck in the spectate screen. Unco player cant move and has the spectate screen as well as the unco overlay.

I could access all players in the list as well, should only of been me for unco spectate.

This also mucks with the respawn spectate, as in no controls are available.

So close yet so far.

BroBeansCPG commented 3 years ago
["ace_unconscious", 
    {
    private ['_SideF', '_unit', '_state'];
    params ["_unit", "_state"];

    _unit = (_this select 0);
    _state = (_this select 1);
    _sideF = side group _unit;                                                          //get side to allow spectating of
    SystemChat "Someone went unco"

    if (_state == true && isPlayer _unit) then
        {
        if (!(_unit getVariable ["ACE_isUnconscious",false])) exitWith                  //just incase lets check again
            { 
                systemChat "failsafe exit";
            }; 
        //_timeFuture = serverTime + 5;
        //waitUntil {serverTime >= _timeFuture};                                        //shouldnt need this? this should be scheduled
        sleep 3; //please work 
        [true, true, false] call ace_spectator_fnc_setSpectator;
        //[[],[west,east,independent,civilian]] call ace_spectator_fnc_updateSides;         //hides all sides - explained below
        sleep 1;
        [[_sideF],[west,east,independent,civilian]] call ace_spectator_fnc_updateSides;                                 //I don't know, just to make sure we can't see other team
        [false] call ace_common_fnc_disableUserInput;                                   //Re-enable Userinput
        //[false, 1] call ace_medical_feedback_fnc_effectUnconscious;                       //Hopefully disables unco effect
        [[_unit], [allPlayers]] call ace_spectator_fnc_updateUnits;                     //yes
        [[2], [0,1]] call ace_spectator_fnc_updateCameraModes;                          //Allowed[1=First, 2=Third],Not Allowed[0=Free]
        [[-1,-2], [0,1,2,3,4,5,6,7]] call ace_spectator_fnc_updateVisionModes           //Allowed[-1=Normal, -2=Night],Not Allowed[thermal]
        } else
            {

                [false] call ace_spectator_fnc_setSpectator;
                systemChat "normal exit"

            };
    }
] call CBA_fnc_addEventHandler;

Let's try this on the dedi

McFurSun commented 3 years ago
  //[false, 1] call ace_medical_feedback_fnc_effectUnconscious;                       //Hopefully disables unco effect

Any reason that's still commented out? @BroBeansCPG

BroBeansCPG commented 3 years ago

Didn’t have any affect locally

McFurSun commented 3 years ago

So when I tested my initial script locally I didn't get the unco effect. It only came on when testing on the dedi.

Grewsome2018 commented 3 years ago

Didn’t have any affect locally

It’s effect

complete your bridging course g

BroBeansCPG commented 3 years ago

I rewrote my sentence and forgot to change affect you fuck fight me

McFurSun commented 3 years ago

Is the unco eaffect a togglable option in adding settings?

McFurSun commented 3 years ago

Success!

//initPlayerLocal.sqf

sleep 15;

["ace_unconscious", 
    { 
        private ['_SideF', '_unit', '_state'];
        params ["_unit", "_state"];

        _unit = (_this select 0);
        _state = (_this select 1);

        systemChat "Someone went unco";

        if (_state == true && (local _unit) == true) then

        {

            [_unit,_state] execVM "purgatory.sqf";

        } else
            {

                [false] call ace_spectator_fnc_setSpectator;
                systemChat "normal exit"

            };

    }
] call CBA_fnc_addEventHandler;
//purgatory.sqf

        private ['_SideF', '_unit', '_state'];
        params ["_unit", "_state"];

        _unit = (_this select 0);
        _state = (_this select 1);
        _sideF = side group _unit;if (!(_unit getVariable ["ACE_isUnconscious",false])) exitWith                        //just incase lets check again

            { 
                systemChat "failsafe exit";
            }; 

            sleep 3; //please work 

            [true, true, false] call ace_spectator_fnc_setSpectator;
            //[[],[west,east,independent,civilian]] call ace_spectator_fnc_updateSides;         //hides all sides - explained below

            sleep 1;

            [[_sideF],[west,east,independent,civilian]] call ace_spectator_fnc_updateSides;     //I don't know, just to make sure we can't see other team
            [false] call ace_common_fnc_disableUserInput;                                       //Re-enable Userinput
            [false, 1] call ace_medical_feedback_fnc_effectUnconscious;                         //Hopefully disables unco effect
            [[_unit], [allPlayers]] call ace_spectator_fnc_updateUnits;                         //yes
            [[2], [0,1]] call ace_spectator_fnc_updateCameraModes;                              //Allowed[1=First, 2=Third],Not Allowed[0=Free]
            [[-1,-2], [0,1,2,3,4,5,6,7]] call ace_spectator_fnc_updateVisionModes               //Allowed[-1=Normal, -2=Night],Not Allowed[thermal]
McFurSun commented 3 years ago
BroBeansCPG commented 3 years ago
//initplayerlocal

sleep 15;

["ace_unconscious", 
    { 
        params ["_unit", "_state"];
        if (_state == true && (local _unit) == true) then

        {

            [_unit,_state] spawn fn_purgatory;

        } else
            {

                [false] call ace_spectator_fnc_setSpectator;
        { _x enableChannel true; } forEach [0,1,2,3,4,5];
            };

    }
] call CBA_fnc_addEventHandler;
//fn_purgatory.sqf
params ["_unit", "_state"];
_sideF = side group _unit;

if (!(_unit getVariable ["ACE_isUnconscious",false])) exitWith {};                //probably obsolete but can't hurt
sleep 5;
[false, 1] call ace_medical_feedback_fnc_effectUnconscious;                            //Hopefully disables unco effect
[true, true, false] call ace_spectator_fnc_setSpectator;
sleep 1;
[[_sideF],[west,east,independent,civilian]] call ace_spectator_fnc_updateSides;     //I don't know, just to make sure we can't see other team
[false] call ace_common_fnc_disableUserInput;                                        //Re-enable Userinput
{ _x enableChannel false; } foreach [0,1,2,3,4,5];                                  //disable other channels
[[_unit], [allPlayers]] call ace_spectator_fnc_updateUnits;                         //yes
[[2], [0,1]] call ace_spectator_fnc_updateCameraModes;                                 //Allowed[1=First, 2=Third],Not Allowed[0=Free]
[[-1,-2], [0,1,2,3,4,5,6,7]] call ace_spectator_fnc_updateVisionModes                 //Allowed[-1=Normal, -2=Night],Not Allowed[thermal]           

Add to initServer.sqf

fn_spectator = compile PreProcessFileLineNumbers "spectator.sqf";
McFurSun commented 3 years ago
fn_spectator = compile PreProcessFileLineNumbers "spectator.sqf";

changed the above to fn_purgatory.sqf

fn_spectator = compile PreProcessFileLineNumbers "fn_purgatory.sqf";

do we need to put fn_purgatory.sqf into a functions folder or is it fine in the main directory?

BroBeansCPG commented 3 years ago

Its fine in root directory but it’s neater in a folder

Rename the function to purgatory too

fn_purgatory = compile PreProcessFileLineNumbers "fn_purgatory.sqf";

McFurSun commented 3 years ago

[TFR]Mission_Template.VR.zip