Jump to content

[RELEASE] Redbeard's Mining Output Modification


Recommended Posts

Redbeard's Mining Output Modification

I have always thought the Ore Mining on Epoch was a bit off. Not being able to adjust
what drops from the Ore Veins is what really got to me. So I started doing a little tinkering.
This is what I came up with.


Okay, after a night of figuring this out, it can be done. It is actually easier to do, than it was to figure out. Go Figure!

Changes must be made in several files. Remove.sqf, fn_selfActions.sqf, variables.sqf and description.ext. You must also add a file I duly named mining.hpp.

Step 1: Create a new text file in your editor. Then copy and paste the following code into the new file.
 
class Mining {
class Land_iron_vein_wreck {
removeoutput[] = {{"PartOre",{10,25}},{"PartOreSilver",{0,1}},{"PartOreGold",{0,5}}};
};
class Land_silver_vein_wreck {
removeoutput[] = {{"PartOreSilver",{10,25}},{"PartOre",{0,1}},{"PartOreGold",{6,4}}};
};
class Land_gold_vein_wreck {
removeoutput[] = {{"PartOreGold",{10,25}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}}};
};
};
Now save this file as mining.hpp and move it into your mission folder. I have mine inside a custom folder.

Step 2: Open your description.ext and add this line of code at the very bottom.
#include "custom\mining.hpp" //Make sure to edit to the proper path to file.
Save and close your description.ext

Step 3: Open your variables.sqf. (I assue you know what and where to find this. Most people have a custom file.)

Look for this code:
 
DZE_isWreckBuilding = ["Land_wreck_cinder","Land_wood_wreck_quarter","Land_wood_wreck_floor","Land_wood_wreck_third","Land_wood_wreck_frame","Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck","Land_ammo_supply_wreck"];
Replace it with this code:
DZE_isWreckVein = ["Land_iron_vein_wreck","Land_silver_vein_wreck","Land_gold_vein_wreck"];

DZE_isWreckBuilding = ["Land_wreck_cinder","Land_wood_wreck_quarter","Land_wood_wreck_floor","Land_wood_wreck_third","Land_wood_wreck_frame","Land_ammo_supply_wreck"];
Save and close your variables.sqf.

Step 4: Open your fn_selfActions.sqf (If you don't have a custom one, you are gonna have to sort that out.)

Find this code:
_isWreck = _typeOfCursorTarget in DZE_isWreck;
Add this Below it:
 
_isWreckVein = _typeOfCursorTarget in DZE_isWreckVein;
Find this code:
 
//Allow player to delete objects
		if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
			if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
				_player_deleteBuild = true;
			};
		};
Change it to:
 
//Allow player to delete objects
		if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding || _isWreckVein) then {
			if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
				_player_deleteBuild = true;
			};
		};
Save and close your fn_selfActions.sqf

Step 5: Open your remove.sqf

Find this code:
_isWreck = _typeOfCursorTarget in DZE_isWreck;
Add this Below it:
 
_isWreckVein = _typeOfCursorTarget in DZE_isWreckVein;
Find this code:
 
		_selectedRemoveOutput = [];
		if(_isWreck) then {
			// Find one random part to give back
			_refundpart = ["PartEngine","PartGeneric","PartFueltank","PartWheel","PartGlass","ItemJerrycan"] call BIS_fnc_selectRandom;
			_selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]];
		} else {
			if(_isWreckBuilding) then {
				_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
			} else {
				_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
				_preventRefund = (_objectID == "0" && _objectUID == "0");

			};
		};
Change it to this:
 
		_selectedRemoveOutput = [];
		if(_isWreck) then {
			// Find one random part to give back
			_refundpart = ["PartEngine","PartGeneric","PartFueltank","PartWheel","PartGlass","ItemJerrycan"] call BIS_fnc_selectRandom;
			_selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]];
		} else {
			if(_isWreckVein) then {
				_selectedRemoveOutput = getArray (missionConfigFile >> "Mining" >> _objType >> "removeoutput");
			} else {
			if(_isWreckBuilding) then {
				_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
			} else {
				_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput");
				_preventRefund = (_objectID == "0" && _objectUID == "0");	
				
			};
			};
		};
Save and close your remove.sqf.

You are now done with all my hard work!

Now let me go over customizing the vein loot drops!

Back to the mining.hpp. This code is where it is all done:
 
class Mining {
class Land_iron_vein_wreck {
removeoutput[] = {{"PartOre",{10,25}},{"PartOreSilver",{0,1}},{"PartOreGold",{0,5}}};
};
class Land_silver_vein_wreck {
removeoutput[] = {{"PartOreSilver",{10,25}},{"PartOre",{0,1}},{"PartOreGold",{6,4}}};
};
class Land_gold_vein_wreck {
removeoutput[] = {{"PartOreGold",{10,25}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}}};
};
};
A break down of how it works!

In each class, you will have a line that looks like this:
removeoutput[] = {{"PartOreGold",{10,25}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}}};
This line is the array used to determine what is dropped when you de-construct an ore vein.
 
