One click mining constant

mrlongshen

Noobies
Messages
1,126
Points
0
Age
36
Location
localhost 127.0.0.1
Emulator
/*=========================================================Variant Miningby Glitch [Via]===========================================================Request: http://herc.ws/board/topic/1886-simple-mining/===========================================================Description:A simple mining system; allows for interacting players toexcavate minerals by "mining" them with special equipmentand tools.Configuration is done in arrays so that settings may bechanged with no modifications to the script. Keep in mindthat each array value is respective to their commented set.Duplicate in additional locations as needed.=========================================================*/pay_dun00,54,147,0 script Variant Mineral#1::mining 1907,{ // Check equipment for (.@i = 0; .@i < getarraysize(.equip); .@i++) { if (!isequipped(.equip[.@i])) { message strcharinfo(0), "You need to have '"+ getitemname(.equip[.@i]) +"' equipped to mine!"; .@unequipped++; } } // Show count of equipment not worn if (.@unequipped) { message strcharinfo(0), .@unequipped +" of "+ getarraysize(.equip) +" equipment has not been worn."; end; } // Check tools for (.@i = 0; .@i < getarraysize(.tool); .@i++) { if (countitem(.tool[.@i]) < .inventory[.@i]) { message strcharinfo(0), "You need to bring "+ .inventory[.@i] +" "+ getitemname(.tool[.@i]) +" to mine!"; .@gearless++; } } // Show count of tools not in inventory if (.@gearless) { if (getarraysize(.tool) > 1) .@grammar$ = "tools were"; else .@grammar$ = "tool was"; message strcharinfo(0), .@gearless +" of "+ getarraysize(.tool) +" "+ .@grammar$ +" not brought."; end; } // Progress message strcharinfo(0), "Mining in progress..."; progressbar "green", .progress; // Delete tools for (.@i = 0; .@i < getarraysize(.tool); .@i++) delitem .tool[.@i], .inventory[.@i]; // Audio/visual effects soundeffect .sound$, 0; specialeffect .effect; // Drop random debris getmapxy(.@m$, .@x, .@y, 0); makeitem .debris, .scatter, .@m$, .@x + rand(2), .@y + rand(1,2); // Randomize target mineral to mine .@target = rand(getarraysize(.mineral)); // Max range of success .@range = .success[.@target * 2 + 1]; // Check if failed if(rand(1, .@range) != .success[.@target * 2]) { message strcharinfo(0), "Nothing valuable was excavated..."; end; } // Get mineral(s) getitem .mineral[.@target], .amount[.@target]; message strcharinfo(0), "You have successfully mined "+ .amount[.@target] +" "+ getitemname(.mineral[.@target]) +"!"; end; OnWhisperGlobal: // Whisper anything to initialize settings message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized."; OnInit: // Minerals setarray .mineral[0], 985, 984, 6224, 6223; // Jejelopy, Elunium, Oridecon, Bradium, Cranium setarray .amount[0], 1, 1, 1, 1; // Amount to mine // Success rate: (x / y)% chance setarray .success[0], 1, 2, // 50% for Elunium 1, 2, // 50% for Oridecon 1, 4, // 25% Bradium 1, 4; // 25% Cranium //Example of calculation //1, 5, // 1/5 (20%) //1, 2, // 1/2 (50%) //4, 5, // 4/5 (80%) //1, 50; // 1/50 (2%) // Equipment setarray .equip[0], 5009, 2218; // Safety Helmet, Flu Mask // Tools setarray .tool[0], 7318, 7327; // Old Pick, Flashlight setarray .inventory[0], 1, 1; // Amount per tool // Mining time (in seconds) .progress = 1; // Audio/visual effects .sound$ = "chepet_attack.wav"; .effect = 4; // Debris .debris = 7049; // Stone .scatter = 5; // Debris amount end; }// Duplicatespay_dun00,55,147,0 duplicate(mining) Variant Mineral#2 1907pay_dun00,53,146,0 duplicate(mining) Variant Mineral#3 1907pay_dun00,53,145,0 duplicate(mining) Variant Mineral#4 1907pay_dun00,69,148,0 duplicate(mining) Variant Mineral#5 1907pay_dun00,70,147,0 duplicate(mining) Variant Mineral#6 1907pay_dun00,70,146,0 duplicate(mining) Variant Mineral#7 1907
can someone edit when player click the mining, the character will stay mining instead of click many times.

I want to make a farming mining .thanks you.

 
try this, the part I added: while (1) from checking tools until the last proccess of mining and disable_items; in after the npc header

