Jump to content
Sign in to follow this  
Vindomire

[Release] Mining 1.2 Updated 08/06/2014

Recommended Posts

After watching a video for city life and seeing a bunch of people mining in a barn i thought... i like that. The current node system is ok... but people dont generally want to search around for them. I decided to add 2 Mining node areas and mark them on the map to encourage a bit of PVP in 2 more areas.

 

Arm_A2_OA_2014_08_02_23_00_06_32.jpghttp://youtu.be/smaqOi7MnhY

 

What this does:
If you have a Toolbox and a Sledge, you go to where the nodes are and if your 15m from the activiation object you get a start mining option. The script will then loop on a 10 second timer collecting iron ore, silver ore, gold ore, and rarely gems. Since my server uses gems as a higher currency this would be the draw to these sites. It will loop until your inventory is full then you start it all over again.
 
Installation:
 
1) Download https://dl.dropboxusercontent.com/u/14198394/mining.zip and unzip into your mission pbo/custom directory
 
2) Add to init.sqf:     [] execVM 'custom\mining\init.sqf';     //Added for Mining in the if (!isDedicated) then { section
 
3) OPTIONAL to add map markers
    Add to class markers in mission.sqm and replace # with proper incremented number and increase the items=# by 2:

		class Item#
		{
			position[]={ 3893.9448, 0, 11426.449};
                        name="Mine1";
                        text="Mining Node";
                        type="mil_dot";
                        colorName="ColorBlack";
		};
		class Item#
		{
			position[]={ 13273.093, 0, 6099.0747};
                        name="Mine2";
                        text="Mining Node";
                        type="mil_dot";
                        colorName="ColorBlack";
		};

4) Download https://dl.dropboxusercontent.com/u/14198394/mining.sqf and place it in whatever folder you put your custom map additions in the server pbo
 
5) add to the end of init\server_functions in server pbo:

	//Mining Nodes
	[] execVM "z\addons\dayz_server\<CUSTOM FOLDER NAME>\mining.sqf";

6) to stop undefined variable errors in the RPT add to your custom variables.sqf inside dayz_resetSelfActions = {:

	s_player_mining = -1;
	s_player_mine = -1;

DONE!
 
From that point you should just have to go to the giant rock tower and mine. The rock tower is just for looks since i didnt want people to be able to mine at them all i put an object(BeltBuckle_DZE) in the middle to trigger the start mining scroll option. So to add more just put the belt buckle somewhere and drop a rock tower over top of it.
 
This is the first script i have made for release so hopefully the install instructions are good. :)
 

Version 1.1 Uploaded 08/04/2014 (download and replace your mining\init.sqf and mining\start.sqf):

  • New requirement to have sledgehammer as primary weapon
  • animation changed to swinging animation
  • Moving cancels mining as well as the stop mining option (now properly removes the stop mining option and readds start mining)
  • Notification when you enter mining range with instructions on how to mine added
  • inventory max changed to 20 (hopefully it is more accurate)
  • ore percentages changed and where gems are calculated moved. Less gems then before but more consistant numbers.
  • small code optimizations

Version 1.2 Uploaded 08/06/2014 (download and replace your mining\init.sqf and mining\start.sqf):

  • Proper inventory full check, no more overflow
  • Various notification handling changes
  • Ability to get the start mining with a sledge in inventory but you are told it must be equipped to mine
  • Check to make sure the sledge is the current weapon selected
  • check to make sure your looking at the rockwall. Cancels mining if you look away
  • closes inventory if opened
  • minor little formatting and undefined variable fixes

*** Special Thanks to hogscraper for the animation change, sledge as primary(including fix), movement cancellation, proper inventory handling, close inventory and change to the notification handling.

 

Known Issue (removed for all new downloads):

Sometimes it wont let you mine when looking at the rock (works for me on my server after about 3 mining tries then isnt a problem everr again). To disable the rockwall cursor check delete from start.init:

