Feilor Posted August 2, 2017 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 135 Reputation: 17 Joined: 12/31/11 Last Seen: January 11 Share Posted August 2, 2017 Hi guys i know this isn't the best place to ask it, but what is the new way to call a npc in source code? In the past i used to use this: nd = npc->name2id("vipquests"); if( nd == NULL ) return -1; script->run_npc(nd->u.scr.script, 0, sd->bl.id, npc->fake_nd->bl.id); Could someone explain me how use it now? Thanks! Quote Link to comment Share on other sites More sharing options...
0 Enthr Posted August 3, 2017 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 88 Reputation: 10 Joined: 01/15/16 Last Seen: January 18 Share Posted August 3, 2017 Hi Luan, i think that your code is from Hercules and not from Rathena, i recommend to see the npc_click function in npc.c int npc_click(struct map_session_data* sd, struct npc_data* nd) { nullpo_retr(1, sd); if (sd->npc_id != 0) { ShowError("npc_click: npc_id != 0\n"); return 1; } if(!nd) return 1; if ((nd = npc_checknear(sd,&nd->bl)) == NULL) return 1; //Hidden/Disabled npc. if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE)) return 1; switch(nd->subtype) { case NPCTYPE_SHOP: clif_npcbuysell(sd,nd->bl.id); break; case NPCTYPE_CASHSHOP: case NPCTYPE_ITEMSHOP: case NPCTYPE_POINTSHOP: clif_cashshop_show(sd,nd); break; case NPCTYPE_MARKETSHOP: #if PACKETVER >= 20131223 { unsigned short i; for (i = 0; i < nd->u.shop.count; i++) { if (nd->u.shop.shop_item[i].qty) break; } if (i == nd->u.shop.count) { clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 534), false, SELF); return false; } sd->npc_shopid = nd->bl.id; clif_npc_market_open(sd, nd); } #endif break; case NPCTYPE_SCRIPT: run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id); break; case NPCTYPE_TOMB: run_tomb(sd,nd); break; } return 0; } you can see here all the things you need 1 Quote Link to comment Share on other sites More sharing options...
0 Feilor Posted August 3, 2017 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 135 Reputation: 17 Joined: 12/31/11 Last Seen: January 11 Author Share Posted August 3, 2017 4 hours ago, Enthr said: Hi Luan, i think that your code is from Hercules and not from Rathena, i recommend to see the npc_click function in npc.c int npc_click(struct map_session_data* sd, struct npc_data* nd) { nullpo_retr(1, sd); if (sd->npc_id != 0) { ShowError("npc_click: npc_id != 0\n"); return 1; } if(!nd) return 1; if ((nd = npc_checknear(sd,&nd->bl)) == NULL) return 1; //Hidden/Disabled npc. if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE)) return 1; switch(nd->subtype) { case NPCTYPE_SHOP: clif_npcbuysell(sd,nd->bl.id); break; case NPCTYPE_CASHSHOP: case NPCTYPE_ITEMSHOP: case NPCTYPE_POINTSHOP: clif_cashshop_show(sd,nd); break; case NPCTYPE_MARKETSHOP: #if PACKETVER >= 20131223 { unsigned short i; for (i = 0; i < nd->u.shop.count; i++) { if (nd->u.shop.shop_item[i].qty) break; } if (i == nd->u.shop.count) { clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 534), false, SELF); return false; } sd->npc_shopid = nd->bl.id; clif_npc_market_open(sd, nd); } #endif break; case NPCTYPE_SCRIPT: run_script(nd->u.scr.script,0,sd->bl.id,nd->bl.id); break; case NPCTYPE_TOMB: run_tomb(sd,nd); break; } return 0; } you can see here all the things you need I used this code in 2012 in eA didn't realized that rA changed things in src until somedays ago in Hercules it worked fine,but here I had to change alot of things of my old code, thanks to point a place where I can take a look! Quote Link to comment Share on other sites More sharing options...
Question
Feilor
Hi guys i know this isn't the best place to ask it, but what is the new way to call a npc in source code? In the past i used to use this:
Could someone explain me how use it now?
Thanks!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.