Item drop with random refine level/card

WhiteEagle

New member
Messages
52
Points
0
Emulator
Greetings,
I would like to add the feature that monsters can also drop items with random refine level and / or cards.
But when I run it over OnPCPickUpEvent (a Plugin by AnnieRuru <3), it can be abused by drop item and pick up again.
So, may I ask for a src edit to make possible?
 

 
just use OnNPCKillEvent and makeitem2 script command, shouldn't very hard to do

..... or maybe needs *mobevent script command ...
well if you needs the monster's coordinate when monster dead ...

 
Last edited by a moderator:
just use OnNPCKillEvent and makeitem2 script command, shouldn't very hard to do
At first thanks for your response and yes it isnt hard to do like this,
but the problem with makeitem is, it can happen it drop twice. (1x normal and 1x from makeitem)
As example: Poring get killed and drop a knife and with some "luck" prog the makeitem, so he get 2 knifes.
I would have to switch off the normal drop completely and just let makeitem run.
 

Edit:
If i understand this correct, could this added here.

Code:
/*==========================================
 * item drop with delay (timer function)
 *------------------------------------------*/
static int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data)
{
	struct item_drop_list *list;
	struct item_drop *ditem;
	list=(struct item_drop_list *)data;
	ditem = list->item;
	while (ditem) {
		struct item_drop *ditem_prev;
		map->addflooritem(NULL, &ditem->item_data,ditem->item_data.amount,
		    list->m,list->x,list->y,
		    list->first_charid,list->second_charid,list->third_charid,0,
		    ditem->showdropeffect);
		ditem_prev = ditem;
		ditem = ditem->next;
		ers_free(item_drop_ers, ditem_prev);
	}
	ers_free(item_drop_list_ers, list);
	return 0;
}
 
Last edited by a moderator:
I would have to switch off the normal drop completely and just let makeitem run.
exactly the point, I assumed this is use in events, so you already have mf_nomobloot enabled
disable monster drop on the map, and use makeitem2 script command to make monster drop items instead

so you mean this is use on normal monster drop as well ?

#include "common/hercules.h"
#include "map/mob.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
"addrefinedrop",
SERVER_TYPE_MAP,
"x.x",
HPM_VERSION,
};

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {
if ( retVal->item_data.nameid == 1202 )
retVal->item_data.refine = 2;
return retVal;
}

HPExport void plugin_init( void ) {
addHookPost( mob, setdropitem, mob_setdropitem_post );
}


tested with killing poring repeatedly, "@monster 1002 100" and go for item Knife_ drop

 
Last edited by a moderator:
so you mean this is use on normal monster drop as well ?

#include "common/hercules.h"
#include "map/mob.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
"addrefinedrop",
SERVER_TYPE_MAP,
"x.x",
HPM_VERSION,
};

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {
if ( retVal->item_data.nameid == 1202 )
retVal->item_data.refine = 2;
return retVal;
}

HPExport void plugin_init( void ) {
addHookPost( mob, setdropitem, mob_setdropitem_post );
}

Yea awesome, that's what i mean!
But not only for one or few items, for all armor and weapons.
Like:

 if ( retVal->item_data.type == IT_ARMOR && retVal->item_data.type == IT_WEAPON )
        retVal->item_data.refine = rand(1,9);

The stuff with cards is not much important. The function for the refine is good enough.

Thanks AnnieRuru for your time.
 

 
Last edited by a moderator:
Last edited by a moderator:
Hey AnnieRuru, may I can ask your help again.
After adding the random option system, the refine drop dont work anymore.

I changed this:

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {


to

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, struct optdrop_group *options, int qty, struct item_data *data ) {


to get no errors. But no items are droped with refine level :(
Can you please fix this? 
Thanks in advance <3

 
The Item random option system works fine. But your plugin for the refine drop will not work anymore because the structure has changed.
This line here:

struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) {


That's why I asked you if you know what needs to be changed to make the refine drop work again.

The error says that something is wrong here:

Code:
HPExport void plugin_init( void ) {
	addHookPost( mob, setdropitem, mob_setdropitem_post );
 
the cards can be done by retrieve the card ID from `item_db` SQL table, its not that hard to do

https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.2.c

btw, this is simple stuffs ....
PS: when testing, I turned on autoloot and using custom identifier script


sorry for the necropost, but just a small doubt, does the source already check if item is refineable (flag.no_refine) somewhere else or should we add the check too? (asking this because there are items that shouldn't be refineable and I didn't see a check)

 
Last edited by a moderator:
update plugin -> https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.3.c

along with healer script for testing -> https://github.com/AnnieRuru/Release/blob/master/scripts/Utility/healer/healer_1.2.txt

sorry for the necropost, but just a small doubt, does the source already check if item is refineable (flag.no_refine) somewhere else or should we add the check too?
nope, but we can just struct item_data of the nameid to get the data of that item

1.4 - https://github.com/AnnieRuru/Release/blob/master/plugins/addrefinedrop/addrefinedrop_0.4.c

- if the item is non-refine-able, it doesn't drop refined items

 
Back
Top