Jump to content
Maintenance : Final step ×

Boss drop: item with defined boni


Recommended Posts

  • Premium

Hi guys,

I wanted to know if anyone has seen a certain implementation or knows how to implement this:

How to drop gear from a boss that has defined bonus combinations e.g. the bosses in map1 should drop items with the bonus strong against animals, HP and crit (or something else). There should not be any RNG involved, meaning that the gear piece is 100% defined with the bonus e.g. always drop sword +0 with those boni.
The only thing that I thought of is some kind of quest solution where you drop a currency and exchange it for said item like a chest. As this feels rather unsatisfying, I am now looking for how to set this drop. May also be a chest.

Has anyone an idea? I am fairly new to the whole drop implementation and maybe this is super easy.

Thanks in advance and best regards!

Link to comment
Share on other sites

  • Premium

Update:
I just found drop systems using quests like this and give items a bonus

Is it possible to define the kill event, generate the item to be dropped by its vnum, add bonus to it and drop the item with ownership? I would be interested if and how this works.
Looking forward to your replies

Link to comment
Share on other sites

  • Active Member

I don't understand you said you can make them buy the item with your bonus from a shop, which means you already know how to create an item with those bonus right? In this case just put the item vnum in the drop table rather than putting it in an NPC 🤔

 

Or if what you are asking for is how to create an item with your decided bonus you can do that in source code, the functions you are looking for are:
LPITEM ITEM_MANAGER::CreateItem(DWORD vnum, DWORD count, DWORD id, bool bTryMagic, int iRarePct, bool bSkipSave) (in item_manager.cpp)

and

void CItem::AlterToMagicItem() (in item.cpp)

More specifically you could use something like item->GetOwner()->GetMapIndex() To get the map you are in and decide the bonus based on that.

 

OR if you aren't good in c++ you can create a new item which is the same as the old one but with the added bonus and just use that in your drop table, for example: You have a sword+0 (vnum 10), you create a whole new weapon in your item_proto identical to the sword but with the strong vs animals bonus (vnum 12345), then you change the drop of the boss so that instead of dropping vnum 10 it drops vnum 12345, and it will always have that bonus

  • Good 1
Link to comment
Share on other sites

  • Premium

Thanks for the input!

I actually thought about the latter as my main issue would be to find the right cpp files for implementing your 2nd suggestion. I am still very much confused about where stuff happens in the source and how the files are inter connected.

I know how to put items into a drop table, but I did not see any option to include boni? In combination with your suggestion to create a new item, this would work obviously.

I'm currently testing the quest approach where I make the mob drop an item although I am just learning that and trying to figure out how to do add bonus to said item. But if this fails, the I'm going for the the new item approach

Link to comment
Share on other sites

  • Active Member
14 hours ago, im4x8061 said:

my main issue would be to find the right cpp files for implementing your 2nd suggestion

Dude i wrote that in my answer, item_manager.cpp and item.cpp. CreateItem is the function used to create the item before it appears on the ground, and AlterToMagicITem is called inside CreateItem to add the bonuses before it appears on the ground.

 

15 hours ago, im4x8061 said:

I am still very much confused about where stuff happens in the source and how the files are inter connected.

Anyway if you want to find out where a function is declared/gets called, you can use ctrl + shift + f to search for it in the whole solution (if you are using visual studio) or you can right click a function and click on find all references (to see where it gets called) or ctrl + left-click on a function call to go to its declaration

Link to comment
Share on other sites

  • Active Member
On 12/30/2024 at 6:34 PM, im4x8061 said:

Update:
I just found drop systems using quests like this and give items a bonus

Is it possible to define the kill event, generate the item to be dropped by its vnum, add bonus to it and drop the item with ownership? I would be interested if and how this works.
Looking forward to your replies

use game.drop_item_with_ownership on kill

Link to comment
Share on other sites

  • Premium
55 minutes ago, [GF]Froslass said:

Dude i wrote that in my answer, item_manager.cpp and item.cpp. CreateItem is the function used to create the item before it appears on the ground, and AlterToMagicITem is called inside CreateItem to add the bonuses before it appears on the ground.

 

Anyway if you want to find out where a function is declared/gets called, you can use ctrl + shift + f to search for it in the whole solution (if you are using visual studio) or you can right click a function and click on find all references (to see where it gets called) or ctrl + left-click on a function call to go to its declaration

Ahh, okay. I am sorry for not getting it right away. I found that function when I was messing around with the definition of the "game.drop_item_with_ownership" function. I'll checkout where to define an item creation event for certain boss kills. I am really newbie with the structure as you can see. But thanks for your patience!

Thanks for the tip, I only know VScode (ctrl + click) and am not used to visual studio

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.