Mumbles 193 Posted August 6, 2013 Utility: Variant Mining As per xienne15's request: http://herc.ws/board/topic/1886-simple-mining/ Description: A simple mining system; allows for interacting players to excavate minerals by "mining" them with special equipment and tools. Minerals disappear and respawn randomly; chance is determined by configuration. Configuration is mostly done in arrays so that settings may be changed with no modifications to the script. Duplicate in additional locations as needed; update the value of '.var_amount' correspondingly. Download: https://github.com/datmumbles/Scripts/raw/master/util/mining.txt 7 Chemical Crush, Prourhildr, Shio and 4 others reacted to this Quote Share this post Link to post Share on other sites
Mumbles 193 Posted August 6, 2013 Update: Revised the algorithm to determine success rate. Please re-download the file for the newest version. Quote Share this post Link to post Share on other sites
Mumbles 193 Posted August 6, 2013 Update: Revised the algorithm to randomize debris. Please re-download the file for the newest version. Quote Share this post Link to post Share on other sites
quesoph 105 Posted August 6, 2013 Thanks. I will try this out. Quote Share this post Link to post Share on other sites
Mumbles 193 Posted August 6, 2013 (edited) Thanks. I will try this out. Sure thing; be sure to adjust the success rates to your liking - the original request asked for particularly low rates. The .success array takes values in comparison to fractions (ex. 3, 4 is the same as 3 / 4 or 75%). Thanks for trying it out! Edited August 6, 2013 by Via Quote Share this post Link to post Share on other sites
quesoph 105 Posted August 6, 2013 Suggestion: When mining, if you fail or succeed the mine would be gone and be relocated to a different area( x, y ).. Quote Share this post Link to post Share on other sites
REKT 10 Posted September 30, 2013 Suggestion: When mining, if you fail or succeed the mine would be gone and be relocated to a different area( x, y ).. Yes, second devotion. if this would be add in the feature it'll be interesting. Thank you!!! Quote Share this post Link to post Share on other sites
quesoph 105 Posted October 2, 2013 (edited) // Move Npcfunction script npcmove { while(1) { set .@x,rand(0,300); // 0 to 300 random x coordinate set .@y,rand(0,300); // 0 to 300 random y coordinate if( checkcell("pay_dun00", .@x, .@y, cell_chkpass)) break; // check if passable } movenpc "Variant Mineral#"+getarg(0), .@x, .@y; //Move NPC setnpcdisplay "Variant Mineral#"+getarg(0), 1907; // set the npc sprite end;}// Duplicates- script Variant#1 -1,{ doevent "mining::OnMine"; goto OnMove; // call mining script's OnMine label then move the npc OnInit: OnMove: callfunc ("npcmove",1); // call npc move to move the variant#1, number 1 is the #1 in the Variant#1. end;}- script Variant#2 -1,{ doevent "mining::OnMine"; goto OnMove; OnInit: OnMove: callfunc ("npcmove",2); // call npc move to move the variant#1, number 2 is the #2 in the Variant#2. end;}// dupes againpay_dun00,1,1,0 duplicate(Variant#1) Variant Mineral#1 1907pay_dun00,1,1,0 duplicate(Variant#2) Variant Mineral#2 1907 @edit But you need to add more if you want to have more minerals. Edited October 2, 2013 by quesoph Quote Share this post Link to post Share on other sites
REKT 10 Posted October 2, 2013 // Move Npcfunction script npcmove { while(1) { set .@x,rand(0,300); // 0 to 300 random x coordinate set .@y,rand(0,300); // 0 to 300 random y coordinate if( checkcell("pay_dun00", .@x, .@y, cell_chkpass)) break; // check if passable } movenpc "Variant Mineral#"+getarg(0), .@x, .@y; //Move NPC setnpcdisplay "Variant Mineral#"+getarg(0), 1907; // set the npc sprite end;}// Duplicates- script Variant#1 -1,{ doevent "mining::OnMine"; goto OnMove; // call mining script's OnMine label then move the npc OnInit: OnMove: callfunc ("npcmove",1); // call npc move to move the variant#1, number 1 is the #1 in the Variant#1. end;}- script Variant#2 -1,{ doevent "mining::OnMine"; goto OnMove; OnInit: OnMove: callfunc ("npcmove",2); // call npc move to move the variant#1, number 2 is the #2 in the Variant#2. end;}// dupes againpay_dun00,1,1,0 duplicate(Variant#1) Variant Mineral#1 1907pay_dun00,1,1,0 duplicate(Variant#2) Variant Mineral#2 1907 @edit But you need to add more if you want to have more minerals. Thanks for the quick respond, btw? where can i put that part of the script? it would be great if you could provide a whole script with that current add-on part. Thanks in Advance! Quote Share this post Link to post Share on other sites
quesoph 105 Posted October 3, 2013 (edited) /*=========================================================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); .@scatter = rand(1, .limit); for (.@i = 0; .@i < .@scatter; .@i++) { if (!rand(1)) .@random = rand(2) * -1; else .@random = rand(2); makeitem .debris, 1, .@m$, .@x + .@random, .@y + .@random; } // 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], 1010, 1011, 984, 985; // Phracon, Emveretarcon, Oridecon, Elunium setarray .amount[0], 5, 3, 1, 1; // Amount to mine // Success rate: (x / y)% chance setarray .success[0], 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 = 5; // Audio/visual effects .sound$ = "chepet_attack.wav"; .effect = 4; // Debris .debris = 7049; // Stone .limit = 5; // Scatter limit end; }// Move Npcfunction script npcmove { while(1) { set .@x,rand(0,300); // 0 to 300 random x coordinate set .@y,rand(0,300); // 0 to 300 random y coordinate if( checkcell("pay_dun00", .@x, .@y, cell_chkpass)) break; // check if passable } movenpc "Variant Mineral#"+getarg(0), .@x, .@y; //Move NPC setnpcdisplay "Variant Mineral#"+getarg(0), 1907; // set the npc sprite end;}// Duplicates- script Variant#1 -1,{ doevent "mining::OnMine"; goto OnMove; // call mining script's OnMine label then move the npc OnInit: OnMove: callfunc ("npcmove",1); // call npc move to move the variant#1, number 1 is the #1 in the Variant#1. end;}- script Variant#2 -1,{ doevent "mining::OnMine"; goto OnMove; OnInit: OnMove: callfunc ("npcmove",2); // call npc move to move the variant#1, number 2 is the #2 in the Variant#2. end;}// dupes againpay_dun00,1,1,0 duplicate(Variant#1) Variant Mineral#1 1907pay_dun00,1,1,0 duplicate(Variant#2) Variant Mineral#2 1907 Edited October 3, 2013 by quesoph Quote Share this post Link to post Share on other sites
Mumbles 193 Posted January 21, 2014 Updates: 2.0 - Optimised for Hercules emulators. 2.1 - Updated algorithms. 2.2 - Added randomised disappearing and respawning. Please see first post for download link. 1 evilpuncker reacted to this Quote Share this post Link to post Share on other sites
Color Picker 0 Posted October 28, 2014 [Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: variable name='Phracon'[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Phracon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0 I got errors from that scripts..? Quote Share this post Link to post Share on other sites
Mumbles 193 Posted October 28, 2014 [Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: variable name='Phracon'[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Phracon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0 I got errors from that scripts..? This will not work with *Athena emulators until they add compatibility for item constants (in place of IDs); this script is optimised for Hercules emulators only.1 1If you are using Hercules, please update your emulator. Quote Share this post Link to post Share on other sites
Color Picker 0 Posted October 28, 2014 (edited) [Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#10 at pay_dun00 (86,139)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: variable name='Phracon'[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Phracon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: variable name='Emveretarcon'[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Emveretarcon', defaulting to 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: variable name='Oridecon'[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Oridecon', defaultingto 0[Error]: script_rid2sd: fatal error ! player not attached![Debug]: Function: setarray (9 parameters):[Debug]: Data: variable name='.mineral' index=0[Debug]: Data: number value=0[Debug]: Data: number value=5[Debug]: Data: number value=0[Debug]: Data: number value=3[Debug]: Data: number value=0[Debug]: Data: number value=1[Debug]: Data: variable name='Elunium'[Debug]: Data: number value=1[Debug]: Source (NPC): Variant Mineral#20 at pay_dun00 (35,54)[Warning]: script:get_val: cannot access player variable 'Elunium', defaulting to 0 I got errors from that scripts..? This will not work with *Athena emulators until they add compatibility for item constants (in place of IDs); this script is optimised for Hercules emulators only.1 1If you are using Hercules, please update your emulator. I already solved it, thanks It's really nice scripts to share, btw is there a chance of adding a random spawn on a map after progressbar has been finish? Edited October 28, 2014 by dagiccross Quote Share this post Link to post Share on other sites
Mumbles 193 Posted October 31, 2014 I already solved it, thanks It's really nice scripts to share, btw is there a chance of adding a random spawn on a map after progressbar has been finish? You can use the monster command after the line containing the progressbar command. Quote Share this post Link to post Share on other sites
mrpatrick 0 Posted November 14, 2014 Cool plugin. I loved it! This one is simpler that Myzter's mining game.My only concern is that for example I put 10/10 on the success chance, should it be 100%? My problem is that its still not 100% chance of success even though I put those values. I also tried 100/100 but still same result.Am I missing something? Quote Share this post Link to post Share on other sites
REKT 10 Posted May 29, 2015 (edited) @@Mumbles is it possible to add arrays for Normal Drops and Rare Drops.. And also for the success rate, for Normal drop and Rare Drops can be set also. Can you do it? Thanks in advance! Edited May 29, 2015 by Vlync Quote Share this post Link to post Share on other sites
mrlongshen 22 Posted October 8, 2015 @@Mumbles Thanks alot. Can you make a constant mining. So player can keep mining and get item ? Quote Share this post Link to post Share on other sites
JoyRo 5 Posted April 23, 2016 How can i add a item and give it like 0.5% drop chance Quote Share this post Link to post Share on other sites
InFiNiTe 0 Posted September 16, 2016 % of succes is not working properly, even if you set something like 4/4 that means 100%... Quote Share this post Link to post Share on other sites
Chellevin 0 Posted October 8, 2016 Guys you have script of mining like in rebirth ro?? Quote Share this post Link to post Share on other sites
mrlongshen 22 Posted October 9, 2016 Guys you have script of mining like in rebirth ro?? its a paid script. Quote Share this post Link to post Share on other sites
Chellevin 0 Posted October 9, 2016 how much for that kind of script? Quote Share this post Link to post Share on other sites