Jump to content

[Release] DZE Piggd Banking System


piggd

Recommended Posts

WARNING ** THIS REPLACES THE HUMANITY SYSTEM
 

Mod Features:
Allows the player to have access to their money all the time.
Bank is tied to the player via the humanity system and survives character death.
Auto Deposit bars/brief cases on every sale or purchase
Player can access balance, deposit and withdraw via player tool menu.
If a player goes to a negative balance displaying the balance, withdraw or deposit will restore them to zero balance.

Known Issues:
First time character creation start the player with 2500 humanity which equates to 25gb.
Any event that modifies humanity will effect the bank balance (usally in a minor way silve bars in most cases)

 

 


Thank you too iSaeko for making this video for me.
 

 

1.   Download the addon from my github by clicking on this link.   (Contains a vanilla epoch chernarus mission.pbo example file).

2.  On the lower left corner click on the button "Download Zip"
3   Create a directory called dayz_code and mission_pbo
4.  Take your mission.pbo file and extract it into the mission_pbo directory
5.  Unzip the zip file you download from my github and move the custom directory into your mission_pbo directory.
6.  Copy C:\Program Files (x86)\Steam\SteamApps\common\ARMA 2 Operation Arrowhead\@DayZ_Epoch\addons\dayz_code.pbo into this new direttory (path may vary based on steam installation).
7.  Extract the dayz_code.pbo into the dayz_code directory you created.
8.  if you do not already have a fixes directory create one.
9.  If you do not already have a custom compile then follow these steps other wise you can skip this step.
    copy dayz_code/init/compiles.sqf  mission_pbo/fixes/compules.sqf
10.  Copy dayz_code/compile/epoch_returnChange.sqf mission_pbo/fixes/epoch_returnChange.sqf
11.  Edit your init.sqf file and make the following modifications:

 

from:

//Load in compiled functions

to:

// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
PDZE_PiggdBankSystem = true;
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------

//Load in compiled functions

from:

call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";                //Compile regular functions

to:

// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
//call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";                //Compile regular functions
call compile preprocessFileLineNumbers "fixes\compiles.sqf";                //Compile regular functions
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------

From:

    //Lights
    //[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
   
};

** NOTE - If you are using

this entry will already exist with a different comment.

to:

    //Lights
    //[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
// Activate Player Menu for Tools
    [] execVM "custom\playertools\activate_player_menu.sqf";
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
    
};

12.  Edit your fixes\compiles.sqf file and make the following modifications:

 

From:

epoch_totalCurrency = {
        // total currency
        _total_currency = 0;
        {
            _part =  (configFile >> "CfgMagazines" >> _x);
            _worth =  (_part >> "worth");
            if isNumber (_worth) then {
                _total_currency = _total_currency + getNumber(_worth);
            };
        } count (magazines player);
        _total_currency
    };

    epoch_itemCost = {
        _trade_total = 0;
        {
            _part_in_configClass =  configFile >> "CfgMagazines" >> (_x select 0);
            if (isClass (_part_in_configClass)) then {
                _part_inWorth = (_part_in_configClass >> "worth");
                if isNumber (_part_inWorth) then {
                    _trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
                };
            };
        } count _this;

        //diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
        _trade_total
    };

    epoch_returnChange =            compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
    // usage [["partinclassname",4]] call epoch_returnChange;

to:

epoch_totalCurrency = {
        // total currency
        _total_currency = 0;
        {
            _part =  (configFile >> "CfgMagazines" >> _x);
            _worth =  (_part >> "worth");
            if isNumber (_worth) then {
                _total_currency = _total_currency + getNumber(_worth);
            };
        } count (magazines player);
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
        if(PDZE_PiggdBankSystem) then {
            _humanity = player getVariable["humanity",0];
            _total_currency = _total_currency + _humanity;
        };
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------
        _total_currency
    };

    epoch_itemCost = {
        _trade_total = 0;
        {
            _part_in_configClass =  configFile >> "CfgMagazines" >> (_x select 0);
            if (isClass (_part_in_configClass)) then {
                _part_inWorth = (_part_in_configClass >> "worth");
                if isNumber (_part_inWorth) then {
                    _trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
                };
            };
        } count _this;

        //diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
        _trade_total
    };

// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
//    epoch_returnChange =            compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
    epoch_returnChange =            compile preprocessFileLineNumbers "fixes\epoch_returnChange.sqf";
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------
    // usage [["partinclassname",4]] call epoch_returnChange;

13. Edit fixes/epoch_returnChange.sqf

 

From:

    //diag_log format["DEBUG TRADER CHANGE: %1", _return_change];


    if (_return_change >= 0) then {

        
        // total currency

to:

// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
    if (_return_change >= 0 and !PDZE_PiggdBankSystem) then {
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------

From:

    if (_silver_1oz > 0) then {
            if (_silver_1oz == 1) then {
                player addMagazine "ItemSilverBar";
                //diag_log format["DEBUG TRADER CHANG MADE: %1 x %2", _silver_1oz, "ItemSilverBar"];
            } else {
                player addMagazine format["ItemSilverBar%1oz",_silver_1oz];
                //diag_log format["DEBUG TRADER CHANG MADE: %1 x %2", _silver_1oz, "ItemSilverBar"];
            };
        };
        _successful = true;
	};
};
_successful

to:

 
    if (_silver_1oz > 0) then {
            if (_silver_1oz == 1) then {
                player addMagazine "ItemSilverBar";
                //diag_log format["DEBUG TRADER CHANG MADE: %1 x %2", _silver_1oz, "ItemSilverBar"];
            } else {
                player addMagazine format["ItemSilverBar%1oz",_silver_1oz];
                //diag_log format["DEBUG TRADER CHANG MADE: %1 x %2", _silver_1oz, "ItemSilverBar"];
            };
        };
        _successful = true;
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
    } else {
        if (PDZE_PiggdBankSystem) then {
            _total_currency_dry = player getVariable["humanity",0];
            _total_currency_dry = _total_currency_dry + _return_change;
            player setVariable["humanity",_total_currency_dry,true];
            _successful = true;
        };
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------
    };
};
_successful

14. Edit server_traders.sqf

 

From:

menu_RU_Functionary1 = [
    [["Ammunition",478],["Clothes",476],["Helicopter Armed",493],["Military Armed",562],["Trucks Armed",479],["Weapons",477]],
    [],
    "hero"
];

to:

menu_RU_Functionary1 = [
    [["Ammunition",478],["Clothes",476],["Helicopter Armed",493],["Military Armed",562],["Trucks Armed",479],["Weapons",477]],
    [],
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
//    "hero"
    "neutral"
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------
];

from:

menu_GUE_Soldier_MG = [
    [["Ammunition",577],["Clothing",575],["Helicopter Armed",512],["Military Armed",569],["Trucks Armed",534],["Weapons",627]],
    [],
    "hostile"
];

to:

menu_GUE_Soldier_MG = [
    [["Ammunition",577],["Clothing",575],["Helicopter Armed",512],["Military Armed",569],["Trucks Armed",534],["Weapons",627]],
    [],
// ------------------------------------------------------------------------DZE Piggd Banking System Start ------------------------------------------------------------------------
//    "hostile"
    "neutral"
// ------------------------------------------------------------------------DZE Piggd Banking System End ------------------------------------------------------------------------
];

15.  Repack your mission pbo and upload to your sever.

 

Optional Additional Configuration:

 

**  Chameleon Skin Changer

If you are using

and have replaced custom/playertools/player_tools_main.sqf you will need to uncomment the following lines.

 

from:

playermenustart = [
    ["",true],
//    ["Chameleon Male Skins Menu",[],"", -5,[["expression",format[_EXECscript1,_pathtochameleon + "male_dialog.sqf"]]],"1","1"],
//    ["Chameleon Female Skins Menu",[],"", -5,[["expression",format[_EXECscript1,_pathtochameleon + "female_dialog.sqf"]]],"1","1"],
    ["DZE Piggd Banking System >>", [], "#USER:bankmenu", -5, [["expression", ""]], "1", "1"],            
//    ["Weather/Time Menu (Local Only) >>", [], "#USER:WTMenu", -5, [["expression", ""]], "1", "1"],            
    ["", [], "", -5, [["expression", ""]], "1", "0"],
    ["Main Menu", [20], "#USER:playermenustart", -5, [["expression", ""]], "1", "1"]        
];

to:

playermenustart = [
    ["",true],
    ["Chameleon Male Skins Menu",[],"", -5,[["expression",format[_EXECscript1,_pathtochameleon + "male_dialog.sqf"]]],"1","1"],
    ["Chameleon Female Skins Menu",[],"", -5,[["expression",format[_EXECscript1,_pathtochameleon + "female_dialog.sqf"]]],"1","1"],
    ["DZE Piggd Banking System >>", [], "#USER:bankmenu", -5, [["expression", ""]], "1", "1"],            
//    ["Weather/Time Menu (Local Only) >>", [], "#USER:WTMenu", -5, [["expression", ""]], "1", "1"],            
    ["", [], "", -5, [["expression", ""]], "1", "0"],
    ["Main Menu", [20], "#USER:playermenustart", -5, [["expression", ""]], "1", "1"]        
];

15.  Repack your mission pbo and upload to your sever.

 

 

Email: [email protected]
Website: Piggd Dayz Gaming
Donate to piggd

Link to comment
Share on other sites

Wouldnt it be possible to change the humanity variable to the Headshot, Hero or bandit kill variable?

 

Players would lose the money they have on them -> not op safe

add the currency to their loot, when they die -> other players are happy

add right clickoption for the menu -> for some that dont know how, but want to have it (I know how, but I guess there are some not that experienced users out there^^)

 

Anyways, nice work

Link to comment
Share on other sites

The menu portion of this is new balance, depoit and withdarwl options.  I been using this code for well over a yer but before we just displayed the bank balance in the dbug menu and used a cutom vendor menu to buy a bar back one bar at a time .  (Painful)  I run all PVE servers with lots of toys so I write all my code from that perspective. As for the humanity bug really has not been an issue but I do have this in my wearclothes.

 

Compiles:

    player_wearClothes =        compile preprocessFileLineNumbers "fixes\player_wearClothes.sqf";
/*
_item spawn player_wearClothes;
Added Female skin changes - DayZ Epoch - vbawol
*/
private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_itemNew","_currentSex","_newSex","_model","_playerNear","_backup_humanity"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_83") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

_item = _this;
call gear_ui_init;

_onLadder =        (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};

_hasclothesitem = _this in magazines player;
_config = configFile >> "CfgMagazines";
_text = getText (_config >> _item >> "displayName");

if (!_hasclothesitem) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};

if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};

//if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_9"), "PLAIN DOWN"] };

if ("CSGAS" in (magazines player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_10"), "PLAIN DOWN"] };

_myModel = (typeOf player);
_itemNew = "Skin_" + _myModel;
// ------------------------------------------------------------------------Humanity Loss Fix Start ------------------------------------------------------------------------
_backup_humanity = player getVariable["humanity",0];
// ------------------------------------------------------------------------Humanity Loss Fix End ------------------------------------------------------------------------

//diag_log ("Debug Clothes: model In: " + str(_itemNew) + " Out: " + str(_item));

if ( (isClass(_config >> _itemNew)) ) then {
    if ( (isClass(_config >> _item)) ) then {
        // Current sex of player skin
        
        _currentSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _itemNew >> "sex");
        // Sex of new skin
        _newSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "sex");
        //diag_log ("Debug Clothes: sex In: " + str(_currentSex) + " Out: " + str(_newSex));

        if(_currentSex == _newSex) then {
            // Get model name from config
            _model = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "playerModel");
            if (_model != _myModel) then {
                if(([player,_item] call BIS_fnc_invRemove) == 1) then {
                    player addMagazine _itemNew;
                    [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
                };
            };

        } else {
            cutText [(localize "str_epoch_player_86"), "PLAIN DOWN"];
        };
    };
};
// ------------------------------------------------------------------------Humanity Loss Fix Start ------------------------------------------------------------------------
player setVariable["humanity",_backup_humanity,true];
// ------------------------------------------------------------------------Humanity Loss Fix End ------------------------------------------------------------------------
DZE_ActionInProgress = false;
Link to comment
Share on other sites

I am not really big on things that are painful to do and take a ton of time managing.  The reason I did that was becuase i was sick and tired of having to organize money and break it down and put it back together(not really a factor now with return change).  So now I make money, deposit it and eveything gets purchased straight from the bank and put in the bank.  Never have to worry about going to my base getting money, do I have enough, where did I put it?    We do not use keys on my sever either.  We have full UID integration on ownership for bases a vehicles, got tried of managing keys.

Link to comment
Share on other sites