if (!(_cursorTarget isKindOf "MAP_R2_RockTower")) exitWith {
isMining = false;
systemChat("Must look at what your Mining.");
};
 

Share this post


Link to post
Share on other sites

Not sure if you're interested but I wanted this to have a little more tension where I intend to use it. I also wanted it to be a little more realistic so I changed two things up in the version I am using.

I added a check in your init.sqf to see if the player is wielding the sledge, and if so, that sets _hasSledge=true

_currentWeapon = primaryWeapon player;
if (_currentWeapon == "MeleeSledge") then {
_hasSledge=true;
};
I changed the start.sqf so that the player has to have the sledge equipped and it uses the melee swinging option. It also allows the player to run away from the area and cancels out the mining if he does.

//Mining Start
isMining = true;
systemChat("Mining Started");
addOre = (vehicle player);
 
player removeAction s_player_mine;
s_player_mining = -1;
 
//checks player's current weapon and exist with message if they do not have a sledge equipped
//adds eventhandler so that if the player looks away from the rock they break out of the mining action
_currentWeapon = primaryWeapon player;
if (_currentWeapon == "MeleeSledge") then {
 
r_interrupt=false;
 
while {isMining} do {
_inventory = magazines player;
_Mining_Counter=10;
if (count _inventory > 24) exitWith {
isMining = false;
player removeAction s_player_mining;
s_player_mine = -1;
systemChat ("Your inventory is full.");
};
 
[10,10] call dayz_HungerThirst;
 
//set up quick loop that swings the sledge and if player moves it breaks out of the mining action
while {_Mining_Counter>-1} do {
if(r_interrupt) exitWith {isMining=false};
player playActionNow "GestureSwing";
sleep 1;
_Mining_Counter=_Mining_Counter - 1;
};
 
if (isMining) then {
private ["_rand","_randGem"];
_rand = floor(random 100);
 
if (_rand <= 50) then {
addOre addMagazine 'PartOre';
systemChat("Mined 1 iron ore.");
};
 
if (_rand <= 80 && _rand > 50) then {
addOre addMagazine 'PartOreSilver';
systemChat("Mined 1 Silver ore.");
};
 
if (_rand <= 95 && _rand > 80) then {
addOre addMagazine 'PartOreGold';
systemChat("Mined 1 Gold ore.");
};
 
if (_rand <= 100 && _rand > 95) then {
_randGem = floor(random 7);
 
if (_randGem == 0) then {
addOre addMagazine 'ItemTopaz';
systemChat("Mined 1 Topaz.");
};
if (_randGem == 1) then {
addOre addMagazine 'ItemObsidian';
systemChat("Mined 1 Obsidian.");
};
if (_randGem == 2) then {
addOre addMagazine 'ItemSapphire';
systemChat("Mined 1 Sapphire.");
};
if (_randGem == 3) then {
addOre addMagazine 'ItemAmethyst';
systemChat("Mined 1 Amethyst.");
};
if (_randGem == 4) then {
addOre addMagazine 'ItemEmerald';
systemChat("Mined 1 Emerald.");
};
if (_randGem == 5) then {
addOre addMagazine 'ItemCitrine';
systemChat("Mined 1 Citrine.");
};
if (_randGem == 6) then {
addOre addMagazine 'ItemRuby';
systemChat("Mined 1 Ruby.");
};
};
 
} else {
systemChat("Mining Cycle Cancelled");
player removeAction s_player_mining;
s_player_mine = -1;
 
};
};
} else {
systemChat("You must have your Sledgehammer equipped to mine!");
isMining = false;
};

 

Share this post


Link to post
Share on other sites

@calamity its in the objects helper i beleive but can really be any item you want to change the script to or even multiple types _trigger = ["BeltBuckle_DZE"]; is an array.

 

