Jump to content
  • 0
Sign in to follow this  
mofo

Locator NPC

Question

I'd like to request for an NPC that any player can use to locate another player by name. It would give the map name and coordinates for a cost (50k zeny?).I tried scripting my own, but I'm still lost as to how to properly code getmapxy. I'm still trying right now, but I figured I'd post here to speed up the process. Thanks to anyone who would take the time to help.

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Maybe try this?

 

-	script	PlayerLocator	-1,{OnWhisperGlobal:	mes "Tell me a player name to track. Must be an exact player name, cases included.";	mes "I'll take "+ .cost +" Zeny even if the search fails.";	input .@name$;	next;	set Zeny, Zeny - .@cost;	if (getmapxy(.@map$,.@x,.@y,0,.@name$) == -1) {		mes "Sorry, I can't seem to find him!";		close;	}	mes "I found "+ .@name$ +" in "+ .@map$ +", "+ .@x +", "+ .@i +".";	mes "Hope you can find him too!";	close;OnInit:	set .cost, 50000;	end;}

 

Haven't tested it myself, so IDK if that'll work but at least should if script_commands.txt isn't wrong or I've made a mistake somewhere.

Share this post


Link to post
Share on other sites
  • 0

Yep, I guess that's a typo, also this part.

 "+ .@x +", "+ .@i +"."; 

I changed it to 

 "+ .@x +", "+ .@y +"."; 

 

 

Other than that, it works great.
 
Oh one last thing, I removed onwhisperglobal and turned it into an npc. Now there's no option to cancel the search and anyone who clicks on it is forced to spend 50k. Haha, what do I change or insert to give the option to search or cancel?

Share this post


Link to post
Share on other sites
  • 0
prontera,149,172,3    script    testetsttest    100,{    mes "Tell me a player name to track. Must be an exact player name, cases included.";    mes "I'll take "+ .cost +" Zeny even if the search fails.";    if ( select ( "Go:Stop" ) == 2 ) close;    input .@name$;    next;  	 if (getmapxy(.@map$,.@x,.@y,0,.@name$) == -1) {    mes "Sorry, I can't seem to find him!";    close;    }    mes "I found "+ .@name$ +" in "+ .@map$ +", "+ .@x +", "+ .@y +".";    mes "Hope you can find him too!";    set Zeny, Zeny - .cost;    close;    	 OnInit:    set .cost, 50000;    end;}
Edited by quesoph

Share this post


Link to post
Share on other sites
  • 0

Thanks, it's missing zeny check. I can still search for players even with 0 zeny. Then the console shows error about not being able to set zeny to negative value. Doesn't crash, just gives an error.

Share this post


Link to post
Share on other sites
  • 0

Sorry for the typos: I made the box without even revising it so that was my bad.

 

I'll make the zeny check when I'm back on my pc if someone else hasn't done that before.

Share this post


Link to post
Share on other sites
  • 0

prontera,149,172,3    script    testetsttest    100,{    mes "Tell me a player name to track. Must be an exact player name, cases included.";    mes "I'll take "+ .cost +" Zeny even if the search fails.";if ( select ( "Go:Stop" ) == 2 ) close;    if ( Zeny < .cost ) {        mes "Not Enough Zeny.";	    close;    }    input .@name$;    next;  	 if (getmapxy(.@map$,.@x,.@y,0,.@name$) == -1) {    mes "Sorry, I can't seem to find him!";    close;    }    mes "I found "+ .@name$ +" in "+ .@map$ +", "+ .@x +", "+ .@y +".";    mes "Hope you can find him too!";    set Zeny, Zeny - .cost;    close;    	 OnInit:    set .cost, 50000;    end;}

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...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.