Jump to content
  • 0
Helena

Instance_npcname, invalid instance NPC (instance_id -1, NPC name: -1)?

Question

I'm using a instance which worked on another emulator, but when I run it on this one I'm getting the following error:
 
[Warning]: Unexpected type for argument 1. Expected string.
[Debug]: Data: number value=-1
[Debug]: Function: instance_npcname
[Debug]: Source (NPC): Entrance#man1 at man_lob (99,98)
[Error]: script:instance_npcname: invalid instance NPC (instance_id: -1, NPC nam
e: "-1".)
[Debug]: Source (NPC): Entrance#man1 at man_lob (99,98)
 
 
This is the script that's causing trouble. It's the warper, does anyone know where it went wrong?;
 
man_lob,99,98,0    script    Entrance#man1    2_M_THIEFMASTER,{
    set .@pname$,strcharinfo(0);
    set .@guid,getcharid(2);
    dispbottom "Name: " + instance_npcname(has_instance2("1@manp"));
    if ((has_instance2("1@manp") >= 0) && (has_instance2("1@manp") != "0")) {
        set .@party_id,getcharid(1);
        if (.@party_id == 0) {
            dispbottom "Error! Player is currently not in a party!";
            end;
        }
        getpartymember(.@party_id);
        set .@partymembercount,$@partymembercount;
        if (compare("BB solo",instance_npcname(has_instance2("1@manp")))) {
            if ((getcharid(0) != getpartyleader(.@party_id,2)) || (.@partymembercount != 1)) {
                dispbottom "Error! Only the party leader can enter the solo room with nobody else in the party.";
                end;
            }
        }
        if ((.@guid != 0) && ((.@guid == $bbguild[0]) || (.@guid == $bbguild[1]) || (.@guid == $bbguild[2]))) {
            mes "You have currently booked a guild room as well as a "+(compare("BB solo",instance_npcname(has_instance2("1@manp")))?"solo":"party")+" room, which one do you want to enter?";
            if (select("Guild room:"+(compare("BB solo",instance_npcname(has_instance2("1@manp")))?"Solo":"Party")+" room") == 1) goto GuildRoom;
        }
        set .@pname$,strcharinfo(0);
        message .@pname$,.@pname$+" : I feel a bit dizzy ...";
        sleep2 500;
        switch (rand(4)) {
        case 0:
            warp "1@manp",50,10;
            break;
        case 1:
            warp "1@manp",10,50;
            break;
        case 2:
            warp "1@manp",50,89;
            break;
        case 3:
            warp "1@manp",89,50;
            break;
        }
    } else if ((.@guid != 0) && ((.@guid == $bbguild[0]) || (.@guid == $bbguild[1]) || (.@guid == $bbguild[2]))) {
GuildRoom:
        set .@pname$,strcharinfo(0);
        message .@pname$,.@pname$+" : I feel a bit dizzy ...";
        sleep2 500;    
        if (.@guid == $bbguild[0])
            set .@gnui,1;
        else if (.@guid == $bbguild[1])
            set .@gnui,2;
        else if (.@guid == $bbguild[2])
            set .@gnui,3;
        switch (rand(4)) {
        case 0:
            warp "man_gu"+.@gnui,50,10;
            break;
        case 1:
            warp "man_gu"+.@gnui,10,50;
            break;
        case 2:
            warp "man_gu"+.@gnui,50,89;
            break;
        case 3:
            warp "man_gu"+.@gnui,89,50;
            break;
        }
    } else {
        message .@pname$,.@pname$+" : There are cables connected to that tree. Weird ...";
    }
    end;
}
 
1@manp,50,6,0    warp    manp_01    1,1,man_lob,99,93
1@manp,6,50,0    warp    manp_02    1,1,man_lob,99,93
1@manp,50,93,0    warp    manp_03    1,1,man_lob,99,93
1@manp,93,50,0    warp    manp_04    1,1,man_lob,99,93
 
man_pub,40,37,0    warp    manp_06    1,1,man_lob,144,98
man_pub,32,206,0    warp    manp_07    1,1,man_lob,144,98
man_pub,203,207,0    warp    manp_08    1,1,man_lob,144,98
man_pub,191,40,0    warp    manp_09    1,1,man_lob,144,98

 

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

*instance_npcname("<npc name>"{,<instance id>});

 

Haven't looked at the script in detail just from a quick glance I don't see you listing an NPC name. This also matches the error message you are getting. 

 

:/ not sure if that helps any.

Share this post


Link to post
Share on other sites
  • 0

*instance_npcname("<npc name>"{,<instance id>});

 

Haven't looked at the script in detail just from a quick glance I don't see you listing an NPC name. This also matches the error message you are getting. 

 

:/ not sure if that helps any.

 

Thanks for attempting to help. I don't know what I should do to make it work though. This happens to be a custom script, but it also gives this error with some official instances. :(

Share this post


Link to post
Share on other sites
  • 0

Well actually, all the use you have of the "instance_npcname" command are written the same way:

 

instance_npcname(has_instance2("1@manp"))

 

Basically, this can't work, as you don't specify an npc name to retrieve. So, replace all the call with some build this way

 

instance_npcname(Entrance#man1, has_instance2("1@manp"))

 

And everything should work.

Share this post


Link to post
Share on other sites
  • 0

Well actually, all the use you have of the "instance_npcname" command are written the same way:

 

instance_npcname(has_instance2("1@manp"))

 

Basically, this can't work, as you don't specify an npc name to retrieve. So, replace all the call with some build this way

 

instance_npcname(Entrance#man1, has_instance2("1@manp"))

 

And everything should work.

 

Tried this but no difference.

Edited by Helena

Share this post


Link to post
Share on other sites
  • 0

Tried it exactly this way? Cause I see I was lacking quotes around Entrance#man1. SHould be 

 

instance_npcname("Entrance#man1", has_instance2("1@manp"))

 

Sorry.

Share this post


Link to post
Share on other sites
  • 0

Tried it exactly this way? Cause I see I was lacking quotes around Entrance#man1. SHould be 

 

instance_npcname("Entrance#man1", has_instance2("1@manp"))

 

Sorry.

 

Thank you mr but still the same error. :(

Share this post


Link to post
Share on other sites
  • 0

We cant fix the error without knowing how you really set solo/party room.

Since you really cannot use instanced npc name to identify it, maybe add some unique variables to declare if its solo/party room?

Share this post


Link to post
Share on other sites
  • 0

We cant fix the error without knowing how you really set solo/party room.

Since you really cannot use instanced npc name to identify it, maybe add some unique variables to declare if its solo/party room?

 

Sir dastgir, sorry for not providing everything you need. Here is the full script: http://upaste.me/ee2826667191eddbc

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.