removeoutput[] = {
{"PartOreGold",{10,25}}, 
//Array Structure
//{"Item to Drop",{AmountGuaranteedToDrop,AmountToRandomlyAddToGuaranteedDropAmount}},
{"PartOre",{0,1}},
{"PartOreSilver",{6,4}}
};
You can even add to the array to add other possible drops like this:
removeoutput[] = {{"PartOreGold",{10,25}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}},{"ItemRuby",{6,4}}};
Please have fun using this!

Thank you, AxeCop. For pointing out what I was missing.
Link to comment
Share on other sites

for some that need to do this also....
If you dont have a custom remove.sqf....
copy remove.sqf from dayz_code
 
in compiles change remove.sqf path
// player_removeObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
player_removeObject = compile preprocessFileLineNumbers "custom\fixes\remove.sqf";

also "may" need to change path in

fn_selfActions.sqf
// s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "custom\fixes\remove.sqf",_cursorTarget, 1, true, true, "", ""];
// s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "custom\fixes\remove.sqf",_cursorTarget, 1, true, true, "", ""];
Link to comment
Share on other sites

Okay, it has been brought to my attention that I didn't cover gem drops. Gem drops have been covered elsewhere.

But here is a quick rundown.

Remember, if you adjust a Vein to drop something in the code I released above, it will drop it every time someone removes one.

But lower down in the Remove.sqf, You will find this code:

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

This is the code that dictates the gem drops. Unchanged, it will drop one of seven gems at random about 30%-40% of the time. One out of 3-4 veins will drop a gem. You have just as good of a chance to get a Ruby as you do an Obsidian.

 

I have changed my code to this:

if (_isMine) then {
			if((random 50) <= 10) then {
				_gem = ["ItemRuby","ItemEmerald","ItemSapphire","ItemSapphire","ItemTopaz","ItemTopaz","ItemTopaz","ItemTopaz","ItemAmethyst","ItemAmethyst","ItemAmethyst","ItemAmethyst","ItemAmethyst","ItemCitrine","ItemCitrine","ItemCitrine","ItemCitrine","ItemCitrine","ItemCitrine","ItemObsidian","ItemObsidian","ItemObsidian","ItemObsidian","ItemObsidian","ItemObsidian","ItemObsidian","ItemObsidian"] call BIS_fnc_selectRandom;
				_selectedRemoveOutput set [(count _selectedRemoveOutput),[_gem,1]];
			};
		};

This change makes gems drop out of every 4 to 5 veins. With high value gems (Rubies, Emeralds and Sapphires) dropping more rarely than the lower value gems.

 

Just so I don't have to answer this question in the future. I am going to deliver a preemptive strike.

 

What good are Gems if they have no value in the game? How nice of you to ask!

 

Since these modifications have no value without the gems having value in game. I offer you this.

 

Step 1: Open your server_traders.sqf,

 

Look for this block of code:

// Black market
menu_GUE_Woodlander2 = [
	[["Black Market Ammo",527],["Black Market Weapons",526],["Explosives",529]],
	[],
	"neutral"
];

Replace it with this code:

// Black market
menu_GUE_Woodlander2 = [
	[["Black Market Ammo",527],["Black Market Weapons",526],["Explosives",529]],
	[
//Gem Trading Code Start
		["ItemBriefcase100oz","ItemRuby",12,1,"buy","Ruby","Briefcase Gold(100oz)",101],
		["ItemBriefcase100oz","ItemEmerald",6,1,"buy","Emerald","Briefcase Gold(100oz)",101],
		["ItemBriefcase100oz","ItemSapphire",3,1,"buy","Sapphire","Briefcase Gold(100oz)",101],
		["ItemBriefcase100oz","ItemTopaz",1,1,"buy","Topaz","Briefcase Gold(100oz)",101],
		["ItemBriefcase50oz","ItemAmethyst",1,1,"buy","Amethyst","Briefcase Gold(50oz)",101],
		["ItemBriefcase20oz","ItemCitrine",1,1,"buy","Citrine","Briefcase Gold(20oz)",101],
		["ItemGoldBar10oz","ItemObsidian",1,1,"buy","Obsidian","Gold Bar(10oz)",101]
		
	//Gem Trader Code End
	],
	"neutral"
];

Close and save the file. Once it is updated on your server. The Black market trader is now a gem trader.

 

I researched the gems and priced them as close as I could to reality. Enjoy.

Link to comment
Share on other sites

 

for some that need to do this also....
If you dont have a custom remove.sqf....
copy remove.sqf from dayz_code
 
in compiles change remove.sqf path
// player_removeObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\remove.sqf";
player_removeObject = compile preprocessFileLineNumbers "custom\fixes\remove.sqf";

also "may" need to change path in

fn_selfActions.sqf
// s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "custom\fixes\remove.sqf",_cursorTarget, 1, true, true, "", ""];
// s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "custom\fixes\remove.sqf",_cursorTarget, 1, true, true, "", ""];

 

Thanks for adding that. I was doing this in a hurry.

Link to comment
Share on other sites

  • 7 months later...

Doesn't change anything. Supply Crates & Ore Veins are still removeable by multiple players.

There is no such line in remove.sqf:

_isWreck = _typeOfCursorTarget in DZE_isWreck;

Only: _isWreck = _objType in DZE_isWreck; ( in Chance to break tools section )

Seems like server needs to give a player ability to remove global, evtl. in antihax or else.... i don't know...

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

×
×
  • Create New...