Code:
/*=========================================================Variant Miningby Glitch [Via]===========================================================Request: [URL="https://boardtest.herc.ws/topic/1886-simple-mining/===========================================================Description:A"]http://herc.ws/board/topic/1886-simple-mining/===========================================================Description:A[/URL] simple mining system; allows for interacting players toexcavate minerals by "mining" them with special equipmentand tools.Configuration is done in arrays so that settings may bechanged with no modifications to the script. Keep in mindthat each array value is respective to their commented set.Duplicate in additional locations as needed.=========================================================*/pay_dun00,54,147,0	script	Variant Mineral#1::mining	1907,{		disable_items;	// Check equipment	for (.@i = 0; .@i < getarraysize(.equip); .@i++)	{		if (!isequipped(.equip[.@i]))		{			message strcharinfo(0), "You need to have '"+ getitemname(.equip[.@i]) +"' equipped to mine!";			.@unequipped++;		}	}		// Show count of equipment not worn	if (.@unequipped)	{		message strcharinfo(0), .@unequipped +" of "+ getarraysize(.equip) +" equipment has not been worn.";		end;	}		while(1) {		// Check tools		for (.@i = 0; .@i < getarraysize(.tool); .@i++)		{			if (countitem(.tool[.@i]) < .inventory[.@i])			{				message strcharinfo(0), "You need to bring "+ .inventory[.@i] +" "+ getitemname(.tool[.@i]) +" to mine!";				.@gearless++;			}		}				// Show count of tools not in inventory		if (.@gearless)		{			if (getarraysize(.tool) > 1)				.@grammar$ = "tools were";			else				.@grammar$ = "tool was";					message strcharinfo(0), .@gearless +" of "+ getarraysize(.tool) +" "+ .@grammar$ +" not brought.";			end;		}				// Progress		message strcharinfo(0), "Mining in progress...";		progressbar "green", .progress;				// Delete tools		for (.@i = 0; .@i < getarraysize(.tool); .@i++)			delitem .tool[.@i], .inventory[.@i];				// Audio/visual effects		soundeffect .sound$, 0;		specialeffect .effect;				// Drop random debris		getmapxy(.@m$, .@x, .@y, 0);		makeitem .debris, .scatter, .@m$, .@x + rand(2), .@y + rand(1,2);				// Randomize target mineral to mine		.@target = rand(getarraysize(.mineral));				// Max range of success		.@range = .success[.@target * 2 + 1];				// Check if failed		if(rand(1, .@range) != .success[.@target * 2])		{			message strcharinfo(0), "Nothing valuable was excavated...";			end;		}				// Get mineral(s)		getitem .mineral[.@target], .amount[.@target];		message strcharinfo(0), "You have successfully mined "+ .amount[.@target] +" "+ getitemname(.mineral[.@target]) +"!";	}	end;		OnWhisperGlobal:		// Whisper anything to initialize settings		message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";			OnInit:		// Minerals		setarray .mineral[0], 985, 984, 6224,  6223;	// Jejelopy, Elunium, Oridecon, Bradium, Cranium		setarray .amount[0],	1,	1,    1,     1;	// Amount to mine				// Success rate: (x / y)% chance		setarray .success[0],		1, 2, // 50% for Elunium		1, 2, // 50% for Oridecon		1, 4, // 25% Bradium		1, 4; // 25% Cranium				//Example of calculation		//1, 5,	// 1/5 (20%)		//1, 2,	// 1/2 (50%)		//4, 5,	// 4/5 (80%)		//1, 50;	// 1/50 (2%)				// Equipment		setarray .equip[0], 5009, 2218;	// Safety Helmet, Flu Mask				// Tools		setarray .tool[0],		7318, 7327;	// Old Pick, Flashlight		setarray .inventory[0],	   1,	 1;	// Amount per tool				// Mining time (in seconds)		.progress = 1;				// Audio/visual effects		.sound$ = "chepet_attack.wav";		.effect = 4;				// Debris		.debris = 7049;	// Stone		.scatter = 5;	// Debris amount		end;	}// Duplicatespay_dun00,55,147,0	duplicate(mining)	Variant Mineral#2	1907pay_dun00,53,146,0	duplicate(mining)	Variant Mineral#3	1907pay_dun00,53,145,0	duplicate(mining)	Variant Mineral#4	1907pay_dun00,69,148,0	duplicate(mining)	Variant Mineral#5	1907pay_dun00,70,147,0	duplicate(mining)	Variant Mineral#6	1907pay_dun00,70,146,0	duplicate(mining)	Variant Mineral#7	1907
 
@@Litro

Thanks it working. But I have to make the item success become 100%

If the player not get the item, the mining will stop. I have test, and the miner wont stop until the item brought finish hahaha !! I need to relog. keh keh keh 
default_biggrin.png


By the way, can you help me in making a simple script for example

Player A wear the flu mask, then the item will reduce the progress bar time?

 
Last edited by a moderator:
@@Litro

Thanks it working. But I have to make the item success become 100%

If the player not get the item, the mining will stop. I have test, and the miner wont stop until the item brought finish hahaha !! I need to relog. keh keh keh 
default_biggrin.png


By the way, can you help me in making a simple script for example

Player A wear the flu mask, then the item will reduce the progress bar time?
now mining will only stop when the miner exhausted his mining tools supply, when the miner get nothing the mining process will not be stopped any more and you can set success rate again

