Jump to content
  • 0

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


ROArdentPlayer

Question


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  01/30/25
  • Last Seen:  

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?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  01/30/25
  • Last Seen:  

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;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  95
  • Reputation:   16
  • Joined:  12/16/11
  • Last Seen:  

Better ask in source forum

  • Upvote 1
Link to comment
Share on other sites

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.

×
×
  • Create New...