To answer your question
XBowBill because Custom Hiveext.dll are just that cusotm and not standard.  Not to mention that building that compile environment is a project all in itself.  So I tried to work in the confines of standard hiveext.dll.  But hey I am sure this is not for everyone but those who want it is here.  I have a couple requests over the past year to share it and just had not had the time to write a decesant menu system to support the balance, withdraw and deposit functions.  Got time this week so I did it and now I am sharing it for any who want to use it.

Link to comment
Share on other sites

I am not really big on things that are painful to do and take a ton of time managing.  The reason I did that was becuase i was sick and tired of having to organize money and break it down and put it back together(not really a factor now with return change).  So now I make money, deposit it and eveything gets purchased straight from the bank and put in the bank.  Never have to worry about going to my base getting money, do I have enough, where did I put it?    We do not use keys on my sever either.  We have full UID integration on ownership for bases a vehicles, got tried of managing keys.

 

Just a question?

So you never are in danger loosing money? like no pvp action for money?

Link to comment
Share on other sites

Questions....

would this work ok on a pvp server, or is this only for nonpvp servers ??

so a player cannot find gold or get gold the normal wayz ?? only humanity pays gold ??

 

you state

First time character creation start the player with 2500 humanity which equates to 25gb.

sooo as a player adds humanity his bank account grows ??

what about bandits ?? 

I understand your servers are all nopvp but mine is pvp. Can I still use this ??

 

I would love to use this as I do not have access to required files for  zuppa's  single currency banking  with vilayer

Link to comment
Share on other sites

It works just fine on a pvp sever but if you care whether players are you have bandit or hero players  then it is probably not for you.

My brothers clan is running the code without the player menu interface on there pvp server just fine.  search for =HOG=

It uses the humanity values to store the bank account total.  So essentially your replacing your humanity system with it.  You would no longer have bandit/hero players since your humanity will always be above 0.  The reason it is built on the humanity system is because it one of the few stats that is tied to the player and rolls over when one character dies to the next character.

 

Gold that spawns in the world or drops from AI or missions still does.  What changes is if you go and sell your car you do not get hard currency anymore it goes straight into your back account. If you buy a car it deposit what ever hard currency in your inventory and then take the purchase price from your bank.

 

If you want the hard currency then you would have to withdraw it from your account.  Withdraw process works just like building material refunds you get a lot pile and you put it in your backpack or inventory.  If you have hard currency in your active inventory (not backpack)  and buy or sell something it will get automatically deposited into your bank account.  Honestly most of the time people only get hard currency is when they want to give someone money for something. Help out a new player stuff like that. 

Link to comment
Share on other sites

ive used the custom folder inside the mission example folder and had worked fine for me using the weather option too, the custom file didnt work no scrollie option and error on rpt. i checked both activate_player_menu.sqf and they do not match in both custom folder versions. seems missing this i think toolsAreActive=true;. i like this script, store gold in humanity and still use gold normally perfect hope this is kept updated i wouldn't want loose it. Humanity is the thing of the past, nice to start using it again :)

For anyone using infistar tis is what i added and work but may have differnt setting than you guys.

 

,"#USER:bankmenu","#USER:WTMenu","#USER:playermenustart",
    "#USER:WithdrawBankMenu","#USER:WithdrawCurrencyMenu"

Link to comment
Share on other sites

I apparently forgot to synch the test file to the gut hub sorry about that,  That is what I get for doing a release at 2 in the morning.

private["_veh", "_idx"];
_idx = -1;
toolsAreActive=true;

while {alive player} do
{
    if(toolsAreActive) then

That what the code block was suppose to look like in the activate_player_menu.sqf.  I have updated the guthub and retesteed from the example file and the menu works fine now.

Link to comment
Share on other sites

OK it's now working, toolsAreActive=true; was missing.  The menu needs to be only tied to the banking system not Player Tools.  What are the example sql files for?

By the way nice work the other money systems will never fly on rented servers plus the amount of code would be a pain on Epoch updates.

Link to comment
Share on other sites

Prior to doing the menu and before epochreturncurrency was in game I had vendor bank menus.  I was initially going to include all the sql , thought better of it and did not finish it.  When I just synched the guthub I removed that directory.  the bank vendor menu really is not required for deposits since they put in return change and the the withdraw from it was only one bar at a time.  The player tool menu functions are much better for it.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...