i have integrate the progress bar reduce time in the script below, look at the comment and make sure you put it right

Code:
/*=========================================================Variant Miningby Glitch [Via]===========================================================Request: [URL="https://boardtest.herc.ws/topic/1886-simple-mining/===========================================================Description:A"]http://herc.ws/board/topic/1886-simple-mining/===========================================================Description:A[/URL] simple mining system; allows for interacting players toexcavate minerals by "mining" them with special equipmentand tools.Configuration is done in arrays so that settings may bechanged with no modifications to the script. Keep in mindthat each array value is respective to their commented set.Duplicate in additional locations as needed.=========================================================*/pay_dun00,54,147,0	script	Variant Mineral#1::mining	1907,{		disable_items;	.@progress = .progress;	// Check equipment	for (.@i = 0; .@i < getarraysize(.equip); .@i++) {		if (!isequipped(.equip[.@i])) {			message strcharinfo(0), "You need to have '"+ getitemname(.equip[.@i]) +"' equipped to mine!";			.@unequipped++;		} else			.@progress -= .e_cast[.@i];	}		// Show count of equipment not worn	if (.@unequipped) {		message strcharinfo(0), .@unequipped +" of "+ getarraysize(.equip) +" equipment has not been worn.";		end;	}		while(1) {		// Check tools		for (.@i = 0; .@i < getarraysize(.tool); .@i++) {			if (countitem(.tool[.@i]) < .inventory[.@i]) {				message strcharinfo(0), "You need to bring "+ .inventory[.@i] +" "+ getitemname(.tool[.@i]) +" to mine!";				.@gearless++;			}		}				// Show count of tools not in inventory		if (.@gearless) {			.@grammar$ = ((getarraysize(.tool) > 1) ? "tools were" : "tool was");			message strcharinfo(0), .@gearless +" of "+ getarraysize(.tool) +" "+ .@grammar$ +" not brought.";			end;		}				// Progress		message strcharinfo(0), "Mining in progress...";		progressbar "green", .@progress;				// Delete tools		for (.@i = 0; .@i < getarraysize(.tool); .@i++)			delitem .tool[.@i], .inventory[.@i];				// Audio/visual effects		soundeffect .sound$, 0;		specialeffect .effect;				// Drop random debris		getmapxy(.@m$, .@x, .@y, 0);		makeitem .debris, .scatter, .@m$, .@x + rand(2), .@y + rand(1,2);				// Randomize target mineral to mine		.@target = rand(getarraysize(.mineral));				// Max range of success		.@range = .success[.@target * 2 + 1];				// Check if failed		if(rand(1, .@range) != .success[.@target * 2]) {			message strcharinfo(0), "Nothing valuable was excavated...";		// Get mineral(s)		} else {			getitem .mineral[.@target], .amount[.@target];			message strcharinfo(0), "You have successfully mined "+ .amount[.@target] +" "+ getitemname(.mineral[.@target]) +"!";		}	}	end;		OnWhisperGlobal:		// Whisper anything to initialize settings		message strcharinfo(0), strnpcinfo(1) +" : 'OnInit' label has been intialized.";			OnInit:		// Minerals		setarray .mineral[0], 985, 984, 6224,  6223;	// Jejelopy, Elunium, Oridecon, Bradium, Cranium		setarray .amount[0],	1,	1,    1,     1;	// Amount to mine				// Success rate: (x / y)% chance		setarray .success[0],		1, 2, // 50% for Elunium		1, 2, // 50% for Oridecon		1, 4, // 25% Bradium		1, 4; // 25% Cranium				//Example of calculation		//1, 5,	// 1/5 (20%)		//1, 2,	// 1/2 (50%)		//4, 5,	// 4/5 (80%)		//1, 50;	// 1/50 (2%)				// Mining time (in seconds) - .progress need to be greater than from total .e_cast!!		.progress = 3;				// Equipment		setarray .equip[0], 5009, 2218;	// Safety Helmet, Flu Mask		setarray .e_cast[0],   1,    1; // Progress bar reduce time. - .e_cast need to be smaller from total .progress!!				// Tools		setarray .tool[0],		7318, 7327;	// Old Pick, Flashlight		setarray .inventory[0],	   1,	 1;	// Amount per tool				// Audio/visual effects		.sound$ = "chepet_attack.wav";		.effect = 4;				// Debris		.debris = 7049;	// Stone		.scatter = 5;	// Debris amount		end;	}// Duplicatespay_dun00,55,147,0	duplicate(mining)	Variant Mineral#2	1907pay_dun00,53,146,0	duplicate(mining)	Variant Mineral#3	1907pay_dun00,53,145,0	duplicate(mining)	Variant Mineral#4	1907pay_dun00,69,148,0	duplicate(mining)	Variant Mineral#5	1907pay_dun00,70,147,0	duplicate(mining)	Variant Mineral#6	1907pay_dun00,70,146,0	duplicate(mining)	Variant Mineral#7	1907
 
Back
Top