Kichi 6 Posted June 9, 2014 Helo guys,I want to make a requestHow to make a script_command call NPC function? Thank You Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted June 9, 2014 If you meant by labels used by NPC: *doevent "<NPC object name>::<event label>";This command will start a new execution thread in a specified NPC object at the specified label. The execution of the script running this command will not stop, and the event called by the 'doevent' command will not run until the invoking script has terminated. No parameters may be passed with a doevent call.The script of the NPC object invoked in this manner will run as if it's been invoked by the RID that was active in the script that issued a 'doevent'. As such, the command will not work if an RID is not attached. if you mean by functions callfunc "<function name>"{,Arguments} Quote Share this post Link to post Share on other sites
0 Kichi 6 Posted June 9, 2014 thanks for the answerThat method is how to callnpc through scriptsince im asking on source, it's about how to callnpc through source i have not seen before on any emulator so i can't give an example >.< Lets say @call is not bindatcmdwhen i type @call in game it will call a NPC in game Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 9, 2014 You've got a clear example at mob.c for example, on this chunk of code (sorry for no tabs at all, it screws up): if( md->npc_event[0] && !md->state.npc_killmonster ) { if( sd && battle_config.mob_npc_event_type ) { pc->setparam(sd, SP_KILLERRID, sd->bl.id); npc->event(sd,md->npc_event,0); } else if( mvp_sd ) { pc->setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0); npc->event(mvp_sd,md->npc_event,0); } else npc->event_do(md->npc_event); } else if( mvp_sd && !md->state.npc_killmonster ) { pc->setparam(mvp_sd, SP_KILLEDRID, md->class_); npc->script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance] } Just use npc->script_event(sd, npc_event) for when you want to attach a player or npc->event_do(npc_event) for an event without any attached player. The NPC event can be hardcoded if you want ("NPCNAME::OnMyEventName") if you find it simpler. 1 Kichi reacted to this Quote Share this post Link to post Share on other sites
0 Kichi 6 Posted June 9, 2014 You've got a clear example at mob.c for example, on this chunk of code (sorry for no tabs at all, it screws up): if( md->npc_event[0] && !md->state.npc_killmonster ) { if( sd && battle_config.mob_npc_event_type ) { pc->setparam(sd, SP_KILLERRID, sd->bl.id); npc->event(sd,md->npc_event,0); } else if( mvp_sd ) { pc->setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0); npc->event(mvp_sd,md->npc_event,0); } else npc->event_do(md->npc_event); } else if( mvp_sd && !md->state.npc_killmonster ) { pc->setparam(mvp_sd, SP_KILLEDRID, md->class_); npc->script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance] } Just use npc->script_event(sd, npc_event) for when you want to attach a player or npc->event_do(npc_event) for an event without any attached player. The NPC event can be hardcoded if you want ("NPCNAME::OnMyEventName") if you find it simpler. LOLZ i didn't noticed Quote Share this post Link to post Share on other sites
Helo guys,
I want to make a request
How to make a script_command call NPC function?
Thank You
Share this post
Link to post
Share on other sites