Wise Posted December 5, 2012 Group: Members Topic Count: 46 Topics Per Day: 0.01 Content Count: 147 Reputation: 26 Joined: 11/19/11 Last Seen: October 28, 2021 Share 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 Link to comment Share on other sites More sharing options...
Euphy Posted December 5, 2012 Group: Members Topic Count: 72 Topics Per Day: 0.02 Content Count: 2997 Reputation: 1132 Joined: 05/27/12 Last Seen: June 1, 2017 Share 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 Link to comment Share on other sites More sharing options...
Wise Posted December 5, 2012 Group: Members Topic Count: 46 Topics Per Day: 0.01 Content Count: 147 Reputation: 26 Joined: 11/19/11 Last Seen: October 28, 2021 Author Share 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 Link to comment Share on other sites More sharing options...
KeyWorld Posted December 5, 2012 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 379 Reputation: 304 Joined: 11/10/11 Last Seen: December 2, 2014 Share 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 Link to comment Share on other sites More sharing options...
Wise Posted December 5, 2012 Group: Members Topic Count: 46 Topics Per Day: 0.01 Content Count: 147 Reputation: 26 Joined: 11/19/11 Last Seen: October 28, 2021 Author Share Posted December 5, 2012 Thanks! it worked =) Quote Link to comment Share on other sites More sharing options...
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 MavisLink to comment
Share on other sites
4 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.