Jump to content
  • 0

Npc doesnt work properly


bartsimpson1

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  09/30/16
  • Last Seen:  

Hello rathena Users,

I scripted my first npc and now I have the problem that I cant talk to the npc. Thats why I think there is a problem with the script. Could someone help me a little bit?

Spoiler

prontera,160,192,5 script Jellopy Trader 757,{


mes "Hello, I want to trade some Jellopys for various Items.";
next;
mes " I give you 1 Yggdrasilberry for 100 Jellopys, 20 Old Blue Boxes for 200 Jellopys and 20 Old Violet Boxes for 300 Jellopys.";
next;
menu "Yggdrasilberry",L_Yggdrasilberry,"Old Blue Box",L_OldBlueBox,"Old Violet Box",L_OldVioletBox,"Nevermind",L_Cancel;

L_Yggdrasilberry:
if( countitem(909) < 100 );
    mes "You didnt have 100 "+getitemname( 909 );
else{
    set .@Amount,( countitem(909) / 100 );
    delitem 909,( .@Amount * 100 );
    getitem 607,.@Amount;
    mes "Done...you gained "+.@Amount+" "+getitemname(607);
}
close;


L_OldBlueBox:
if( countitem(909) < 200 );
    mes "You didnt have 100 "+getitemname( 909 );
else{
    set .@Amount,( countitem(909) / 200 );
    delitem 909,( .@Amount * 200 );
    getitem 603,( .@Amount * 20 );
    mes "Done...you gained "+.@Amount+" "+getitemname(603);
}
close;


L_OldVioletBox:
if( countitem(909) < 300 );
    mes "You didnt have 100 "+getitemname( 909 );
else{
    set .@Amount,( countitem(909) / 300 );
    delitem 909,( .@Amount * 300 );
    getitem 617,( .@Amount * 20 );
    mes "Done...you gained "+.@Amount+" "+getitemname(617);
}
close;

L_Cancel:

mes "Come back anytime!";

close;

end;

}

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/07/18
  • Last Seen:  

prontera,160,192,5 script Jellopy Trader 757,{
 mes "Hello, I want to trade some Jellopys for various Items.";
 next;
 mes " I give you 1 Yggdrasilberry for 100 Jellopys, 20 Old Blue Boxes for 200 Jellopys and 20 Old Violet Boxes for 300 Jellopys.";
 next;
 menu "Yggdrasilberry",L_Yggdrasilberry,"Old Blue Box",L_OldBlueBox,"Old Violet Box",L_OldVioletBox,"Nevermind",L_Cancel;

L_Yggdrasilberry:
 if( countitem(909) < 100 ){
     mes "You didnt have 100 "+getitemname( 909 );
  }
     set .@Amount,( countitem(909) / 100 );
     delitem 909,( .@Amount * 100 );
     getitem 607,.@Amount;
     mes "Done...you gained "+.@Amount+" "+getitemname(607);
 close;

 L_OldBlueBox:
 if( countitem(909) < 200 ){
     mes "You didnt have 100 "+getitemname( 909 );
  }
      set .@Amount,( countitem(909) / 200 );
     delitem 909,( .@Amount * 200 );
     getitem 603,( .@Amount * 20 );
     mes "Done...you gained "+.@Amount+" "+getitemname(603);
   close;


 L_OldVioletBox:
 if( countitem(909) < 300 ){
     mes "You didnt have 100 "+getitemname( 909 );
  }
      set .@Amount,( countitem(909) / 300 );
     delitem 909,( .@Amount * 300 );
     getitem 617,( .@Amount * 20 );
     mes "Done...you gained "+.@Amount+" "+getitemname(617);
 close;


L_Cancel:

mes "Come back anytime!";

close;

end;

}

 

Edited by Emistry
Please use codebox.
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  61
  • Topics Per Day:  0.02
  • Content Count:  911
  • Reputation:   166
  • Joined:  11/27/14
  • Last Seen:  

Can you check this part ?

prontera,160,192,5[tab]script[tab]Jellopy Trader 757,{

 

Use Tab here not space

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  98
  • Reputation:   74
  • Joined:  12/04/14
  • Last Seen:  

the problem is in "if( countitem(909) < 100 );" & "if( countitem(909) < 200 );" & "if( countitem(909) < 300 );"

you should remove the ";"

 

Edited by Keitenai
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...