Jump to content
  • 0

script command giving another script to a player


Question

Posted (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 by Mavis

4 answers to this question

Recommended Posts

Posted

-    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
Posted (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. :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
Posted

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.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...