Jump to content

[Release]Higher Currency at Traders.


Recommended Posts

Hi Ped, well I went mining and with it set to random 100 <=4 I hit gems on 2 out of 3 attempts. With it set to 100 <=1 I hit gems 1 out of 3 attempts!

 

I promise this is all called properly with one override. Could it have something to do with the amount of other stuff that is dropped. For instance when mined, the vein drops other stuff too like 20 gold ore, 6 tin etc etc... Sorry for my complete lack of understanding of the code but, could that mean those items are using up numbers in that 100 already. Or, have I got you laughing now.... :)

 

Can I try random 1000?

 

Appreciate your help on this.

 

So, you're saying you have it set to 100 <=1 and you're getting a gemstone 1 out of 3 times? The math portion of my brain is exploding right now.

1 out of 3 is screaming at me that you are still using the original file formula of 100 <= 40

 

Would you be kind enough to double, triple and quadruple check your compile.sqf is pointing to the correct directory\remove.sqf?

This is mine:

	player_removeObject =			compile preprocessFileLineNumbers "compile\remove.sqf";

My remove.sqf is within the compile directory.

 

And inside my remove.sqf is:

		if (_isMine) then {
			if((random 100) <= 15) then {
				_gems = ["ItemTopaz","ItemObsidian","ItemSapphire","ItemAmethyst","ItemEmerald","ItemCitrine"];
				_gem = _gems select (floor(random (count _gems)));
				_selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]];
			};
		};

I have it set for a 15% chance to drop one of the listed gemstones. You can probably see I remove Ruby so they don't drop at all out of mines.

 

---

 

As far as your question about using 1000, you absolutely can. In fact, it could very well be that your server's machine simply likes to return low numbers when invoking random. So, you could also try a greater then number.

Say, for example:

if((random 1000) >= 990) then {

As it's checking for a number of 10 from 1000, specifically 990-1000, it's a 1% chance. It's often better to use larger numbers with a random call to better simulate some randomness because it's somewhat true with a call from 1 to 100 that the machine will return the same numbers.

 

You can even go to less then 1% with something like:

if((random 1000000) <= 100) then {

This would equate to a gem dropping at what, .01% chance?

 

---

In all honesty though, I truly believe you are not pointed to the edited remove.sqf because from all indications given by you, gems seem to be dropping at about 100 <= 40

Link to comment
Share on other sites

Thanks for your reply Ped. I promise I have the following:

Search "remove.sqf" (1 hit in 1 file)
  C:\Users\Harv\Desktop\DayZ_Epoch_11.Chernarus\custom\compiles.sqf (1 hit)
Line 30:  player_removeObject = compile preprocessFileLineNumbers "custom\remove.sqf"; //Changed gem rarity ready for gem trader
Search "compiles" (1 hit in 1 file)
  C:\Users\Harv\Desktop\DayZ_Epoch_11.Chernarus\init.sqf (1 hit)Line 77: call compile preprocessFileLineNumbers "custom\compiles.sqf"; //Compile regular functions

Then in remove.sqf:

if (_isMine) then {
if((random 100) <= 1) then {
_gems = ["ItemTopaz","ItemObsidian","ItemSapphire","ItemAmethyst","ItemEmerald","ItemCitrine","ItemRuby"];
_gem = _gems select (floor(random (count _gems)));
_selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]];
};
};

Very confused....but, thanks for your reply. I will try 1000 first and see how we go with the line below as plan E 

if((random 1000) >= 990) then {
 
Thanks again for your help.
Link to comment
Share on other sites

Hi Ped, I still seem to be getting a high number even when set to 1000 >= 960! I followed a player round last night and he hit 3 out of 6 gems from veins even though only got 2....but still not 4%!

 

Could this have anything to with it? I have a couple of different actions in selfActions that are also calling the dayz_code remove.sqf:

Line 262: s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
Line 516: s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];

Could they be causing the issue, should they be re-pointed too?

 

EDIT: I'm guessing it has to be this so, am changing those to point to the custom remove.sqf too. Sorry if this is a facepalm moment. I'm relatively new to this....  :unsure:

 

Thanks for your help.

Link to comment
Share on other sites

 

Hi Ped, I still seem to be getting a high number even when set to 1000 >= 960! I followed a player round last night and he hit 3 out of 6 gems from veins even though only got 2....but still not 4%!

 

Could this have anything to with it? I have a couple of different actions in selfActions that are also calling the dayz_code remove.sqf:

Line 262: s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
Line 516: s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];

Could they be causing the issue, should they be re-pointed too?

 

EDIT: I'm guessing it has to be this so, am changing those to point to the custom remove.sqf too. Sorry if this is a facepalm moment. I'm relatively new to this....  :unsure:

 

Thanks for your help.

 

Just to confirm, that it was that. gems are now nice and rare.

 

Apologies for not spotting the other actions in selfactions that were calling the original remove file!  :unsure:

 

Thanks for your time though, I learnt a lot and certainly will check for different calls in other files for overrides in the future...rather than just the one override potentially duplicated which is what I originally checked.

Link to comment
Share on other sites

  • 2 weeks later...

Just to confirm, that it was that. gems are now nice and rare.

 

Apologies for not spotting the other actions in selfactions that were calling the original remove file!  :unsure:

 

Thanks for your time though, I learnt a lot and certainly will check for different calls in other files for overrides in the future...rather than just the one override potentially duplicated which is what I originally checked

 

 

It didn't even occur to me to ask if you had other scripts calling another version of the file. Glad you spotted it and got things worked out.

