Jump to content

[Release] Adding higher end currency to traders. v1.1 -working


NAIL

Recommended Posts

Add end game currency to the traders. v1.1  Working for Epoch v1.0.4.2

 

Here is how I added a ruby to my server, a ruby is already in the game, just not implemented yet.

 
*This tutorial is based of an already basic knowledge of modding your server, you should already have a custom compiles.sqf and fn_selfActions.sqf.  If you do not have this already on your server or have no idea what I am talking about I suggest you learn how to add a self blood bag script as this is the most basic script that will explain to you what a fn_selfActions.sqf does.

 

The first step is we need to be able to trade brief cases for rubies.

 

If you don't want to be able to "buy" the end game currency then skip to part B.

 

 

in fn_selfActions.sqf find:

// Database menu
_buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
s_player_parts set [count s_player_parts,_buy];

Add the following below:

// Add static metals trader options under sub menu
_metals_trader = player addAction ["Trade Gems", "scripts\trade_metals.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_metals_trader];

Next we need to add the trade_metals.sqf to the scripts folder.  I call mine "scripts" but you can call yours whatever you like or already have.  This folder is the same folder that has your custom compiles.sqf and fn_selfActions.sqf.

 

Next we need to define the costs of the end game currency and add the menu for each.

 

In your same "scripts" folder open a new file and save the following code as trade_metals.sqf 

private ["_buy","_metals_conversion","_cancel"];

//diag_log format["DEBUG TRADE METALS: %1", _x];

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

{player removeAction _x} forEach s_player_parts;s_player_parts = [];
s_player_parts_crtl = 1;

_metals_conversion = [ 

	//["(vendors item)","(player item)",(vendorQty),playerQty),"buy","(player item description)","(vendor item description)",99]
	["ItemObsidian","ItemBriefcase100oz",1,6,"buy","Full Briefcases","Obsidian",99],
	["ItemBriefcase100oz","ItemObsidian",4,1,"buy","Obsidian","Full Briefcases",99],
	
	["ItemTopaz","ItemBriefcase100oz",1,6,"buy","Full Briefcases","Topaz",99],
	["ItemBriefcase100oz","ItemTopaz",4,1,"buy","Topaz","Full Briefcases",99],  
	
	["ItemRuby","ItemBriefcase100oz",1,12,"buy","Full Briefcases","Ruby",99],
	["ItemBriefcase100oz","ItemRuby",10,1,"buy","Ruby","Full Briefcases",99]
	
];

// Static Menu
{
	//diag_log format["DEBUG TRADER: %1", _x];
	_buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];
	s_player_parts set [count s_player_parts,_buy];
				
} forEach _metals_conversion;

