jamesandrew Posted September 4, 2023 Group: Members Topic Count: 23 Topics Per Day: 0.03 Content Count: 60 Reputation: 3 Joined: 06/21/23 Last Seen: March 4 Share Posted September 4, 2023 My mining gameplay. Character is just standing there waiting on progress bar until finish. HackGU 2023-09-05 00-18-45.mp4 I want my character to move/doing basic attacks to the nodes like this one in the video, without a fancy progress bar ofc. Spoiler /*========================================================= Variant Mining by Mumbles =========================================================== Idea: http://goo.gl/ndXr6R =========================================================== 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. =========================================================== Compatibility: Optimised for Hercules emulators. =========================================================== Changelog: v1.0 - First version. v1.0.1 - Fixed issue with success algorithm. v1.0.2 - Added randomised debris. v1.0.3 - Added additional locations in Payon Cave. v2.0 - Optimised for Hercules emulators. v2.0.1 - Updated algorithms. v2.0.2 - Added randomised disappearing and respawning. v2.0.3 - Updated version format. =========================================================*/ - script Variant Mineral#0::mining S_EMPEL_1,{ /*----------------------------------------------------- Script -----------------------------------------------------*/ // 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 += 2) { if (countitem(.tool[.@i]) < .tool[.@i + 1]) { message strcharinfo(0), "You need to bring "+ .tool[.@i + 1] +" "+ 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) +" "+" not brought."; //message strcharinfo(0), .@unequipped +" of "+ getarraysize(.equip) +" equipment has not been worn."; message strcharinfo(0), .@gearless +" of tools not brought."; end; } // Progress message strcharinfo(0), "Mining in progress..."; progressbar "green", .progress; // Delete tools for (.@i = 0; .@i < getarraysize(.tool); .@i += 2) { delitem .tool[.@i], .tool[.@i + 1]; } // Audio/visual effects soundeffect .sound$, 0; specialeffect .effect; // Drop random debris getmapxy(.@map$, .@x, .@y); .@scatter = rand(1, .limit); for (.@i = 0; .@i < .@scatter; .@i++) { .@random = rand(2) * (!rand(1) ? -1 : 1); makeitem .debris, 1, .@map$, .@x + .@random, .@y + .@random; } // Randomize target mineral to mine do { .@target = rand(getarraysize(.mineral)); } while (.@target % 2); // Max range of success .@range = .success[.@target + 1]; // Check if failed if (rand(1, .@range) != .success[.@target]) { message strcharinfo(0), "Nothing valuable was excavated..."; } else { // Get mineral(s) getitem .mineral[.@target], .mineral[.@target + 1]; //getitem .mineral,.mineral[.@target + 1]; message strcharinfo(0), "You have successfully mined "+ .mineral[.@target + 1] +" "+ getitemname(.mineral[.@target]) +"!"; } // Hide mineral if (!rand(.hide_chance)) { hideonnpc strnpcinfo(3); } end; /*----------------------------------------------------- Timer -----------------------------------------------------*/ OnMinute00: // Respawn minerals if (gettime(3) % .respawn_rate) { for (.@i = 1; .@i <= .var_amount; .@i++) { if (!rand(.respawn_chance)) { hideoffnpc strnpcinfo(1) +"#"+ .@i; } } } end; /*----------------------------------------------------- Configuration -----------------------------------------------------*/ OnInit: // Minerals (constant/ID, amount) setarray .mineral[0], 1010,5, 1011,3, 984,1, 985,1; // Success rate: (x / y)% chance setarray .@success[0], 4, 10, // 4/10 (40%) 3, 10, // 3/10 (30%) 1, 25, // 1/25 (4%) 1, 50; // 1/50 (2%) // Equipment (constant/ID) setarray .equip[0], 5009, 2218; // Tools (constant/ID, amount) setarray .tool[0], 7318, 1, 7327, 1; // Mining time (in seconds) .progress = 5; // Audio/visual effects .sound$ = "chepet_attack.wav"; .effect = EF_HIT5; // Debris .debris = 7049; // Stone .limit = 5; // Scatter limit // Hiding and Respawning .var_amount = 44; // Amount of Variant Minerals .hide_chance = 4; // Chance in x to hide (default: 4 [25%]) .respawn_chance = 2; // Chance in x to respawn (default: 2 [50%]) .respawn_rate = 1; // Every x hours (max: 12) end; } /*----------------------------------------------------- Duplicates -----------------------------------------------------*/ pay_dun00,54,147,0 duplicate(mining) Variant Mineral#1 S_EMPEL_1 pay_dun00,55,147,0 duplicate(mining) Variant Mineral#2 S_EMPEL_1 pay_dun00,53,146,0 duplicate(mining) Variant Mineral#3 S_EMPEL_2 pay_dun00,53,145,0 duplicate(mining) Variant Mineral#4 S_EMPEL_1 pay_dun00,69,148,0 duplicate(mining) Variant Mineral#5 S_EMPEL_2 pay_dun00,70,147,0 duplicate(mining) Variant Mineral#6 S_EMPEL_1 pay_dun00,70,146,0 duplicate(mining) Variant Mineral#7 S_EMPEL_1 pay_dun00,84,140,0 duplicate(mining) Variant Mineral#8 S_EMPEL_1 pay_dun00,85,140,0 duplicate(mining) Variant Mineral#9 S_EMPEL_2 pay_dun00,86,139,0 duplicate(mining) Variant Mineral#10 S_EMPEL_1 pay_dun00,83,126,0 duplicate(mining) Variant Mineral#11 S_EMPEL_1 pay_dun00,60,125,0 duplicate(mining) Variant Mineral#12 S_EMPEL_2 pay_dun00,46,124,0 duplicate(mining) Variant Mineral#13 S_EMPEL_1 pay_dun00,45,123,0 duplicate(mining) Variant Mineral#14 S_EMPEL_2 pay_dun00,53,117,0 duplicate(mining) Variant Mineral#15 S_EMPEL_1 pay_dun00,53,118,0 duplicate(mining) Variant Mineral#16 S_EMPEL_2 pay_dun00,44,109,0 duplicate(mining) Variant Mineral#17 S_EMPEL_2 pay_dun00,50,69,0 duplicate(mining) Variant Mineral#18 S_EMPEL_1 pay_dun00,51,70,0 duplicate(mining) Variant Mineral#19 S_EMPEL_2 pay_dun00,35,54,0 duplicate(mining) Variant Mineral#20 S_EMPEL_1 pay_dun00,75,84,0 duplicate(mining) Variant Mineral#21 S_EMPEL_1 pay_dun00,75,85,0 duplicate(mining) Variant Mineral#22 S_EMPEL_1 pay_dun00,76,86,0 duplicate(mining) Variant Mineral#23 S_EMPEL_2 pay_dun00,123,100,0 duplicate(mining) Variant Mineral#24 S_EMPEL_2 pay_dun00,123,101,0 duplicate(mining) Variant Mineral#25 S_EMPEL_2 pay_dun00,124,102,0 duplicate(mining) Variant Mineral#26 S_EMPEL_2 pay_dun00,131,157,0 duplicate(mining) Variant Mineral#27 S_EMPEL_1 pay_dun00,132,158,0 duplicate(mining) Variant Mineral#28 S_EMPEL_2 pay_dun00,139,164,0 duplicate(mining) Variant Mineral#29 S_EMPEL_2 pay_dun00,139,165,0 duplicate(mining) Variant Mineral#30 S_EMPEL_1 pay_dun00,140,166,0 duplicate(mining) Variant Mineral#31 S_EMPEL_1 pay_dun00,141,166,0 duplicate(mining) Variant Mineral#32 S_EMPEL_2 pay_dun00,147,171,0 duplicate(mining) Variant Mineral#33 S_EMPEL_1 pay_dun00,147,172,0 duplicate(mining) Variant Mineral#34 S_EMPEL_2 pay_dun00,147,173,0 duplicate(mining) Variant Mineral#35 S_EMPEL_1 pay_dun00,148,174,0 duplicate(mining) Variant Mineral#36 S_EMPEL_2 pay_dun00,149,174,0 duplicate(mining) Variant Mineral#37 S_EMPEL_1 pay_dun00,154,174,0 duplicate(mining) Variant Mineral#38 S_EMPEL_1 pay_dun00,155,174,0 duplicate(mining) Variant Mineral#39 S_EMPEL_2 pay_dun00,156,173,0 duplicate(mining) Variant Mineral#40 S_EMPEL_1 pay_dun00,156,172,0 duplicate(mining) Variant Mineral#41 S_EMPEL_2 pay_dun00,156,171,0 duplicate(mining) Variant Mineral#42 S_EMPEL_2 pay_dun00,156,170,0 duplicate(mining) Variant Mineral#43 S_EMPEL_1 pay_dun00,156,169,0 duplicate(mining) Variant Mineral#44 S_EMPEL_2 Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted September 4, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted September 4, 2023 The easiest way would be to create a custom mob that looks like a mineral. You could for example copy Purple Ore (id: 3742) and add the items you want the player to get by mining as drop. You just need to remember to add your custom mob to mob_avail,yml to tell rathena to make the client use the sprite of the original mob for your custom one. 1 Quote Link to comment Share on other sites More sharing options...
0 jamesandrew Posted September 5, 2023 Group: Members Topic Count: 23 Topics Per Day: 0.03 Content Count: 60 Reputation: 3 Joined: 06/21/23 Last Seen: March 4 Author Share Posted September 5, 2023 8 hours ago, Winterfox said: The easiest way would be to create a custom mob that looks like a mineral. You could for example copy Purple Ore (id: 3742) and add the items you want the player to get by mining as drop. You just need to remember to add your custom mob to mob_avail,yml to tell rathena to make the client use the sprite of the original mob for your custom one. HackGU 2023-09-05 13-24-05.mp4 Hi thanks for the idea. It does work like what you said. But the problem is there's no gear check, no class check and aspd check. Since it's work like a normal mob. Now how about this, is there a way to prevent characters attacking a specific mob if they don't pass the requirements? Like... They must be level 30 minimum and equip a knife. Thanks Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted September 5, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted September 5, 2023 (edited) You could attach the checks on a label that gets triggered when the mob that represents an ore gets killed. Here is a small example: - script MINING FAKE_NPC,{ OnInit: // Config setarray(.mining_utils, 28116); setarray(.minerals, 3742, 3743, 1083); .mineral_0_name$ = "Bronze"; setarray(.mineral_0_maps$, "prontera"); setarray(.mineral_0_amounts, 10); setarray(.mineral_0_areas_x_1, 150); setarray(.mineral_0_areas_x_2, 163); setarray(.mineral_0_areas_y_1, 175); setarray(.mineral_0_areas_y_2, 137); setarray(.mineral_0_items, 502, 10, 1, 5, 503, 40, 1, 5, 504, 50, 1, 5); .mineral_1_name$ = "Silver"; setarray(.mineral_1_maps$, "prontera"); setarray(.mineral_1_amounts, 10); setarray(.mineral_1_areas_x_1, 150); setarray(.mineral_1_areas_x_2, 163); setarray(.mineral_1_areas_y_1, 150); setarray(.mineral_1_areas_y_2, 200); setarray(.mineral_1_items, 505, 10, 1, 5, 506, 40, 1, 5, 507, 50, 1, 5); .mineral_2_name$ = "Gold"; setarray(.mineral_2_maps$, "prontera"); setarray(.mineral_2_amounts, 10); setarray(.mineral_2_areas_x_1, 150); setarray(.mineral_2_areas_x_2, 163); setarray(.mineral_2_areas_y_1, 175); setarray(.mineral_2_areas_y_2, 137); setarray(.mineral_2_items, 508, 10, 1, 5, 509, 40, 1, 5, 510, 50, 1, 5); // Config End for(.@i = 0; .@i < getarraysize(.minerals); .@i++) { .@name$ = getd(".mineral_" + .@i + "_name$"); .@items = getd(".mineral_" + .@i + "_items"); .@items_size = getarraysize(getd(".mineral_" + .@i + "_items")); .@item_sum = 0; for(.@x = 0; .@x < .@items_size; .@x += 4) .@item_sum += getd(".mineral_" + .@i + "_items[" + (.@x + 1) + "]"); setd(".mineral_" + .@i + "_item_sum", .@item_sum); .@maps_size = getarraysize(getd(".mineral_" + .@i + "_maps$")); for(.@y = 0; .@y < .@maps_size; .@y++) { .@maps$ = getd(".mineral_" + .@i + "_maps$[" + .@y + "]"); .@amounts = getd(".mineral_" + .@i + "_amounts[" + .@y + "]"); .@areas_x_1 = getd(".mineral_" + .@i + "_areas_x_1[" + .@y + "]"); .@areas_x_2 = getd(".mineral_" + .@i + "_areas_x_2[" + .@y + "]"); .@areas_y_1 = getd(".mineral_" + .@i + "_areas_y_1[" + .@y + "]"); .@areas_y_2 = getd(".mineral_" + .@i + "_areas_y_2[" + .@y + "]"); areamonster(.@maps$, .@areas_x_1, .@areas_x_2, .@areas_y_1, .@areas_y_2, .@name$, .minerals[.@i], .@amounts, "MINING::OnMined"); } } end; OnMined: .@mineral = inarray(.minerals, killedrid); .@mineral_name$ = getd(".mineral_" + .@mineral + "_name$"); .@util = getequipid(EQI_HAND_R); if(inarray(.mining_utils, .@util) == -1) { dispbottom("Using your " + getitemname(.@util) + " destroyed any useful resource from " + .@mineral_name$ + "."); end; } .@mineral_item_sum = getd(".mineral_" + .@mineral + "_item_sum"); .@mineral_items_size = getarraysize(getd(".mineral_" + .@i + "_items")); .@pick = rand(1, .@mineral_item_sum); for(.@i = 0; .@i < .@mineral_items_size; .@i += 4) { .@pick -= getd(".mineral_" + .@mineral + "_items[" + (.@i + 1) + "]"); if(.@pick <= 0) break; } .@item = getd(".mineral_" + .@mineral + "_items[" + .@i + "]"); .@item_min_amount = getd(".mineral_" + .@mineral + "_items[" + (.@i + 2) + "]"); .@item_max_amount = getd(".mineral_" + .@mineral + "_items[" + (.@i + 3) + "]"); getitem(.@item, rand(.@item_min_amount, .@item_max_amount)); } This will spawn different minerals (in this example represented by purple ore and plants), which give different items on kill etc. once a mineral gets killed, it checks if an item from the .mining_utils array is equipped and if not gives the player the message, that using the wrong item destroyed any useful resources otherwise it will roll which and how many of an item the player gets. Edited September 5, 2023 by Winterfox 1 Quote Link to comment Share on other sites More sharing options...
0 jamesandrew Posted September 5, 2023 Group: Members Topic Count: 23 Topics Per Day: 0.03 Content Count: 60 Reputation: 3 Joined: 06/21/23 Last Seen: March 4 Author Share Posted September 5, 2023 (edited) 2 hours ago, Winterfox said: You could attach the checks on a label that gets triggered when the mob that represents an ore gets killed. Here is a small example: - script MINING FAKE_NPC,{ OnInit: // Config setarray(.mining_utils, 28116); setarray(.minerals, 3742, 3743, 1083); .mineral_0_name$ = "Bronze"; setarray(.mineral_0_maps$, "prontera"); setarray(.mineral_0_amounts, 10); setarray(.mineral_0_areas_x_1, 150); setarray(.mineral_0_areas_x_2, 163); setarray(.mineral_0_areas_y_1, 175); setarray(.mineral_0_areas_y_2, 137); setarray(.mineral_0_items, 502, 10, 1, 5, 503, 40, 1, 5, 504, 50, 1, 5); .mineral_1_name$ = "Silver"; setarray(.mineral_1_maps$, "prontera"); setarray(.mineral_1_amounts, 10); setarray(.mineral_1_areas_x_1, 150); setarray(.mineral_1_areas_x_2, 163); setarray(.mineral_1_areas_y_1, 150); setarray(.mineral_1_areas_y_2, 200); setarray(.mineral_1_items, 505, 10, 1, 5, 506, 40, 1, 5, 507, 50, 1, 5); .mineral_2_name$ = "Gold"; setarray(.mineral_2_maps$, "prontera"); setarray(.mineral_2_amounts, 10); setarray(.mineral_2_areas_x_1, 150); setarray(.mineral_2_areas_x_2, 163); setarray(.mineral_2_areas_y_1, 175); setarray(.mineral_2_areas_y_2, 137); setarray(.mineral_2_items, 508, 10, 1, 5, 509, 40, 1, 5, 510, 50, 1, 5); // Config End for(.@i = 0; .@i < getarraysize(.minerals); .@i++) { .@name$ = getd(".mineral_" + .@i + "_name$"); .@items = getd(".mineral_" + .@i + "_items"); .@items_size = getarraysize(getd(".mineral_" + .@i + "_items")); .@item_sum = 0; for(.@x = 0; .@x < .@items_size; .@x += 4) .@item_sum += getd(".mineral_" + .@i + "_items[" + (.@x + 1) + "]"); setd(".mineral_" + .@i + "_item_sum", .@item_sum); .@maps_size = getarraysize(getd(".mineral_" + .@i + "_maps$")); for(.@y = 0; .@y < .@maps_size; .@y++) { .@maps$ = getd(".mineral_" + .@i + "_maps$[" + .@y + "]"); .@amounts = getd(".mineral_" + .@i + "_amounts[" + .@y + "]"); .@areas_x_1 = getd(".mineral_" + .@i + "_areas_x_1[" + .@y + "]"); .@areas_x_2 = getd(".mineral_" + .@i + "_areas_x_2[" + .@y + "]"); .@areas_y_1 = getd(".mineral_" + .@i + "_areas_y_1[" + .@y + "]"); .@areas_y_2 = getd(".mineral_" + .@i + "_areas_y_2[" + .@y + "]"); areamonster(.@maps$, .@areas_x_1, .@areas_x_2, .@areas_y_1, .@areas_y_2, .@name$, .minerals[.@i], .@amounts, "MINING::OnMined"); } } end; OnMined: .@mineral = inarray(.minerals, killedrid); .@mineral_name$ = getd(".mineral_" + .@mineral + "_name$"); .@util = getequipid(EQI_HAND_R); if(inarray(.mining_utils, .@util) == -1) { dispbottom("Using your " + getitemname(.@util) + " destroyed any useful resource from " + .@mineral_name$ + "."); end; } .@mineral_item_sum = getd(".mineral_" + .@mineral + "_item_sum"); .@mineral_items_size = getarraysize(getd(".mineral_" + .@i + "_items")); .@pick = rand(1, .@mineral_item_sum); for(.@i = 0; .@i < .@mineral_items_size; .@i += 4) { .@pick -= getd(".mineral_" + .@mineral + "_items[" + (.@i + 1) + "]"); if(.@pick <= 0) break; } .@item = getd(".mineral_" + .@mineral + "_items[" + .@i + "]"); .@item_min_amount = getd(".mineral_" + .@mineral + "_items[" + (.@i + 2) + "]"); .@item_max_amount = getd(".mineral_" + .@mineral + "_items[" + (.@i + 3) + "]"); getitem(.@item, rand(.@item_min_amount, .@item_max_amount)); } This will spawn different minerals (in this example represented by purple ore and plants), which give different items on kill etc. once a mineral gets killed, it checks if an item from the .mining_utils array is equipped and if not gives the player the message, that using the wrong item destroyed any useful resources otherwise it will roll which and how many of an item the player gets. I've just tested it. It does work but it's very easy to abuse by swapping weapons Thanks though HackGU 2023-09-05 17-49-37.mp4 ----edit Is it possible to use specialeffect2 from this list rathena/doc/effect_list.txt at master · rathena/rathena (github.com) to make your character act like auto attacking mobs? Edited September 5, 2023 by jamesandrew Quote Link to comment Share on other sites More sharing options...
0 Winterfox Posted September 5, 2023 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 245 Reputation: 93 Joined: 06/30/18 Last Seen: November 27, 2024 Share Posted September 5, 2023 4 hours ago, jamesandrew said: I've just tested it. It does work but it's very easy to abuse by swapping weapons Thanks though HackGU 2023-09-05 17-49-37.mp4 9.85 MB · 0 downloads ----edit Is it possible to use specialeffect2 from this list rathena/doc/effect_list.txt at master · rathena/rathena (github.com) to make your character act like auto attacking mobs? I am not sure if there is an effect that makes it look like a character attacks. Another idea I had would be to spawn an invisible mob below the ore NPC when the player meets the requirements, and then to set him up to attack that mob and lock him in this state until he killed the ore mob. When the ore mob is dead, you can hide the npc for the player for a certain amount of time. For the part of making a player attack a mob and blocking movement, you could check the commands: unitattack and, setpcblock that could help you with that. In general, the unit commands could be of help to you. For the part about visibility of ores, you could use the on touch area of the npc and combine that with cloakonnpc or cloakonnpcself to control which players can see the npc right now. Quote Link to comment Share on other sites More sharing options...
0 jamesandrew Posted September 10, 2023 Group: Members Topic Count: 23 Topics Per Day: 0.03 Content Count: 60 Reputation: 3 Joined: 06/21/23 Last Seen: March 4 Author Share Posted September 10, 2023 On 9/5/2023 at 11:05 PM, Winterfox said: I am not sure if there is an effect that makes it look like a character attacks. Another idea I had would be to spawn an invisible mob below the ore NPC when the player meets the requirements, and then to set him up to attack that mob and lock him in this state until he killed the ore mob. When the ore mob is dead, you can hide the npc for the player for a certain amount of time. For the part of making a player attack a mob and blocking movement, you could check the commands: unitattack and, setpcblock that could help you with that. In general, the unit commands could be of help to you. For the part about visibility of ores, you could use the on touch area of the npc and combine that with cloakonnpc or cloakonnpcself to control which players can see the npc right now. I haven't figured out.. But I found a gameplay video what I exactly wanted. You can attack the ore mob but it doesn't take any damage unless you equipped with a pickaxe. Also a fixed aspd would be great, just like in this video Quote Link to comment Share on other sites More sharing options...
0 hakuren Posted September 11, 2023 Group: Members Topic Count: 120 Topics Per Day: 0.02 Content Count: 295 Reputation: 6 Joined: 12/02/11 Last Seen: November 6, 2023 Share Posted September 11, 2023 try this one Quote Link to comment Share on other sites More sharing options...
Question
jamesandrew
My mining gameplay. Character is just standing there waiting on progress bar until finish.
I want my character to move/doing basic attacks to the nodes like this one in the video, without a fancy progress bar ofc.
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.