mrlongshen 22 Posted October 8, 2015 /*=========================================================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. Quote Share this post Link to post Share on other sites
0 Litro 45 Posted October 18, 2015 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 /*=========================================================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,{ 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 1 mrlongshen reacted to this Quote Share this post Link to post Share on other sites
0 mrlongshen 22 Posted October 18, 2015 (edited) @@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 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? Edited October 18, 2015 by mrlongshen Quote Share this post Link to post Share on other sites
0 Litro 45 Posted October 19, 2015 @@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 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 /*=========================================================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,{ 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 1 mrlongshen reacted to this Quote Share this post Link to post Share on other sites
0 mrlongshen 22 Posted October 19, 2015 @@Litro Thanks alot !! that so cool. Haha ! Quote Share this post Link to post Share on other sites
0 Litro 45 Posted October 19, 2015 glad it help Quote Share this post Link to post Share on other sites
0 mrlongshen 22 Posted October 23, 2015 @@Litro my player are like farming gold on there .hahahahaha Quote Share this post Link to post Share on other sites
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.
Share this post
Link to post
Share on other sites