_cancel = player addAction ["Cancel", "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];

DZE_ActionInProgress = false;

Now your vendor will "sell" you  a ruby for 12 briefcases, and buy one for 10.

 

Step B.

 

Selling an Item for end game currency is done in your database.  For example, I sell a UH60M with ammo for 1 ruby.

 

in my database I have:

 
 [item]                              [qty]        [buy]                          [sell]                                        [order]           [tid]         [afile]
 ["UH60M_EP1_DZ",2]     [10]        [1,"ItemRuby",1]         [3,"ItemBriefcase100oz",1]        0                  512         trade_any_vehicle_old
 
you need to add the _old to the afile or the vendor will not take payment.

 

if you need help with this look up how to add items to vendors and how to change prices.

Link to comment
Share on other sites

 I have been trying to add an additional currency for high end vehicles and weapons using the 4 versions of the IED utilizing a crafting mechanic for the IED's allowing them to be purchased from the donor rewards or farmed in game. However when I added them to the db as the currency (placed them in the trader items table as well) when you purchase say a vehicle with the IED's it all looks fine you get a key but the vehicle is never spawned and the IED's don't leave your inventory. I have done everything he has done to get the ruby's working except adding them to the trade metals because i don't want them purchasable for briefcases. Can anyone le tme know if there is a way to get them to take the IED's and spawn the vehicle or am I trying to do something that isn't possible.

Link to comment
Share on other sites

Looks REALLY cool! 

Do you think this might work?

CHANGING THIS: 

["ItemRuby","ItemBriefcase100oz",1,12,"buy","Full Briefcases","Ruby",98],

["ItemBriefcase100oz","ItemRuby",10,1,"buy","Ruby","Full Briefcases",97]

TO 

["ItemRuby","ItemBriefcase100oz",1,6,"buy","Full Briefcases","Ruby",98],

["ItemBriefcase100oz","ItemRuby",4,1,"buy","Ruby","Full Briefcases",97]

So players can buy rubies for 6 briefcases and sell them for 4?

 

Thanks!

xBowBii

Yes, this should work fine.

 

you can also add many tiers, the game already has like 6 different gemstones.

 

 I have been trying to add an additional currency for high end vehicles and weapons using the 4 versions of the IED utilizing a crafting mechanic for the IED's allowing them to be purchased from the donor rewards or farmed in game. However when I added them to the db as the currency (placed them in the trader items table as well) when you purchase say a vehicle with the IED's it all looks fine you get a key but the vehicle is never spawned and the IED's don't leave your inventory. I have done everything he has done to get the ruby's working except adding them to the trade metals because i don't want them purchasable for briefcases. Can anyone le tme know if there is a way to get them to take the IED's and spawn the vehicle or am I trying to do something that isn't possible.

 

I have not looked into it but I think your problem may be that once an IED is placed its a vehicle.  make sure you have the right class name for the inventory object, not vehicle object.

 

BAF_ied_v1

BAF_ied_v2

BAF_ied_v3

BAF_ied_v4

 

are your item class names,

 

LAND_IED_v1_PMC

LAND_IED_v2_PMC

LAND_IED_v3_PMC

LAND_IED_v4_PMC

 

are your vehicle class names

Link to comment
Share on other sites

If your talking about gold bars, that's easy.  you would just change the buy and sell price of everything that is not gold to gold.  then remove the trade metals of the other lesser currencies.  

 

if your asking about Maca's single currency system, I have no idea, although I wish I did.

Link to comment
Share on other sites

  • 2 weeks later...

The problem with 1.0.4 is, every currency has a backside value added, like Briefcases are worth a number of "10000". Now, while that allows the exchange of different currencys while trading and getting the correct worth of change back, it currently disallows to add anything like Gems or other Items to be used as currency.

 

Still thinking of a way to exclude a specific amount of items from the whole exchange-calculations to allow a few specials shop things to be bought exclusively for Gems, but not for any other currency.

Any hint or idea might be worth a lot, Im going to have an in-depth look the upcoming days, but couldnt yet think of a good solution except a clumsy addAction menu to allow for buying the vehicle/weapon from shop and thus excluding the traderUI.

Link to comment
Share on other sites

I didnt necessarily fix this but I did do this as a workaround. The trader that sells meat ect also sells tin bars for x, thinks its tin and whiskey or something. I made it so she sell's rubys for 2 briefs and it worked. So for stary and klen you can buy and bash you can sell.

Link to comment
Share on other sites

I didnt necessarily fix this but I did do this as a workaround. The trader that sells meat ect also sells tin bars for x, thinks its tin and whiskey or something. I made it so she sell's rubys for 2 briefs and it worked. So for stary and klen you can buy and bash you can sell.

 

Buying gems should be fine, but did you try selling them back for currency or items as well?

What should basicaly happen and does for most if not everybody is, that those gems dont get removed from your inventory and you are able to buy the currency for nothing as well. So even if you havent got any gems in your inventory, buying the item off of the trader is possible.

 

So if thats the case people can now buy currency for free on your server.

Link to comment
Share on other sites

ok so far, dissecting the current currency in game the lowest denomination is 1 oz of silver. lets say this is worth 1$

1 oz   silver  =  1$ 

10 oz silver = 10$

1 oz   gold   = 100$

10 oz gold = 1,000$

1 full brief = 10,000$

12 briefs   = 120,000$  the most you can currently hold in game.

 

So lets say a soda is the least expensive item in the game.  The lowest I can sell a soda to the vendor is 1$

 

The most expensive item currently in game would be a Chinook heli, but you can buy one for only 120,000?

 

 

I would like a gem to equal 10 briefs.   (I want a gem to be rare, or bought for 20% over the value, and different gems equal different classes of vehicles.  for example a rare heli is a ruby, a rare HMMWV is a obsidian and a rare land rover is topaz).

 

1 gem = 100,000$

12 gems = 1,200,000$

 

better yet have 2 tiers of gems.

 

tier one gem = 100,000$

tier 2 gem     = 1mil$

 

 

Now we have 12mil limit, this seems to be a better range of currency.

 

 

its not really about having more money, its more about having a larger range.  If I could go around and buy the most expensive item offered to me for 120000 of the least expensive item offered to me its like buying a heli for 5,000 cases of coke.

Link to comment
Share on other sites

Honestly the best solution would be for the devs to add a new form of currency stacking: stacked briefcases. It doesn't mess with their auto-stack/auto change making feature, but it allows the 12 brief limit to be exceeded. For instance, player has 1 brief and sells a heli for a 2nd. Instead of having 2 briefs, they now have 2 full briefcases as a stacked item. Selling/buying adjusts the currency to the correct amount.

Link to comment
Share on other sites

If you want to adjust the gap between smallest income item and most expensive thing to buy, why not just write an SQL that adjusts the sell prices to 1/3 for even less of the buy price. Would definately decrease the overall income and make more expensive stuff harder to come by.

You're also more flexible when things get updated, just adjust the newly added prices and your good to go - much quicker than heavy file editing each update that happens.

Only downside - removing currently fluctuation currency on a server can be a tough thing.

 

What Im rather trying to achieve with the gems and which worked out rather flawless before the currency exchange feature is: introduce something that is independent of the whole currency system and makes it far easier to control distribution of certain items. E.g.: make gems drop based on a low rate during AI missions, new loot options etc., thus encourage players to do these new tasks for special items and have a rather good overview of how many of these are around and in what way the loot chances need to be redone.

 

Though thats all for the bin now, anything not having a value set is rather the master key to buy things for free. So as long as theres no option or someone has come up with a way to exclude certain currencys from the exchange feature, everyones limited to using the ingots/briefcases thing.

Link to comment
Share on other sites

OK, I have messed with this and I am now trying to override the gems.hpp.  I don't think there is any feesable way to do this.  i need to add 

 

worth = *******; to each gem I want to use.  

 

here is an example currency

 

class ItemGoldBar: CA_Magazine {
    scope = 2;
    count = 1;
    worth = 100;
    type = 256;
    displayName = "Gold";
    model = "\z\addons\dayz_epoch\models\ItemGoldBar1oz.p3d";
    picture = "\z\addons\dayz_epoch\pictures\equip_gold_bar_CA.paa";
    descriptionShort = "Gold Bar";
    class ItemActions {
        class Crafting {
            text = $STR_EPOCH_PLAYER_210_1;
            script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
            neednearby[] = {};
            requiretools[] = {};
            output[] = {{"ItemGoldBar2oz",1}};
            input[] = {{"ItemGoldBar",2}};
 
        };
        class Crafting1 {
            text = $STR_EPOCH_PLAYER_210_9;
            script = ";['Crafting1','CfgMagazines', _id] spawn player_craftItem;";
            neednearby[] = {};
            requiretools[] = {};
            output[] = {{"ItemGoldBar10oz",1}};
            input[] = {{"ItemGoldBar",10}};
        };
    };
};
 
I don't need to add the crafting part, just the worth.
 
 
I tried to add it right to the epoch_totalCurrency in compiles.sqf
 
 
epoch_totalCurrency = {
// total currency
_total_currency = 0;
{
_part =  (configFile >> "CfgMagazines" >> _x);
_worth =  (_part >> "worth");
if isNumber (_worth) then {
_total_currency = _total_currency + getNumber(_worth);
};
case "ItemSapphire": {_total_currency = _total_currency + 100000};
case "ItemRuby": {_total_currency = _total_currency + 1000000};
} forEach (magazines player);
 
_total_currency
};
 
did not work.
Link to comment
Share on other sites

  • 2 weeks later...
 

As of 1.0.4.1 you can use the old barter system again, best for non silver/gold trades. Basically we re-added the old files, you can use them by changing the afile entry in the Traders_DATA database table from "trade_items" to "trade_items_old". This will also work for the other afile's just add _old to the name.

 

 

From other thread. Worked for me!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...