Jump to content
  • 0

How merge 2 or more NPCs in 1 script?


eKoh

Question


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

Hello, I want to merge 2 or more npcs in 1 only script, because is really annoying to @unloadnpc all the npcs I need, so I am trying to merge them in 1 script, what I've done is this:

 

 

getmapxy(.@map$,.@x,.@y,0);

if ( .@map$ == "poring_gnd" ){
    
    if ( .@x > 66 && .@x < 90 && .@y > 76 && .@y < 100 )
        set .@npc,1;
        
    if ( .@x > 107 && .@x < 131 && .@y > 75 && .@y < 99 )
        set .@npc,2;

    if ( .@x > 115 && .@x < 139 && .@y > 115 && .@y < 139 )
        set .@npc,3;
        
    if ( .@x > 58 && .@x < 86 && .@y > 111 && .@y < 139 )
        set .@npc,4;
}
 
switch(.@npc){
 
   case 1:
      npc1;
 
   case 2:
      npc2;
 
//Same fo the others
 
//Duplicate npcs
 
poring_gnd,78,88,5    duplicate(Start)    Aria#1    533
poring_gnd,119,87,3    duplicate(Start)    Dariam#1    486
poring_gnd,125,125,3    duplicate(Start)    Archam#1    754
poring_gnd,72,125,5    duplicate(Start)    Leon#1    48
 
}

 

This actually works, but the thing is that npcs need to be atleas 28 cells away, or it causes bugs

 

what I was using to detect every npc was getmapxy(.@map$,.@x,.@y,0); but I want to believe that there are other ways.

 

thank you

 

Regards

eKoh~

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   5
  • Joined:  04/07/14
  • Last Seen:  

Compare names?

On click check:
 

if (strnpcinfo(0) == "Buffer#1") {

set .@npc,1;

}

if (strnpcinfo(0) == "Kafra#2") {

set .@npc,2;

}

Edited by zeshan321
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

Compare names?

On click check:

 

if (strnpcinfo(0) == "Buffer#1") {

set .@npc,1;

}

if (strnpcinfo(0) == "Kafra#2") {

set .@npc,2;

}

 

D=, i'll try it, i'll let you know if it works

thank you a lot man! it works ;D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  545
  • Reputation:   220
  • Joined:  03/01/13
  • Last Seen:  

Profiled.

Thanks,
~Azura Skyy

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

cause is really annoying to @unloadnpc all the npcs I need, 

after you use @unloadnpc <main npc>

all the duplicates NPC should have removed together.

 

otherwise use @unloadnpcfile <file path>

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  206
  • Reputation:   13
  • Joined:  01/07/12
  • Last Seen:  

 

cause is really annoying to @unloadnpc all the npcs I need, 

after you use @unloadnpc <main npc>

all the duplicates NPC should have removed together.

 

otherwise use @unloadnpcfile <file path>

 

 

oh, that one is also pretty good and not needed to merge npcs, thank you a lot

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...