Wise Posted December 5, 2012 Posted December 5, 2012 (edited) So I want to ask how could I do this kind of script: input @AnotherPlayerName$; if the player is online, that player will be forced to talk to an npc else if the player does not exist, mes "You seemed to enter an invalid character's name" else, mes "Sorry but the player is offline."; Edit: And bonus question, is it possible to make this kind of npc name? 1@ghd,71,76,7 duplicate(test) charname$#1 81 if you just added set charname$,strcharinfo(0); ? Edited December 5, 2012 by Mavis Quote
Euphy Posted December 5, 2012 Posted December 5, 2012 - script sample -1,{ OnWhisperGlobal: input .@n$; if (!isloggedin(getcharid(3,.@n$),getcharid(0,.@n$)) { dispbottom "That character is not connected."; end; } attachrid(getcharid(3,.@n$)); mes "Message"; close; } To your second question: you can use 'setnpcdisplay' to change an NPC name. 1 Quote
Wise Posted December 5, 2012 Author Posted December 5, 2012 (edited) - script sample -1,{ OnWhisperGlobal: input .@n$; if (!isloggedin(getcharid(3,.@n$),getcharid(0,.@n$)) { dispbottom "That character is not connected."; end; } attachrid(getcharid(3,.@n$)); mes "Message"; close; } This actually worked. It sent a message to my second character. However, it stucks on the next part of the script. so here's my script: input(.@name$); if(getcharid(0,.@name$)){ mes "[inviter]"; mes "Invitation has been sent"; close2; attachrid(getcharid(3,.@name$)); mes "You are invited to join your friend in his journey"; next; switch(select("Accept","Reject")){ case 1: warpchar strcharinfo(3),81,63,getcharid(0,.@name$); case 2: attachrid(getcharid(3,.@myname$)); dispbottom .@name$+" has rejected your offer."; end;}} edit: it seems like it doesn't work if the other player is on another map. the first message works. except for the next part of the script =\ and for the setnpcdisplay: setnpcdisplay("dog", strcharinfo(0)+"'s Dog"); 1@ghd,74,82,4 duplicate(dog) dog#1 81 - script dog -1,{ mes "[" + getarg(0) + "]"; mes "arf arf..."; close; } Edited December 5, 2012 by Mavis Quote
KeyWorld Posted December 5, 2012 Posted December 5, 2012 You have to use doevent for the attachrid stuff tu avoid problem with next, menu, etc. attachrid .@aid; doevent "mynpc::OnAttach"; end; OnAttach: <stuff>; About the setnpcdisplay, it has to be IN the npc. Quote
Question
Wise
So I want to ask how could I do this kind of script:
input @AnotherPlayerName$;
if the player is online, that player will be forced to talk to an npc
else if the player does not exist, mes "You seemed to enter an invalid character's name"
else, mes "Sorry but the player is offline.";
Edit:
And bonus question, is it possible to make this kind of npc name?
1@ghd,71,76,7 duplicate(test) charname$#1 81
if you just added
set charname$,strcharinfo(0);
?
Edited by Mavis4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.