Jump to content
  • 0
kairu

failed npc->checknear test.

Question

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!

Edited by kairu

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

@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.

Share this post


Link to post
Share on other sites
  • 0

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


@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)

Share this post


Link to post
Share on other sites
  • 0

[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

Share this post


Link to post
Share on other sites
  • 0

[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

Edited by kairu

Share this post


Link to post
Share on other sites
  • 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!

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.

Share this post


Link to post
Share on other sites
  • 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!

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

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.