Link to comment
Share on other sites

 

Hi, I followed this tutorial but am getting this error message in my server rpt:

 9:43:02 "EPOCH SERVERTRADE: Player: ShermaN_TanK (76561STEAM1567) sold a ItemRuby in/at trader city Stary for <null>x <null>"
 9:43:02 Error in expression <urrency = _this select 5;
_qty = _this select 6;
_clientID = owner _player;
_p>
 9:43:02   Error position: <select 6;
_clientID = owner _player;
_p>
 9:43:02   Error Zero divisor
 9:43:02 File z\addons\dayz_server\compile\server_tradeObject.sqf, line 9
 
Anyone know how to fix this?
 
Thanks

 

check line 9 inside server_tradeObject.sqf in dayz_server\compile\ for a spelling mistake in line 9, <urrency = _this select 5; 

it might be that you need to correct that spelling mistake from urrency to currency. sorry i was away and you might have fixed it already

Link to comment
Share on other sites

check line 9 inside server_tradeObject.sqf in dayz_server\compile\ for a spelling mistake in line 9, <urrency = _this select 5; 

it might be that you need to correct that spelling mistake from urrency to currency. sorry i was away and you might have fixed it already

Hi, there doesn't appear to be any spelling mistakes and I haven't touched server_tradeObject.sqf from default. I have pasted it below:

 

private ["_player","_name","_traderid","_buyorsell","_data","_result","_key","_outcome","_clientID"];
 
_player = _this select 0;
_traderID = _this select 1;
_buyorsell = _this select 2; //0 > Buy // 1 > Sell
_classname = _this select 3;
_traderCity = _this select 4;
_currency = _this select 5;
_qty = _this select 6;
_clientID = owner _player;
_price = format ["%2x %1",_currency,_qty];
_name = if (alive _player) then { name _player; } else { "Dead Player"; };
 
if (_buyorsell == 0) then { //Buy
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) bought a %3 in/at %4 for %5", _name, (getPlayerUID _player), _classname, _traderCity, _price];
} else { //SELL
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) sold a %3 in/at %4 for %5",_name, (getPlayerUID _player), _classname, _traderCity, _price];
};
 
if (DZE_ConfigTrader) then {
_outcome = "PASS";
} else {
//Send request
_key = format["CHILD:398:%1:%2:",_traderID,_buyorsell];
 
_data = "HiveEXT" callExtension _key;
_result = call compile format ["%1",_data];
// diag_log ("TRADE: RES: "+ str(_result));
_outcome = _result select 0;
};
 
dayzTradeResult = _outcome;
if(!isNull _player) then {
_clientID publicVariableClient "dayzTradeResult";
};

 
Any more ideas? Someone mentioned earlier not to worry about it but, this is literally the last error in my server rpt apart from the usual client/server object not found spam.
Link to comment
Share on other sites

 

Hi, there doesn't appear to be any spelling mistakes and I haven't touched server_tradeObject.sqf from default. I have pasted it below:

 

private ["_player","_name","_traderid","_buyorsell","_data","_result","_key","_outcome","_clientID"];
 
_player = _this select 0;
_traderID = _this select 1;
_buyorsell = _this select 2; //0 > Buy // 1 > Sell
_classname = _this select 3;
_traderCity = _this select 4;
_currency = _this select 5;
_qty = _this select 6;
_clientID = owner _player;
_price = format ["%2x %1",_currency,_qty];
_name = if (alive _player) then { name _player; } else { "Dead Player"; };
 
if (_buyorsell == 0) then { //Buy
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) bought a %3 in/at %4 for %5", _name, (getPlayerUID _player), _classname, _traderCity, _price];
} else { //SELL
diag_log format["EPOCH SERVERTRADE: Player: %1 (%2) sold a %3 in/at %4 for %5",_name, (getPlayerUID _player), _classname, _traderCity, _price];
};
 
if (DZE_ConfigTrader) then {
_outcome = "PASS";
} else {
//Send request
_key = format["CHILD:398:%1:%2:",_traderID,_buyorsell];
 
_data = "HiveEXT" callExtension _key;
_result = call compile format ["%1",_data];
// diag_log ("TRADE: RES: "+ str(_result));
_outcome = _result select 0;
};
 
dayzTradeResult = _outcome;
if(!isNull _player) then {
_clientID publicVariableClient "dayzTradeResult";
};

 
Any more ideas? Someone mentioned earlier not to worry about it but, this is literally the last error in my server rpt apart from the usual client/server object not found spam.

 

is the currency working properly? if you dont get any problems just leave it i guess.

Link to comment
Share on other sites

  • 4 weeks later...

I have a problem with this, do not really understand what the "_OLD".

I can buy and sell gems but when I go to purchase an article by ruby so buy without any inventory.

please help

 

when you add _old to the database. 

the game will then use trade_items_old.sqf or trade_any_vehicle_old.sqf

 

so what that does, is tells the game to use a different sqf script. and then the game will take the gems or whatever other item you may have out of your inventory to buy it. 

if i'm not mistaken, this is because the new version of trade_items or trade_any_vehicle will give change, so if you have a briefcase with 2x10oz and you spend 8 gold. it returns a 10oz + 2oz

 

whereas the _old version doesn't return change, so it doesnt matter. 

 

5oWo5GG.png

 

this is a screenshot of my db, notice that any items selling for rubies have _old at the end. 

and those that sell for regular currency do not. 

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
  • Discord

×
×
  • Create New...