Locator NPC

mofo

New member
Messages
97
Points
0
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.

 
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.

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

"+ .@x +", "+ .@i +"."; 
I changed it to 

Code:
 "+ .@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?
 
Code:
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;}
 
Last edited by a moderator:
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.

 
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.

 
Code:
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;}
 
Thanks for the corrections quesoph, and sorry again!

 
Last edited by a moderator:
Back
Top