Jump to content

Question

Posted

hi i would like to request npc like quest but the reward will be type by players item_id and amount of that id

Example:

required item

fluff 10pcs 

four leaf clover 4pcs

brigan 4pcs

then if the item is completed

the player will type what item id and how many it will produce

1 answer to this question

Recommended Posts

  • 0
Posted
Spoiler
//===== rAthena Script ======================================= 
//= npc like quest but the reward will be type by players item_id and amount
//= https://rathena.org/board/topic/130400-item-npc/
//============================================================ 
//= 1.0 First Version. [Racaae]
//============================================================

prontera,162,230,3	script	Rich Man#blazingspear	4_M_MAYOR,{
	mes "[Rich Man]";
	mes "Hi. Can you bring me some items?";
	mes "You can choose ^FF7700whatever you want as reward^000000 for this quest!";
	next;
	switch(select("What do you want?", "I brought the items.", "Finish conversation.")) {
		case 1:
			mes "[Rich Man]";
			mes "This is the list:";
			for (.@i2 = 0; .@i2 <getarraysize(.request); .@i2+=2)
				mes "- " + .request[.@i2+1] + " <ITEM>" + getitemname(.request[.@i2]) + (getiteminfo(.request[.@i2], 10)?" ["+getiteminfo(.request[.@i2], 10)+"]":"") + "<INFO>" + .request[.@i2] + "</INFO></ITEM>";
			close;
		case 2:
			mes "[Rich Man]";
			for (.@i = 0; .@i <getarraysize(.request); .@i+=2) {
				if (countitem(.request[.@i]) < .request[.@i+1]) {
					mes "Huh... Where is the";
					mes "<ITEM>" + getitemname(.request[.@i]) + "<INFO>" + .request[.@i] + "</INFO></ITEM>?";
					close;
				}
			}
			mes "You got it all!";
			mes "What will you want from me?";
			mes "^3131FF- Type Item ID -^000000";
			next;
			input .@id;
			if (getitemname(.@id) == "null") {
				mes "[Rich Man]";
				mes "I don't think such a item exists.";
				mes "^3131FF- Invalid Item ID -^000000";
				close;
			}
			if (inarray(.blacklist,.@id) > -1) {
				mes "[Rich Man]";
				mes "This item is just too rare. Sorry.";
				close;
			}
			mes "[Rich Man]";
			mes "How many do you want?";
			mes "I cannot give you more than " + .max_reward_qty + ".";
			mes "^3131FF- Enter 0 to cancel -^000000";
			next;
			input .@q;
			if (.@q < 1) {
				mes "[Rich Man]";
				mes "Bye.";
				close;
			}
			if (.@q > .max_reward_qty) {
				mes "[Rich Man]";
				mes "I cannot give you all this amount.";
				close;
			}
			if ((MaxWeight - Weight) < 1000 || !checkweight(.@id, .@q)) {
				mes "^3131FF- You can't continue this quest because you have too many items. -^000000";
  				close;
  			}
  			mes "[Rich Man]";
  			mes "Are you sure you want " + .@q + " " + getitemname(.@id) + "?"; 
  			next;
  			if (select("Yes.", "No.") == 2) {
  				mes "[Rich Man]";
				mes "Bye.";
				close;
  			}
			for (.@i = 0; .@i <getarraysize(.request); .@i+=2)
				delitem .request[.@i], .request[.@i+1];
			getitem .@id, .@q;
			mes "[Rich Man]";
			mes "Take it.";
			emotion ET_THANKS;
			close;
		case 3:
			mes "[Rich Man]";
			mes "Bye.";
			close;
		}		

OnInit:

//===== CONFIG ==========================

	//Items IDs and amount to request
	setarray .request,
		914,  10,
		706,  4,
		7054, 4;

	//Blacklist IDs (player can't choose those items)
	setarray .blacklist,1599,2199,2181,2020,2182,2021,2541,2383,2410,2629,2630,1530;

	.max_reward_qty = 100;	//Max reward amount player can choose

//=======================================

	end;
}

 

 

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