brunoshp Posted September 14, 2020 Group: Members Topic Count: 64 Topics Per Day: 0.01 Content Count: 180 Reputation: 7 Joined: 12/19/12 Last Seen: November 21, 2024 Share Posted September 14, 2020 Hi, I would like to show the name of the monster on which the card is dropped even if the drop is 0. how i can do it? ACMD_FUNC(whodrops) { struct item_data *item_data, *item_array[MAX_SEARCH]; int i,j, count = 1; if (!message || !*message) { clif_displaymessage(fd, msg_txt(sd,1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>). return -1; } if ((item_array[0] = itemdb_exists(strtoul(message, nullptr, 10))) == nullptr) count = itemdb_searchname_array(item_array, MAX_SEARCH, message); if (!count) { clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name. return -1; } if (count == MAX_SEARCH) { sprintf(atcmd_output, msg_txt(sd,269), MAX_SEARCH); // Displaying first %d matches clif_displaymessage(fd, atcmd_output); } for (i = 0; i < count; i++) { item_data = item_array[i]; sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID: %u) clif_displaymessage(fd, atcmd_output); if (item_data->mob[0].chance == 0) { strcpy(atcmd_output, msg_txt(sd,1286)); // - Item is not dropped by mobs. clif_displaymessage(fd, atcmd_output); } else { sprintf(atcmd_output, msg_txt(sd,1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed): clif_displaymessage(fd, atcmd_output); for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++) { int dropchance = item_data->mob[j].chance; #ifdef RENEWAL_DROP if( battle_config.atcommand_mobinfo_type ) dropchance = dropchance * pc_level_penalty_mod(mob_db(item_data->mob[j].id)->lv - sd->status.base_level, mob_db(item_data->mob[j].id)->status.class_, mob_db(item_data->mob[j].id)->status.mode, 2) / 100; #endif if (pc_isvip(sd)) // Display item rate increase for VIP dropchance += (dropchance * battle_config.vip_drop_increase) / 100; sprintf(atcmd_output, "- %s (%d): %02.02f%%", mob_db(item_data->mob[j].id)->jname, item_data->mob[j].id, dropchance/100.); clif_displaymessage(fd, atcmd_output); } } } return 0; } i changed for >=0 but got error,crash server! for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++) Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted September 14, 2020 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Thursday at 04:49 PM Share Posted September 14, 2020 What's the point of this changes? if drop rate is 0% ... it meant the monster will never drop it, as if the item drops weren't added to the monster. Your changes probably messed up with the calculation part (value divide by 0) and caused server crashed. Quote Link to comment Share on other sites More sharing options...
0 brunoshp Posted September 14, 2020 Group: Members Topic Count: 64 Topics Per Day: 0.01 Content Count: 180 Reputation: 7 Joined: 12/19/12 Last Seen: November 21, 2024 Author Share Posted September 14, 2020 (edited) I just wanted to show that the item would drop from the monster, even if it didn't. @Emistry is it possible to set 1, that is 0, for enter in FOR after set dropchance to 0 to show? item_data->mob[j].chance Edited September 14, 2020 by brunoshp Quote Link to comment Share on other sites More sharing options...
Question
brunoshp
Hi, I would like to show the name of the monster on which the card is dropped even if the drop is 0.
how i can do it?
i changed for >=0 but got error,crash server!
for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++)
Link to comment
Share on other sites
2 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.