@Hogscraper i wanted to do the swing animation with the sledge but didnt quite know how to do it, so thanks for that. I didnt script in any movement code because the animation kept you locked down however if you got out of range of it SOMEHOW it would still have shut off. Good additions, thanks :) i will play with your addition and make it a next version.

Share this post


Link to post
Share on other sites

This will make a nice addition to our server, can make it spawn in the rocks across different area's of the map as a mission with limited resources :) Great script!

Share this post


Link to post
Share on other sites

 

Not sure if you're interested but I wanted this to have a little more tension where I intend to use it. I also wanted it to be a little more realistic so I changed two things up in the version I am using.

I added a check in your init.sqf to see if the player is wielding the sledge, and if so, that sets _hasSledge=true

_currentWeapon = primaryWeapon player;
if (_currentWeapon == "MeleeSledge") then {
_hasSledge=true;
};
would I add your sledge check like this ???
 

//Mining Actions
_currentWeapon = primaryWeapon player;
if (_currentWeapon == "MeleeSledge") then {
_hasSledge=true;
};
while {true} do {
private ["_pos","_mineNodes","_inRange","_trigger","_hasSledge","_hasToolbox","_inventory"];

Share this post


Link to post
Share on other sites

i will look into creep and re upload

 

When tested it kicks out and says inventory full... the check is in the while loop... The issue is inventory is counted by the 12 magazine slots and the 8 lower magazine slots. So if your lower mag slots is full it will mine 12 ore and say full. HOWEVER if your lower inventory is empty it will mine 20 ore and put the 8 extra ore in buffer....

Share this post


Link to post
Share on other sites

its for cherarus. you put the markers in and cahnged the #'s to incerement the existing ones? then went to the top and incresed the items number by 2?

	class Markers
	{
		items=33;
		class Item0
		{
			position[]={7839.6055,381.33774,8414.7324};
			name="center";
			type="Empty";
		};
		class Item1
		{
			position[]={-7245.377,365.98782,19535.367};
			name="respawn_west";
			type="Empty";
		};
		class Item2
		{
			position[]={4932,0,1989};
			name="spawn0"; //spawn_balota
			type="Empty";
		};
		class Item3
		{
			position[]={2236,0,1923};
			name="spawn1"; //spawn_kamenka
			type="Empty";
		};
		class Item4
		{
			position[]={8738,0,2122};
			name="spawn2"; //spawn_cherno
			type="Empty";
		};
		class Item5
		{
			position[]={10909,0,2422};
			name="spawn3"; //spawn_elektro
			type="Empty";
		};
		class Item6
		{
			position[]={13510,0,5249};
			name="spawn4"; //spawn_sol
			type="Empty";
		};
		class Item7
		{
			position[]={12048,0,8352};
			name="spawn5"; //spawn_berezino
			type="Empty";
		};
		class Item8
		{
			position[]={6326.4805,304.99265,7809.4888};
			name="Tradercitystary";
			text="Trader City Stary";
			type="mil_circle";
			colorName="ColorBlack";
		};
		class Item9
		{
			position[]={4361.4937,3,2259.9526};
			name="wholesaleSouth";
			text="Wholesaler";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item10
		{
			position[]={13532.614,3.0083523,6355.9497};
			name="boatTraderEast";
			text="Wholesaler";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item11
		{
			position[]={7989.3354,0.30462033,2900.9946};
			name="BoatDealerSouth";
			text="Boat Dealer";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item12
		{
			position[]={12060.471,158.85699,12638.533};
			name="AirVehicles";
			text="Aircraft Dealer";
			type="mil_dot";
			colorName="ColorGreen";
		};
		class Item13
		{
			position[]={11447.91,317.27109,11364.536};
			name="Klen";
			text="Trader City Klen";
			type="mil_circle";
			colorName="ColorGreen";
		};
		class Item14
		{
			position[]={13441.16,1.1406164,5429.3013};
			name="BoatDealerEast";
			text="Boat Dealer";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item15
		{
			position[]={4064.2258,365.13501,11665.938};
			name="TradercityBash";
			text="Trader City Bash";
			type="mil_circle";
			colorName="ColorBlack";
		};
		class Item16
		{
			position[]={12944.227,210.19823,12766.889};
			name="HeroTrader";
			text="Hero Camp";
			type="mil_dot";
			colorName="ColorBlue";
		};
		class Item17
		{
			position[]={4284,210.19823,10932.3};
			name="SuperHeroTrader";
			text="Super Hero Camp";
			type="mil_dot";
			colorName="ColorGreen";
		};
		class Item18
		{
			position[]={14740,0,13708};
            name="donator";
            text="Donator City Dome";
            type="mil_circle";
            colorName="ColorRed";
		};
		class Item19
		{
			position[]={0,1.1406164,1500};
			name="rule1";
			text="Website: http://c5.enjin.com";
			type="mil_dot";
			colorName="ColorGreen";
		};
		class Item20
		{
			position[]={0,1.1406164,1400};
			name="rule2";
			text="TS3: sefem.typefrag.com";
			type="mil_dot";
			colorName="ColorGreen";
		};
		class Item21
		{
			position[]={0,1.1406164,1300};
			name="rule6";
			text="No Building in buildings or blocking loot spawns";
			type="mil_dot";
			colorName="ColorRed";
		};

		class Item22
		{

			position[]={0,1.1406164,1200};
			name="rule7";
			text="No Parking vehicles in Trade Zones while logged out";
			type="mil_dot";
			colorName="ColorRed";
		};

		class Item23
		{

			position[]={0,1.1406164,1100};
			name="rule8";
			text="No Bases Within 1000m of a trader";
			type="mil_dot";
			colorName="ColorRed";
		};

		class Item24
		{

			position[]={0,1.1406164,1000};
			name="rule9";
			text="No Bases in High Loot areas";
			type="mil_dot";
			colorName="ColorRed";
		};

		class Item25
		{
			position[]={11652,1.1406164,10266};
			name="racetrack";
			text="Race Track";
			type="Flag1";
			colorName="ColorGreen";
		};

		class Item26
		{
			position[]={ 13562.2,0,3105.12};
            name="Skalisty";
            text="Skalisty Bandit Refuge";
            type="mil_circle";
            colorName="ColorBlack";
		};

		class Item27
		{
			position[]={ 0,1.1406164,600};
            name="nopark";
            text="Bases Built in Orange Circles or vehicles left in those circles will be deleted. Vehicles left on or directly beside roads will be deleted.";
			type="mil_dot";
			colorName="ColorRed";
		};
		class Item28
		{
			position[]={ 1613.15,1.1406164,7787};
            name="bandit";

            text="Bandit Trader";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item29
		{
			position[]={ 12605.696, 1, 5714.4531};


            name="bandit";
            text="Super Bandit Trader";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item30
		{
			position[]={2879,1,9746};
			name="Tradercityoverpoch";
			text="Overwatch City Traders";
			type="mil_circle";
			colorName="ColorBlack";
		};
		class Item31
		{
			position[]={ 3893.9448, 0, 11426.449};
            name="Mine1";
            text="Mining Node";
            type="mil_circle";
            colorName="ColorBlack";
		};
		class Item32
		{
			position[]={ 13273.093, 0, 6099.0747};
            name="Mine2";
            text="Mining Node";
            type="mil_circle";
            colorName="ColorBlack";
		};

	};

This is the section of my mission.sqm and how it looks... minus the formatting caue the copy paste seems to mess that up a bit.

Share this post


Link to post
Share on other sites
class Markers
	{
		items=19;
		class Item0
		{
			position[]={7550.6182,361.05222,8371.957};
			name="center";
			type="Empty";
		};
		class Item1
		{
			position[]={20386.512,0.16708441,-5038.5723};
			name="respawn_west";
			type="Empty";
		};
		class Item2
		{
			position[]={4932.3345,0.39950246,1989.1094};
			name="spawn0";
			type="Empty";
		};
		class Item3
		{
			position[]={2236.0391,0.63119155,1923.3735};
			name="spawn1";
			type="Empty";
		};
		class Item4
		{
			position[]={8738.1328,0.45720705,2122.1082};
			name="spawn2";
			type="Empty";
		};
		class Item5
		{
			position[]={10909.267,0.57597214,2422.3096};
			name="spawn3";
			type="Empty";
		};
		class Item6
		{
			position[]={13510.764,0.44504455,5249.3027};
			name="spawn4";
			type="Empty";
		};
		class Item7
		{
			position[]={4069.8455,365.19922,11661.84};
			name="Tradercitybash";
			text="Trader City Bash";
			type="mil_circle";
			colorName="ColorBlack";
		};
		class Item8
		{
			position[]={11469.787,317.32358,11356.751};
			name="Tradercityklen";
			text="Trader City Klen";
			type="mil_circle";
			colorName="ColorGreen";
		};
		class Item9
		{
			position[]={6345.6113,306.13721,7808.5073};
			name="Tradercitystary";
			text="Trader City Stary";
			type="mil_circle";
			colorName="ColorBlack";
		};
		class Item10
		{
			position[]={1146.8905,9.5063992,2676.7671};
			name="boatsnwholesale_1";
			text="Wholesaler";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item11
		{
			position[]={13247.175,7.9455967,6076.4395};
			name="boatsnwholesale_1_1";
			text="Wholesaler";
			type="mil_dot";
			colorName="ColorBlack";
		};
		class Item12
		{
			position[]={5068.6636,338.99176,9723.4248};
			name="Airplane Dealer";
			text="Airplane Dealer";
			type="mil_dot";
			colorName="ColorBlue";
		};
		class Item13
		{
			position[]={8385.834,1.6642252,2368.8264};
			name="Boat Dealer";
			text="Boat Dealer";
			type="mil_dot";
			colorName="ColorOrange";
		};
		class Item14
		{
			position[]={12945.273,209.10101,12751.496};
			name="HeroVendor";
			text="Hero Vendor";
			type="mil_dot";
			colorName="ColorBlue";
		};
		class Item15
		{
			position[]={13093.446,0.42457402,8241.5625};
			name="Boat Dealer_1";
			text="Boat Dealer";
			type="mil_dot";
			colorName="ColorOrange";
		};
		class Item16
		{
			position[]={1610.4834,283.97122,7781.9917};
			name="BanditVendor";
			text="Bandit Vendor";
			type="mil_dot";
			colorName="ColorRed";
		};
class Item17
		{
			position[]={ 3893.9448, 0, 11426.449};
                        name="Mine1";
                        text="Mining Node";
                        type="mil_circle";
                        colorName="ColorBlack";
		};
		class Item18
		{
			position[]={ 13273.093, 0, 6099.0747};
                        name="Mine2";
                        text="Mining Node";
                        type="mil_circle";
                        colorName="ColorBlack";
		};
	};

Share this post


Link to post
Share on other sites

i will look into creep and re upload

 

When tested it kicks out and says inventory full... the check is in the while loop... The issue is inventory is counted by the 12 magazine slots and the 8 lower magazine slots. So if your lower mag slots is full it will mine 12 ore and say full. HOWEVER if your lower inventory is empty it will mine 20 ore and put the 8 extra ore in buffer....

The problem is the loop itself in that case, it checks the inventory when first starting the loop, but as soon as its started you can mine forever

Share this post


Link to post
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

Sign in to follow this  

  • Advertisement
  • Donation Box

    Please donate to support the community.
    We appreciate all donations!
  • Advertisement
  • Supporters
  • Latest Donations

  • Advertisement
  • Discord

×