Jump to content
  • 0
Kichi

script_command call NPC

Question

4 answers to this question

Recommended Posts

  • 0

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} 

Share this post


Link to post
Share on other sites
  • 0

thanks for the answer

That method is how to callnpc through script
since im asking on source, it's about how to callnpc  through source :D
i have not seen before on any emulator so i can't give an example >.<
 

Lets say @call is not bindatcmd
when i type @call in game it will call a NPC in game

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.