astralprojection 35 Posted March 27, 2019 Is there a way to trigger on ion mob drop a specific item? - scrip itemdrop -1,{ end; OnMobDrop: If(nameid = 601) dispbottom "Monster dropped ^+getitemname(601): end; } 1 banhelba2019 reacted to this Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted March 27, 2019 the monster drop are not attaching to any player, because it just simply drop on the floor the only time it attach the player is when the one of the party member has "@autoloot" enabled, and also just attach to the party member having "@autoloot" what's the idea behind this modification ? I remember I made rare drop announcement patch during eathena time if( sd && sd->status.mod_drop != 100 ) { drop_rate = drop_rate * sd->status.mod_drop / 100; if( drop_rate < 1 ) drop_rate = 1; } just add announce blah blah after this line in mob_dead function or if you mean it trigger when player pick up an item, then can try my OnPCPickUpEvent Quote Share this post Link to post Share on other sites
0 astralprojection 35 Posted March 27, 2019 Im so grateful on your plugin. I will hve a try. OnPCPickUpEvent.c: In function ‘plugin_init’: OnPCPickUpEvent.c:157:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_ITEMID",PICKUP_ITEMID,false); ^ OnPCPickUpEvent.c:158:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_AMOUNT",PICKUP_AMOUNT,false); ^ OnPCPickUpEvent.c:159:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_IDENTIFY",PICKUP_IDENTIFY,false); ^ OnPCPickUpEvent.c:160:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_REFINE",PICKUP_REFINE,false); ^ OnPCPickUpEvent.c:161:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_BROKEN",PICKUP_BROKEN,false); ^ OnPCPickUpEvent.c:162:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_CARD1",PICKUP_CARD1,false); ^ OnPCPickUpEvent.c:163:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_CARD2",PICKUP_CARD2,false); ^ OnPCPickUpEvent.c:164:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_CARD3",PICKUP_CARD3,false); ^ OnPCPickUpEvent.c:165:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_CARD4",PICKUP_CARD4,false); ^ OnPCPickUpEvent.c:166:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_EXPIRE",PICKUP_EXPIRE,false); ^ OnPCPickUpEvent.c:167:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_BOUND",PICKUP_BOUND,false); ^ OnPCPickUpEvent.c:168:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_UNIQUEID",PICKUP_UNIQUEID,false); ^ OnPCPickUpEvent.c:169:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_POSX",PICKUP_POSX,false); ^ OnPCPickUpEvent.c:170:2: error: too few arguments to function ‘script->set_constant’ script->set_constant("PICKUP_POSY",PICKUP_POSY,false); ^ make[1]: *** [../../plugins/OnPCPickUpEvent.so] Error 1 @AnnieRuru getting this during compile using latest Herc. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted March 27, 2019 (edited) Spoiler https://github.com/AnnieRuru/Release/blob/master/plugins/OnPCPickUpEvent/OnPCPickUpEvent_0.2.c - fix the unique ID - add item option prontera,155,185,5 script dfskhfs 1_F_MARIA,{ end; OnPCPickUpEvent: announce sprintf( _$( "%s has pick up %s !!" ), strcharinfo(PC_NAME), getitemname2( @pickup_itemid, @pickup_identify, @pickup_refine, @pickup_attribute, @pickup_card1, @pickup_card2, @pickup_card3, @pickup_card4 ) ), bc_all; end; } EDIT: I think should hook to pc->additem, not pc->takeitem Spoiler https://github.com/AnnieRuru/Release/blob/master/plugins/OnPCPickUpEvent/OnPCPickUpEvent_0.3.c - fix unique ID not display properly, by hook pc->additem this time prontera,155,185,5 script dfskhfs 1_F_MARIA,{ end; OnPCPickUpEvent: if ( @pickup_action != LOG_TYPE_PICKDROP_PLAYER ) end; announce sprintf( _$( "%s has pick up %s !!" ), strcharinfo(PC_NAME), getitemname2( @pickup_itemid, @pickup_identify, @pickup_refine, @pickup_attribute, @pickup_card1, @pickup_card2, @pickup_card3, @pickup_card4 ) ), bc_all; dispbottom @pickup_uniqueid1 +" "+ @pickup_uniqueid2; end; } https://github.com/AnnieRuru/Release/blob/master/plugins/OnPCPickUpEvent/OnPCPickUpEvent_0.4.c - add pc->delitem to run when player drop item prontera,155,185,5 script dfskhfs 1_F_MARIA,{ end; OnPCPickUpEvent: if ( @pickup_action != LOG_TYPE_PICKDROP_PLAYER && @pickup_amount > 0 ) end; announce sprintf( _$( "%s has pick up %s !!" ), strcharinfo(PC_NAME), getitemname2( @pickup_itemid, @pickup_identify, @pickup_refine, @pickup_attribute, @pickup_card1, @pickup_card2, @pickup_card3, @pickup_card4 ) ), bc_all; // dispbottom @pickup_amount +" "+ @pickup_uniqueid1 +" "+ @pickup_uniqueid2; end; } Edited March 27, 2019 by AnnieRuru Quote Share this post Link to post Share on other sites
0 banhelba2019 20 Posted March 27, 2019 10 hours ago, astralprojection said: Is there a way to trigger on ion mob drop a specific item? - scrip itemdrop -1,{ end; OnMobDrop: If(nameid = 601) dispbottom "Monster dropped ^+getitemname(601): end; } Gotta remember this function thanks! Quote Share this post Link to post Share on other sites
0 astralprojection 35 Posted March 27, 2019 (edited) @AnnieRuru It works great! Thank you. I hooked it at pc->additem as I use @autoloot. I think there is no way we can trigger on mob drop. The plugin will trigger - someone traded you. - use old card album if card - get from storage I was looking for trigger only if picked from mob drop but i think its impossible. Edited March 27, 2019 by astralprojection Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted March 27, 2019 (edited) 7 hours ago, astralprojection said: I think there is no way we can trigger on mob drop. of course it can #include "common/hercules.h" #include "map/mob.h" #include "map/npc.h" #include "map/mapreg.h" #include "plugins/HPMHooking.h" #include "common/HPMDataCheck.h" HPExport struct hplugin_info pinfo = { "OnMobDrop", SERVER_TYPE_MAP, "x.x", HPM_VERSION, }; const char *event_label = "itemdrop::OnMobDrop"; struct item_drop *mob_setdropitem_post( struct item_drop* retVal, int nameid, int qty, struct item_data *data ) { mapreg->setreg( reference_uid( script->add_variable("$@mobdrop_itemid"), 0), nameid ); npc->event_do(event_label); return retVal; } HPExport void server_online( void ) { struct event_data *ev = (struct event_data*)strdb_get( npc->ev_db, event_label ); if ( ev == NULL || ev->nd == NULL ) { ShowWarning( "NPC label "CL_WHITE"%s"CL_RESET" does not found. Unloading "CL_WHITE"OnMobDrop"CL_RESET" Plugin.\n", event_label ); // core->runflag = CORE_ST_STOP; } else addHookPost( mob, setdropitem, mob_setdropitem_post ); } because it doesn't attach to any player during processing drop, so you can run this as *donpcevent prontera,155,185,5 script itemdrop 1_F_MARIA,{ end; OnMobDrop: announce F_ITEML($@mobdrop_itemid), bc_all; end; } 7 hours ago, astralprojection said: The plugin will trigger - someone traded you. - use old card album if card - get from storage I was looking for trigger only if picked from mob drop but i think its impossible. /// obtain log type character for item/zeny logs static char log_picktype2char(e_log_pick_type type) { switch( type ) { case LOG_TYPE_TRADE: return 'T'; // (T)rade case LOG_TYPE_VENDING: return 'V'; // (V)ending case LOG_TYPE_PICKDROP_PLAYER: return 'P'; // (P)player case LOG_TYPE_PICKDROP_MONSTER: return 'M'; // (M)onster case LOG_TYPE_NPC: return 'S'; // NPC (S)hop case LOG_TYPE_SCRIPT: return 'N'; // (N)PC Script case LOG_TYPE_STEAL: return 'D'; // Steal/Snatcher case LOG_TYPE_CONSUME: return 'C'; // (C)onsumed case LOG_TYPE_PRODUCE: return 'O'; // Pr(O)duced/Ingredients case LOG_TYPE_MVP: return 'U'; // MVP Rewards case LOG_TYPE_COMMAND: return 'A'; // (A)dmin command case LOG_TYPE_STORAGE: return 'R'; // Sto(R)age case LOG_TYPE_GSTORAGE: return 'G'; // (G)uild storage case LOG_TYPE_MAIL: return 'E'; // (E)mail attachment case LOG_TYPE_AUCTION: return 'I'; // Auct(I)on case LOG_TYPE_BUYING_STORE: return 'B'; // (B)uying Store case LOG_TYPE_LOOT: return 'L'; // (L)oot (consumed monster pick/drop) case LOG_TYPE_BANK: return 'K'; // Ban(K) Transactions case LOG_TYPE_DIVORCE: return 'Y'; // Divorce case LOG_TYPE_ROULETTE: return 'Z'; // Roulette case LOG_TYPE_RENTAL: return 'W'; // Rental case LOG_TYPE_CARD: return 'Q'; // Card case LOG_TYPE_INV_INVALID: return 'J'; // Invalid in inventory case LOG_TYPE_CART_INVALID: return 'H'; // Invalid in cart case LOG_TYPE_EGG: return '@'; // Egg case LOG_TYPE_QUEST: return '0'; // Quest case LOG_TYPE_SKILL: return '1'; // Skill case LOG_TYPE_REFINE: return '2'; // Refine case LOG_TYPE_OTHER: return 'X'; // Other } see src\map\log.c for more information see previous post, make sure only run with @pickup_action == LOG_TYPE_PICKDROP_PLAYER flag Edited March 27, 2019 by AnnieRuru Quote Share this post Link to post Share on other sites
0 astralprojection 35 Posted March 27, 2019 @AnnieRuru There! Amazing! Quote Share this post Link to post Share on other sites
Is there a way to trigger on ion mob drop a specific item?
- scrip itemdrop -1,{
end;
OnMobDrop:
If(nameid = 601)
dispbottom "Monster dropped ^+getitemname(601):
end;
}
Share this post
Link to post
Share on other sites