failed npc->checknear test.

kairu

New member
Messages
23
Points
0
I made an item call a function which have player interaction to choose on a menu but it gets the error npc_scriptcont: failed npc->checknear test.

Heres an example of it:

Item id of Knife -> 1202

with script on it as:

callfunc "getSkill";

and the gist of the function of:

function script getSkill {
attachrid(getcharid(3));
retryRK:
dispbottom "Select a Skill you want.";
switch(select("Enchant Blade:Sonic Wave:Death Bound")){
case 1:
.@r = 1;
break;
case 2:
.@r = 2;
break;
case 3:
.@r = 3;
break;
default:
goto(retryRK);
}
close;
<More code...>


I'm just wondering if there's any fix to this http://herc.ws/board/tracker/issue-3720-failed-npc-checknear-test-on-item-equip-function/

or any work around it.

would greatly appreciate it!

 
Last edited by a moderator:
If you are using callfunc or callsub, any .@ instance scope variables apply only within the function itself.

So you would need to use maybe @ variable to apply to temp char value.

 
@kairu input interaction can works only with npc. You cant enter text for not attached npc.

For fix this issue, you can use in your item use script

doevent "servicenpc::OnUseMenu"

 
And inside this npc and this label even you can add your code what will ask something from player.

Also attachrid from usescript is useless, script should be already attached to player.

 
Hi, Thanks for replying i will try this tomorrow when i get up in bed and will let you know if it works.
default_smile.png


@kairu input interaction can works only with npc. You cant enter text for not attached npc.

For fix this issue, you can use in your item use script

doevent "servicenpc::OnUseMenu"

 
And inside this npc and this label even you can add your code what will ask something from player.

Also attachrid from usescript is useless, script should be already attached to player.
i tried to do this but i got errors saying this:

[Warning]: Unable to restore stack! Double continuation
[Debug]: Previous script (lost):
[Debug]: Current script:
[Debug]: Source (NPC): Test (invisible/not on a map)

 
[Warning]: Unable to restore stack! Double continuation

This mean some thing already runned. player can execute only one script at same time.

Look like your Test npc script was run with attached player and you run another one script. This will not works

 
[Warning]: Unable to restore stack! Double continuation

This mean some thing already runned. player can execute only one script at same time.

Look like your Test npc script was run with attached player and you run another one script. This will not works

The Test npc script is the one i called on doevent. it may have something to do with my other scripts but it should show what current script i have open it with.

Edit: ive disabled all my custom scripts but still the same. It also crashes if i call the doevent on the item

 
Last edited by a moderator:
I made an item call a function which have player interaction to choose on a menu but it gets the error npc_scriptcont: failed npc->checknear test.

Heres an example of it:

Item id of Knife -> 1202

with script on it as:

callfunc "getSkill";

and the gist of the function of:

function script getSkill {
attachrid(getcharid(3));
retryRK:
dispbottom "Select a Skill you want.";
switch(select("Enchant Blade:Sonic Wave:Death Bound")){
case 1:
.@r = 1;
break;
case 2:
.@r = 2;
break;
case 3:
.@r = 3;
break;
default:
goto(retryRK);
}
close;
<More code...>
 I'm just wondering if there's any fix to this http://herc.ws/board/tracker/issue-3720-failed-npc-checknear-test-on-item-equip-function/

or any work around it.

would greatly appreciate it!
Menu without mes is always a problem.Try put mes before select, and see if original problem exists or not

Also, you don't need to do attachrid in the code you posted above.

 
I made an item call a function which have player interaction to choose on a menu but it gets the error npc_scriptcont: failed npc->checknear test.

Heres an example of it:

Item id of Knife -> 1202

with script on it as:

callfunc "getSkill";

and the gist of the function of:

function script getSkill {
attachrid(getcharid(3));
retryRK:
dispbottom "Select a Skill you want.";
switch(select("Enchant Blade:Sonic Wave:Death Bound")){
case 1:
.@r = 1;
break;
case 2:
.@r = 2;
break;
case 3:
.@r = 3;
break;
default:
goto(retryRK);
}
close;
<More code...>
 I'm just wondering if there's any fix to this http://herc.ws/board/tracker/issue-3720-failed-npc-checknear-test-on-item-equip-function/

or any work around it.

would greatly appreciate it!
Menu without mes is always a problem.Try put mes before select, and see if original problem exists or not

Also, you don't need to do attachrid in the code you posted above.
I tried it with mes but its still the same. however, instead of "doevent" on the script i used addtimer and no more errors

 
Back
Top