NPC Script with Functions not working - invisible/not on a map error

latheesan

New member
Messages
41
Points
0
Age
38
Location
United Kingdom
Emulator
Hi everyone,

I've been away from Ragnarok Online for a very long time, I have recently picked it up and I have started NPC Scripting again.

I am working on a daily reward script that uses function and I am getting this error: invisible/not on a map error

I have managed to re-produce the error with this test script:

// Main Script- script L_Test -1,{ // When script starts OnInit: // Configuration set .npc$,"[ Test NPC ] : "; end; // When player logins into game OnPCLoginEvent: dispbottom(.npc$ + callfunc(L_SayHello, strcharinfo(0))); end; }function script L_SayHello { set .playerName$,getarg(0); return "Hello "+ .playerName$;}
This script structure is identical to my real script. So when I start the server and login, I get the following error in map server:

[Warning]: Unexpected type for argument 1. Expected string.[Debug]: Data: variable name='L_SayHello' index=0[Debug]: Function: callfunc[Debug]: Source (NPC): L_Test (invisible/not on a map)[Error]: script:callfunc: function not found! [0][Debug]: Source (NPC): L_Test (invisible/not on a map)
Any idea what this error is about?

 
Last edited by a moderator:
@@latheesan

did you specify where the NPC is located on the script?

ex: prontera,150,150,5 script  NPC NAME    NPC_ID,{

 
Last edited by a moderator:
@@latheesan

The function needs to be in "", you also should use = instead of set. You also don't need to pass strcharinfo, you can call it in your function.

Code:
// Main Script-	script	L_Test	-1,{	// When script starts	OnInit:		// Configuration		set .npc$,"[ Test NPC ] : ";	end;		// When player logins into game	OnPCLoginEvent:		dispbottom( .npc$ + callfunc( "L_SayHello" ) );	end;}function	script	L_SayHello	{	return "Hello "+ strcharinfo( 0 );}
 
Last edited by a moderator:
Back
Top