EveeX Posted June 30, 2022 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 32 Reputation: 29 Joined: 09/16/20 Last Seen: December 21, 2022 Share Posted June 30, 2022 View File Mob Item Adder This mapflag sets more drops for monsters at the map that it's been attached. You can set up to ~50 more items for mobs. "drop_per" is the chance of drop, from 1 (0,01%) to 10000 (100%). There's an example at the screenshot, I setted a Yggdrasil Berry with 100% of chance for the Poring at prt_fild08 map. You can set a lot of mobs, but you have to set more mapflags for your maps. Original mod by @zephyr Example: mapname<TAB>mapflag<TAB>mobitemadder<TAB>mob_id,item_id,drop_per{,item_id,drop_per(...)} Submitter EveeX Submitted 06/25/2022 Category Source Modifications Video Content Author gndx 1 Quote Link to comment Share on other sites More sharing options...
Takuyakii Posted October 21, 2022 Group: Members Topic Count: 41 Topics Per Day: 0.02 Content Count: 215 Reputation: 11 Joined: 08/30/19 Last Seen: March 6 Share Posted October 21, 2022 Can u update this on latest Git? Thanks! Quote Link to comment Share on other sites More sharing options...
rmon Posted April 27, 2024 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 97 Reputation: 2 Joined: 04/27/16 Last Seen: 3 hours ago Share Posted April 27, 2024 Also looking forward for this getting updated to latest rathena  would be amazing ! Quote Link to comment Share on other sites More sharing options...
SayonaraMaxwell Posted June 2, 2024 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 2 Reputation: 0 Joined: 02/07/24 Last Seen: 1 hour ago Share Posted June 2, 2024 I had to make a number of changes to the script, otherwise it didn't work correctly.  src/map/map.cpp Change @@ -2829,6 +2835,27 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if (map_getmapflag(m, MF_MOBITEMADDER)) { for (const auto& it : mapdata->mobitemadder_droplist) { if (it.mob_id == md->mob_id) { struct s_mob_drop mobdrop; drop_rate = it.item_per; mobdrop.nameid = it.item_id; if (rand() % 10000 > drop_rate) continue; - if (!ditem || !itemdb_exists(it.item_id)) + if (!itemdb_exists(it.item_id)) continue; ditem = mob_setdropitem(&mobdrop, 1, it.mob_id); mob_item_drop(md, dlist, ditem, 0, it.item_per, homkillonly); } } }  src/map/npc.cpp new code case MF_MOBITEMADDER: { if (state) { // Copy the string so as not to modify the original string char* droplist = strdup(w4); if (droplist) { char* checkdroplist = strtok(droplist, ", "); if (checkdroplist) { union u_mapflag_args args = {}; args.mobitemadder.mob_id = atoi(checkdroplist); // Clearing the current item data of a mob before adding new ones map_setmapflag(m, MF_MOBITEMADDER, false); // Create a temporary array to store added items int added_items[50]; // Assume no more than 50 items per monster int num_added_items = 0; // Number of items added // Process the string and add the items while ((checkdroplist = strtok(NULL, ", "))) { args.mobitemadder.item_id = atoi(checkdroplist); if ((checkdroplist = strtok(NULL, ", "))) { args.mobitemadder.item_per = atoi(checkdroplist); // Check to see if the mob already has the item. bool already_added = false; for (int i = 0; i < num_added_items; ++i) { if (added_items[i] == args.mobitemadder.item_id) { already_added = true; break; } } // If the item is not already present on the mob, add it if (!already_added) { map_setmapflag_sub(m, MF_MOBITEMADDER, true, &args); added_items[num_added_items++] = args.mobitemadder.item_id; } } } } free(droplist); // Freeing the allocated memory } } else { map_setmapflag(m, MF_MOBITEMADDER, false); } break; }  The only problem I have not been able to solve is the duplicate drop if @reloadscript is produced on the server That is, if you did reloadscript 10 times, the drop will drop in 10 instances. Quote Link to comment Share on other sites More sharing options...
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.