Jump to content
  • 0

script command giving another script to a player


Wise

Question


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   26
  • Joined:  11/19/11
  • Last Seen:  

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 Mavis
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

-    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.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   26
  • Joined:  11/19/11
  • Last Seen:  

-	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. :o

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 by Mavis
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  147
  • Reputation:   26
  • Joined:  11/19/11
  • Last Seen:  

Thanks! it worked =)

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...