pack generator EPOCH (WIP)

trying to get a pack generator script working, kind of like pack vault.

can't get the fn-self actions right,

this is what I have.

I want the generator to be pack able by any player, but only if it is NOT running. I had the option pop up once, but adjusted some code to what I thought was better without saving a copy and lost it. This is what I believe to be optimized however no options, and it breaks the other self actions.

SO basically, where is my missing colon?

Code:
//Start Generator
    if(_cursorTarget isKindOf "Generator_DZ") then {       
        if (s_player_fillgen < 0) then {
           
            // check if not running
            if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
                s_player_fillgen = player addAction ["Stop Generator", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];               
            } else {
            // check if not filled and player has jerry.
                if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
                    s_player_fillgen = player addAction ["Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
                } else {
                    if("ItemJerrycan" in _magazinesPlayer) then {
                        s_player_fillgen = player addAction ["Fill and Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
                    };
                };
            };
        };
        if (s_player_packgenerator < 0) then {
            // check if running
            if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
                exitWith {};               
            } else {
                if (s_player_packgenerator < 0) then {
               
                    s_player_packgenerator = player addAction [format["<t color='#ff0000'>Pack %1</t>",_text],"Scripts\player_packgenerator.sqf", "_cursorTarget", 0, false ,true, "",""];
 
                };
            };
        };
    } else {
        player removeAction s_player_fillgen;
        s_player_fillgen = -1;
        player removeAction s_player_packgenerator;
        s_player_packgenerator = -1;
    };
 
rpt files are always a good indicator of where you went wrong ...

i think i would try something along the lines of this tho:
Code:
 //Start Generator
    if(_cursorTarget isKindOf "Generator_DZ") then {
        if (s_player_fillgen < 0 || s_player_packgenerator < 0) then {
           
            // check if not running
            if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
                s_player_fillgen = player addAction ["Stop Generator", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];               
            } else {
                s_player_packgenerator = player addAction [format["<t color='#ff0000'>Pack %1</t>",_text],"Scripts\player_packgenerator.sqf", "_cursorTarget", 0, false ,true, "",""];
            // check if not filled and player has jerry.
                if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
                    s_player_fillgen = player addAction ["Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
                } else {
                    if("ItemJerrycan" in _magazinesPlayer) then {
                        s_player_fillgen = player addAction ["Fill and Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
                    };
                };
            };
        };
    } else {
        player removeAction s_player_fillgen;
        s_player_fillgen = -1;
        player removeAction s_player_packgenerator;
        s_player_packgenerator = -1;
    };
 
I believe this would only give the option if the generator was already filled. I don't want players to have to fill the generator first.

If I also add the line below

Code:
s_player_fillgen = player addAction ["Fill and Start Generator", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];

then it would show the option only with filled or if you had a full jerry in your inventory.

I want to be able to pack any non running generator, regardless of the other "fuel" criteria.
 
sorry i misunderstood something while reading the code ... i changed it now, that should work

but i belive theres supposed to be a line removing the action further down aswell

this should do what you wantet tho ...
 
sorry i misunderstood something while reading the code ... i changed it now, that should work

but i belive theres supposed to be a line removing the action further down aswell


this should do what you wantet tho ...


Ahh! missing the OR, thanks, going to try it now.

yes I have the remove action on the bottom, thanks again!
 
Back
Top