Jump to content
  • 0

How merge 2 or more NPCs in 1 script?


Question

Posted

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~

5 answers to this question

Recommended Posts

Posted

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

Posted

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
Posted

 

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...