Jump to content
  • 0

A bonus drop rate script for certain type categorization as @aloottype


Question

Posted

Hi, I wonder if possible to make a script that increases the drop rate of a certain type using @aloottype item category as references. For example, Poring has a probability of dropping Apple. If put;

bonus2 bAddMonsterDropItemType,0,500;

"0" as Potion/Food item group as in @aloottype designated.

So Poring will most likely drop Apple or Potion/Food for any monster that is killed, is that even possible to add these scripts?

2 answers to this question

Recommended Posts

  • 0
Posted

I had to ask AI. Is this legit?

 

1. Add the New Bonus Enum

In src/map/battle.hpp, add the new bonus to the e_bonus enum:

enum e_bonus {
    // ... existing entries
    bAddHealFoodDrop, // New bonus for healing/food item drop rate
    // ... remaining entries
};

 

2. Update Bonus Name Array

In src/map/battle.cpp, add the bonus name to the bonus_name array:

{ "bAddHealFoodDrop", bAddHealFoodDrop }, // Maps the script name to the enum

 

3. Modify Drop Rate Calculation

In src/map/mob.cpp, update the mob_dead function to apply the bonus for healing items:

Locate the drop rate calculation section (around where bAddDrop is applied) and modify it:

if (steal) {
    rate = rate * (100 + sd->indexed_bonus.bAddStealRate) / 100;
} else {
    int drop_bonus = sd->indexed_bonus.bAddDrop;
    struct item_data *id = itemdb_exists(md->dropitem[i].nameid);
    if (id && id->type == IT_HEALING) {
        drop_bonus += sd->indexed_bonus.bAddHealFoodDrop; // Apply additional bonus
    }
    rate = rate * (100 + drop_bonus) / 100;
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...