Jump to content

Storing Tracked Vehicles in Garage - Altis Life 4.4r4


Recommended Posts

Well dude, you done what I thought impossible.  Cheers to you!

Now for the next endeavor, that is if you wanna go on?  Hope so

How do you get the tank to work at the house garages too?

Even if I don't learn that, I can live with it this way, but would be more fun with the houses too.  

 

Thanks again for it, you rock!

Link to comment
Share on other sites

fn_houseMenu.sqf

Spoiler
#include "..\..\script_macros.hpp"
/*
    File: fn_houseMenu.sqf
    Author: Bryan "Tonic" Boardwine

    Description:
    Building interaction menu
*/
#define Btn1 37450
#define Btn2 37451
#define Btn3 37452
#define Btn4 37453
#define Btn5 37454
#define Btn6 37455
#define Btn7 37456
#define Btn8 37457
#define Title 37401

private ["_display","_curTarget","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];
disableSerialization;
_curTarget = param [0,objNull,[objNull]];
if (isNull _curTarget) exitWith {}; //Bad target
_houseCfg = [(typeOf _curTarget)] call life_fnc_houseConfig;
if (count _houseCfg isEqualTo 0 && playerSide isEqualTo civilian) exitWith {};

if (!dialog) then {
    createDialog "pInteraction_Menu";
};

_Btn1 = CONTROL(37400,Btn1);
_Btn2 = CONTROL(37400,Btn2);
_Btn3 = CONTROL(37400,Btn3);
_Btn4 = CONTROL(37400,Btn4);
_Btn5 = CONTROL(37400,Btn5);
_Btn6 = CONTROL(37400,Btn6);
_Btn7 = CONTROL(37400,Btn7);
_Btn8 = CONTROL(37400,Btn8);
{_x ctrlShow false;} forEach [_Btn1,_Btn2,_Btn3,_Btn4,_Btn5,_Btn6,_Btn7,_Btn8];

life_pInact_curTarget = _curTarget;

if (_curTarget in life_hideoutBuildings) exitWith {
    closeDialog 0;
    hint localize "STR_House_Hideout";
};

if (_curTarget isKindOf "House_F" && playerSide isEqualTo west) exitWith {

    private _vaultHouse = [[["Altis", "Land_Research_house_V1_F"], ["Tanoa", "Land_Medevac_house_V1_F"]]] call TON_fnc_terrainSort;
    private _altisArray = [16019.5,16952.9,0];
    private _tanoaArray = [11074.2,11501.5,0.00137329];
    private _pos = [[["Altis", _altisArray], ["Tanoa", _tanoaArray]]] call TON_fnc_terrainSort;

    if ((nearestObject [_pos,"Land_Dome_Big_F"]) isEqualTo _curTarget || (nearestObject [_pos,_vaultHouse]) isEqualTo _curTarget) then {

        _Btn1 ctrlSetText localize "STR_pInAct_Repair";
        _Btn1 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_repairDoor;";
        _Btn1 ctrlShow true;

        _Btn2 ctrlSetText localize "STR_pInAct_CloseOpen";
        _Btn2 buttonSetAction "closeDialog 0; [life_pInact_curTarget] call life_fnc_doorAnimate;";
        _Btn2 ctrlShow true;

    } else {
        if (!isNil {_curTarget getVariable "house_owner"}) then {
            _Btn1 ctrlSetText localize "STR_House_Raid_Owner";
            _Btn1 buttonSetAction "[life_pInact_curTarget] call life_fnc_copHouseOwner;";
            _Btn1 ctrlShow true;

            _Btn2 ctrlSetText localize "STR_pInAct_BreakDown";
            _Btn2 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_copBreakDoor;";
            _Btn2 ctrlShow true;

            _Btn3 ctrlSetText localize "STR_pInAct_SearchHouse";
            _Btn3 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_raidHouse;";
            _Btn3 ctrlShow true;

            if (player distance _curTarget > 3.6) then {
                _Btn3 ctrlEnable false;
            };

            _Btn4 ctrlSetText localize "STR_pInAct_LockHouse";
            _Btn4 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_lockupHouse;";
            _Btn4 ctrlShow true;
        } else {
            closeDialog 0;
        };
    };
};

if (!(_curTarget in life_vehicles) || isNil {_curTarget getVariable "house_owner"}) then {
    private _isHouse = (isClass (missionConfigFile >> "Housing" >> worldName >> typeOf _curTarget));
    private _buildingPurchaseString = [
        "STR_pInAct_BuyGarage",
        "STR_pInAct_BuyHouse"
    ] select _isHouse;

    _Btn1 ctrlSetText localize _buildingPurchaseString;
    _Btn1 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_buyHouse;";
    _Btn1 ctrlShow true;

    if (!isNil {_curTarget getVariable "house_owner"}) then {
        _Btn1 ctrlEnable false;
    };

    if (_isHouse) then {
        if (getNumber (missionConfigFile >> "Housing" >> worldName >> (typeOf _curTarget) >> "canGarage") isEqualTo 1) then {
            _Btn2 ctrlSetText localize "STR_pInAct_GarageExt";
            _Btn2 buttonSetAction 'hint format [localize "STR_pInAct_GarageExtNOTF",[LIFE_SETTINGS(getNumber,"houseGarage_buyPrice")] call life_fnc_numberText];';
            _Btn2 ctrlShow true;
        };
    };

} else {
    if (isClass (missionConfigFile >> "Garages" >> worldName >> (typeOf _curTarget))) then {
        _Btn1 ctrlSetText localize "STR_pInAct_SellGarage";
        _Btn1 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_sellHouse;";
        _Btn1 ctrlShow true;

        if !(((_curTarget getVariable "house_owner") select 0) isEqualTo getPlayerUID player) then {
            _Btn1 ctrlEnable false;
        };

        _Btn2 ctrlSetText localize "STR_pInAct_AccessGarage";
        _Btn2 buttonSetAction "closeDialog 0; [life_pInact_curTarget,""Car""] spawn life_fnc_vehicleGarage;";
        _Btn2 ctrlShow true;

        _Btn3 ctrlSetText localize "STR_pInAct_StoreVeh";
        _Btn3 buttonSetAction "closeDialog 0; [life_pInact_curTarget,player] spawn life_fnc_storeVehicle;";
        _Btn3 ctrlShow true;

        //--- Tank Garge.
        _Btn4 ctrlSetText "Tank Garage";
        _Btn4 buttonSetAction "closeDialog 0; [life_pInact_curTarget,""Tank""] spawn life_fnc_vehicleGarage;";
        _Btn4 ctrlShow true;
    } else {
        _Btn1 ctrlSetText localize "STR_pInAct_SellHouse";
        _Btn1 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_sellHouse;";
        _Btn1 ctrlShow true;

        if (((_curTarget getVariable "house_owner") select 0) != (getPlayerUID player)) then {
            _Btn1 ctrlEnable false;
        };

        if (_curTarget getVariable ["locked",false]) then {
            _Btn2 ctrlSetText localize "STR_pInAct_UnlockStorage";
        } else {
            _Btn2 ctrlSetText localize "STR_pInAct_LockStorage";
        };
        _Btn2 buttonSetAction "closeDialog 0; [life_pInact_curTarget] call life_fnc_lockHouse;";
        _Btn2 ctrlShow true;

        if (isNull (_curTarget getVariable ["lightSource",objNull])) then {
            _Btn3 ctrlSetText localize "STR_pInAct_LightsOn";
        } else {
            _Btn3 ctrlSetText localize "STR_pInAct_LightsOff";
        };
        _Btn3 buttonSetAction "closeDialog 0; [life_pInact_curTarget] call life_fnc_lightHouseAction;";
        _Btn3 ctrlShow true;

        if (getNumber (missionConfigFile >> "Housing" >> worldName >> (typeOf _curTarget) >> "canGarage") isEqualTo 1 && {!(_curTarget getVariable ["blacklistedGarage",false])}) then {
            if (_curTarget getVariable ["garageBought",false]) then {
                _Btn4 ctrlSetText localize "STR_pInAct_SellGarage";
                _Btn4 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_sellHouseGarage;";
                _Btn4 ctrlShow true;

                if (((_curTarget getVariable "house_owner") select 0) != (getPlayerUID player)) then {
                    _Btn4 ctrlEnable false;
                };

                _Btn5 ctrlSetText localize "STR_pInAct_AccessGarage";
                _Btn5 buttonSetAction "closeDialog 0; [life_pInact_curTarget,""Car""] spawn life_fnc_vehicleGarage;";
                _Btn5 ctrlShow true;

                _Btn6 ctrlSetText localize "STR_pInAct_StoreVeh";
                _Btn6 buttonSetAction "closeDialog 0; [life_pInact_curTarget,player] spawn life_fnc_storeVehicle;";
                _Btn6 ctrlShow true;

                //--- Tank Garge.
                _Btn7 ctrlSetText "Tank Garage";
                _Btn7 buttonSetAction "closeDialog 0; [life_pInact_curTarget,""Tank""] spawn life_fnc_vehicleGarage;";
                _Btn7 ctrlShow true;
            } else {
                _Btn5 ctrlSetText localize "STR_pInAct_BuyGarage";
                _Btn5 buttonSetAction "closeDialog 0; [life_pInact_curTarget] spawn life_fnc_buyHouseGarage;";
            };

            _Btn5 ctrlShow true;

        };

    };
};

 

 

Added another button to the dialog. This should be all you need.

 

Don't be afraid to try something out, scripting is basically doing something, and debugging after.

My thought process was to find where the garagemenu was called (from pressing windowsKey). I checked my fn_actionKeyHandler.sqf (handles basically every press of the windowskey and checks stuff).

Inside it I found where it checks for a house (garage counts too).

Inside houseMenu I looked for anything that handles the buttons for garage actions. I copied the existing button for normal garages, and changed CAR to TANK

Link to comment
Share on other sites

Lol, I did a search for tank, but I guess I must have missed it.  I even looked it over to see if anything else was there.  But like coding can be, you can miss anything.  So there this is the only way I have found to get tanks working on life.  Good stuff man, I hope this helps others out like me.  Thanks so much and many thanks...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.