Jump to content
  • 0
Chronos

[Request] Quest Npc

Question

its a normal quest npc and i have like 37 quest items their. and all of them are likely thesame, these quest item is just 1 npc and they can scroll down and look what does this do.. like that :)

Requirments are these are all thesame.

300poring coin

500mithril coin

1 ghostring card

this are the item id :

19000,19001,19002,19003,19004,19005,19006,19007,19008,19009,19010,19011,19012,19013,19014,19015,19016,19017,19018,

19019,19020,19021,19022,19023,19024,19025,19026,19027,19028,19029,19030,19031,19032,19033,19034,19035,19036.

Link to comment
Share on other sites

24 answers to this question

Recommended Posts

ah good find! My bad... I'm in the middle of two projects... (NPC Script Requests + PHP Project) so they tend to blend at times... lol

thanks for the find

Updated

// I Was just talking with Brian about this last night actually...


// Create the Category Array
setarray [email protected]_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray [email protected]_0[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 1 is the Index of the Category "Bow")
setarray [email protected]_1[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 2 is the Index of the Category "Dagger")
setarray [email protected]_2[0],1,2,3,4,5,6,7,8,9; 

// Create Item Hunt Group Arrays (By Category) 
// For adding Zeny, use Item ID 0, and in Amount, use Amount of Zeny
setarray [email protected]_0[0],0,502,503;
setarray [email protected]_amount_0[0],1000,2,3;

setarray [email protected]_1[0],501,502,503;
setarray [email protected]_amount_1[0],1,2,3;

setarray [email protected]_2[0],501,502,503;
setarray [email protected]_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set [email protected], select([email protected]_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
set [email protected]_name$, getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
set [email protected]_menu$, [email protected]_menu$ + ([email protected]_menu$ == "" ? [email protected]_name$ : ":" + [email protected]_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set [email protected]_choice, select([email protected]_menu$) - 1;

// Determine If Player Has Required Items
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
set [email protected]_id, getd("[email protected]_" + [email protected] + "[" + [email protected] + "]");
set [email protected]_requires, getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");

if ([email protected]_id) {
set [email protected]_has, countitem([email protected]_id);
set [email protected]_name$, getitemname([email protected]_id); 
if ([email protected]_has < [email protected]_requires) {
set [email protected]$[getarraysize([email protected]$)], "You Still Need " + ([email protected]_requires - [email protected]_has) + " " + [email protected]_name$ + (([email protected]_requires - [email protected]_has) > 1 ? "'s." : ".");
}
} else {
// Is Zeny
if (Zeny < [email protected]_requires) {
set [email protected]$[getarraysize([email protected]$)], "You Still Need " + ([email protected]_requires - Zeny) + " z.";
}
}
}

// Determine Errors to Display
if (getarraysize([email protected]$)) {
for (set [email protected], 0; [email protected] < getarraysize([email protected]$); set [email protected], [email protected] + 1) {
mes [email protected]$[[email protected]];
}
close;
}

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]");
mes "Item Name: " + getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"));

// Take Items Away
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
delitem getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"), getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");
} 

// Give Item
getitem getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"), 1;
close;
}

  • Upvote 1
Link to comment
Share on other sites

prontera,99,99,4	script	Quest NPC	706,{
mes "[Quest NPC]";
mes "I have an awesome item list here, you want to take a simple quest?.";
next;
menu "Nope i dont want!",-, "Yes show me the list.",M_DO;
mes "[Quest NPC]";
mes "Ok bye..";
emotion e_ic;
close;

M_DO:			
mes "[Quest NPC]";
mes "You can select one from the following..";
next;
menu "ITEM1",A_ITEM1,"ITEM2",A_ITEM2,"ITEM3",A_ITEM3,"ITEM4",A_ITEM4,"ITEM5",A_ITEM5,"ITEM6",A_ITEM6;

A_ITEM1:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}
A_ITEM2:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}
A_ITEM3:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}
A_ITEM4:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}
A_ITEM5:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}
A_ITEM6:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}


M_END:
mes "[Quest NPC]";
mes "See you...";
emotion e_yawn;
close;

}

"ITEM1",A_ITEM1,

Edit the ITEM1 into your item Name.

getitem 999,1; // Item ID Number

Edit the 999 into your item ID.

And if you want to add more items just add another line..

"ITEM6",A_ITEM6; to "ITEM6",A_ITEM6,"ITEM7",A_ITEM7;

Just don't forget to change the number and add this ","

And add another like this

	A_ITEM7:
mes "[Quest NPC]";
mes "You want this gear?";
mes "You need this items before you have mine.";
mes "Poring Coins [300 ea]";
mes "Mithril Coins [500 ea]";
mes "Ghostring Card [1 ea]";
next;
if(select("Get It:Cancel")==2) goto M_END;
if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
mes "[Quest NPC]";
mes "Not enough coins";
close;
} else {
mes "[Quest NPC]";
mes "Here you go!";
delitem 7539,300;
delitem 674,500;
delitem 4047,1;
getitem 999,1; // Item ID Number
close;
}

~ vBrenth

Link to comment
Share on other sites

prontera,158,173,4	script	Quest NPC	88,{

mes .npc$;
mes "Want to make a trade?";
next;

switch(select("What are the require items?","What do you have?")) {
	case 1: // Required Items
		mes .npc$;
		mes "300 Poring Coins";
		mes "500 Mithril Coins";
		mes "1 Ghostring Card";
		close;

	case 2: // What do you have

			  // Build Menu
	  for (set [email protected], 0; [email protected] < getarraysize(.items); set [email protected], [email protected] + 1) {
			 set [email protected]$,  ([email protected]$ == "" ? getitemname(.items[[email protected]]) + " Quest" : [email protected]$ + ":" + getitemname(.items[[email protected]]) + " Quest");
		  }

	  set [email protected]_item, select([email protected]$) - 1;

	  // Check for Required Items
	  if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
				 mes .npc$;
				 mes "Not enough coins";
				 close;
		  }

			  // Pass Complete (Check Weight)
		  else if (!checkweight(.items[[email protected]_item], 1)) {
		 mes "You cannot handle this items load...";
		 close;
			  }

			  // Complete Quest
		  else {
				mes .npc$;
				mes "Awesome! Here is your item!";
				delitem 7539, 300;
				delitem 674, 500;
				delitem 5057, 1;
				getitem .items[[email protected]_item], 1;
				mes "Have a nice day!";
				close;
			  }



OnInit:
set .npc$, "[" + strnpcinfo(1) + "]";

setarray .items[0],19000,19001,19002,19003,19004,19005,19006,19007,19008,19009,19010,19011,19012,19013,19014,19015,19016,19017,19018,
19019,19020,19021,19022,19023,19024,19025,19026,19027,19028,19029,19030,19031,19032,19033,19034,19035,19036;

end;

}

Tiny Bit Shorter, and MUCH easier to add / remove items from, simply modify the array below the OnInit, to include or exclude item id's... (Keep in mind this limits to 128)

Edited by Z3R0
Completely messed up compact if (fixed)
  • Upvote 1
Link to comment
Share on other sites

erm..i just feel weird in this..

[email protected] == "" ? [email protected] = getitemname(.items[[email protected]]) + " Quest" : [email protected] + getitemname(.items[[email protected]]) + " Quest";

will it work also ?

i mean usually it would be look like this ?

set @Menu$,@Menu$ + getitemname( .ItemList[[email protected]] )+":";

erm..i have posted 1 at eAthena last time on your requested topic. ( Topic Link )

but not sure you have saw it or not..so i will post here for you again

prontera,155,181,5	script	Sample	718,{
mes "What Items you would like to have ?";
set @Menu$,"";
setarray .ItemList[0],19000,19001,19002,19003,19004,19005,19006,19007,19008,19009,19010,19011,19012,19013,19014,19015,19016,19017,19018,19019,19020,19021,19022,19023,19024,19025,19026,19027,19028,19029,19030,19031,19032,19033,19034,19035,190360;
for( set [email protected],0; [email protected] < getarraysize( .ItemList ); set [email protected],[email protected] + 1 ){
set @Menu$,@Menu$ + getitemname( .ItemList[[email protected]] )+":";
}
next;
set [email protected],select( @Menu$ )-1;
mes "You need those items :";
mes "[ "+countitem(7539)+" / 250 ] Poring Coin";
mes "[ "+countitem(674)+" / 450 ] Mithril Coin";
mes "[ "+countitem(4047)+" / 1 ] Ghostring Card";
if( countitem(7539) < 250 || countitem(674) < 450 || !countitem(4047) )close;
if( select("Exchange:Cancel") == 2 )close;
delitem 7539,250;
delitem 674,450;
delitem 4047,1;
getitem .ItemList[[email protected]],1;
mes "gained 1 "+getitemname( .ItemList[[email protected]] );
close;
}

* Edit : Changed to using Code instead of Codebox to wrap code since Codebox didnt work temporary. *

Edited by Emistry
Link to comment
Share on other sites

erm..i just feel weird in this..

[email protected] == "" ? [email protected] = getitemname(.items[[email protected]]) + " Quest" : [email protected] + getitemname(.items[[email protected]]) + " Quest";

will it work also ?

i mean usually it would be look like this ?

set @Menu$,@Menu$ + getitemname( .ItemList[[email protected]] )+":";

The reason behind that, is a compact IF statement, since you do not want a hidden element at the end of the menu...

"select:this:" will create a blank element at the bottom of the menu, and thus you do NOT want to append that...

all that is doing is...

if ([email protected]$ == "") { [email protected]$ = getitemname(.items[[email protected]]) + " Quest"; }
else { [email protected]$ = [email protected]$ + ":" + getitemname(.items[[email protected]]) + " Quest"; }

corrected, some of my variable name flaws, and the missing ":"

Link to comment
Share on other sites

prontera,158,173,4	script	Quest NPC	88,{

mes .npc$;
mes "Want to make a trade?";
next;

switch(select("What are the require items?","What do you have?")) {
	case 1: // Required Items
		mes .npc$;
		mes "300 Poring Coins";
		mes "500 Mithril Coins";
		mes "1 Ghostring Card";
		close;

	case 2: // What do you have

                 // Build Menu
	  for (set [email protected], 0; [email protected] < getarraysize(.items); set [email protected], [email protected] + 1) {
 	           set [email protected]$,  ([email protected]$ == "" ? getitemname(.items[[email protected]]) + " Quest" : [email protected]$ + ":" + getitemname(.items[[email protected]]) + " Quest");
          }

	  set [email protected]_item, select([email protected]$) - 1;

	  // Check for Required Items
	  if(countitem(7539) < 300 || countitem(674) < 500 || countitem(4047) < 1) {
                    mes .npc$;
                    mes "Not enough coins";
                    close;
          }

                 // Pass Complete (Check Weight)
          else if (!checkweight(.items[[email protected]_item], 1)) {
	     mes "You cannot handle this items load...";
	     close;
                 }

                 // Complete Quest
          else {
                   mes .npc$;
                   mes "Awesome! Here is your item!";
                   delitem 7539, 300;
                   delitem 674, 500;
                   delitem 5057, 1;
                   getitem .items[[email protected]_item], 1;
                   mes "Have a nice day!";
                   close;
                 }



OnInit:
set .npc$, "[" + strnpcinfo(1) + "]";

setarray .items[0],19000,19001,19002,19003,19004,19005,19006,19007,19008,19009,19010,19011,19012,19013,19014,19015,19016,19017,19018,
19019,19020,19021,19022,19023,19024,19025,19026,19027,19028,19029,19030,19031,19032,19033,19034,19035,19036;

end;

}

Tiny Bit Shorter, and MUCH easier to add / remove items from, simply modify the array below the OnInit, to include or exclude item id's... (Keep in mind this limits to 128)

haha you overkilleed it man :)

Link to comment
Share on other sites

Yeah for some reason the codebox is still to long, lets wait our admins to fix it.... and wait for Z3R0 release the copycode!

Edited by vBrenth
Link to comment
Share on other sites

Yes [ codebox ] works:

//===== eAthena Script =======================================
//= Express Novice Zone
//===== By: ==================================================
//= Brian
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= eAthena SVN
//===== Description: =========================================
//= instant Job level 10, ready to job change
//===== Additional Comments: =================================
//= 
//============================================================

new_1-1,58,114,4	script	Express Novice Zone	743,{
mes "[Express Novice Zone]";
if (Class==Job_Novice && BaseLevel==1 && JobLevel==1) {
	mes "^FF0000- skip the Novice Zone";
	mes "- NO additional items/zeny";
	mes "^008000- Base Level 15,  Job Level 10";
	mes "- warp to Job Changer";
	if (select("No, thanks.:Continue, warp to Prontera")==2) {
		close2;
		set BaseExp, 3361; // to Base Level 15
		set JobExp, JobExp + 1151; // to Job Level 10
		skill "NV_BASIC",10,0;
		set SkillPoint, 0;

		sleep2 1000;
		specialeffect2 501; // Chase Walk Animation
		sleep2 750;
		specialeffect2 445; // High Jump (Jump)
		sleep2 1000;

		savepoint "prontera",155,188;
		warp "prontera",149,194;
	}
} else {
	mes "This service is only available to 1/1 Novices.";
}
close;
}

Link to comment
Share on other sites

nice one zero, but can I ask. what if I want to make the same NPC above but compile 2 NPC together. Example :

this are the item id :

19000,19001,19002,19003,19004,19005,19006,19007,19008,19009,19010,19011,19012,19013,19014,

19015,19016,19017,19018,19019,19020,19021,19022,19023,19024,19025,19026,19027,19028,19029,

19030,19031,19032,19033,19034,19035,19036.

and all of this is Sword category weapon and the requirement are the same as above.

But what if I wanted to make a Bow category weapon and the ID is 30001,30002,30003,30004 and so on.. and the requirement is a bit different :

100 poring coin

500 gold coin

1 eddga card card

2 000 000 zeny.

can we combine it? Meaning before player start quest he can select what category weapon :

Sword

Knife

Bow

Axe

Then there's any subcategory

Sword > Ice Sword,Fire Sword etc

Knife > Ice Knife, Fire Knife etc.

Thanks in regard :D

Edited by DoTARO Administrator
Link to comment
Share on other sites

sub categories,get into a whole new market... as for right now, that's where I'm at, I'm currently in the process of working on another script, so I will have to get back to you on this one... unless someone wants to take it up

Link to comment
Share on other sites

I'm not saying it can't be done in a nice fashion... it most likely can, I just don't have the time just yet to develop something that clean... maybe sometime tonight or this weekend I can look into it.

I tend to script everything "soft-coded" which is what every scripter "SHOULD" do...

By this I mean, no variable used is "hard-coded" into the main code, everything should be easily editable in a nice config file, and only the core code should be used for the mechanics...

A lot of people shy away from that, and that's why things like this are hard to make or change... :D

Link to comment
Share on other sites

Okay Zero , I'll wait for your code. :D Looking forward for it. I know that you want your script to be nice and tidy and you're a busy man. BTW thanks again for the time here. I hope I can see that script. Because I want to make like 10 main category and each of the main have like another 10 sub category. I hope it can fit. If you just give an example with 2 Main and some sub category I think I can understand and edit it ;)

Link to comment
Share on other sites

This is NOT the full NPC, however, you can test this out, in a basic NPC, modifying these array values and test it out

This will allow for 128 Categories

128 Items Per Category

All easily Editable :D without having to make crazy changes to the core code

// I Was just talking with Brian about this last night actually...

// ****************************** START EDIT AREA *********************************

// Create the Category Array
setarray [email protected]_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray [email protected]_0[0],1,2,3,4,5,6,7,8,9;

// Item ID's (The Number 1 is the Index of the Category "Bow")
setarray [email protected]_1[0],1,2,3,4,5,6,7,8,9;

// Item ID's (The Number 2 is the Index of the Category "Dagger")
setarray [email protected]_2[0],1,2,3,4,5,6,7,8,9;

// Create Item Hunt Group Arrays (By Category)
setarray [email protected]_0[0],501,502,503;
setarray [email protected]_amount_0[0],1,2,3;

setarray [email protected]_1[0],501,502,503;
setarray [email protected]_amount_1[0],1,2,3;

setarray [email protected]_2[0],501,502,503;
setarray [email protected]_amount_2[0],1,2,3;

// ****************************** END EDIT AREA *********************************

// *********************** CORE CODE STARTS HERE *******************************

// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set [email protected], select([email protected]_menu$) - 1;

// Now Build the Menu Based on This Selection
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
set [email protected]_name$, getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
set [email protected]_menu$, [email protected]_menu$ + ([email protected]_menu$ == "" ? [email protected]_name$ : ":" + [email protected]_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set [email protected]_choice, select([email protected]_menu$) - 1;

// Determine If Player Has Required Items
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
if (countitem(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]")) < getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]")) {
mes "You Do Not Have All The Items";
close;
}
}

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]");
mes "Item Name: " + getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"));

// Take Items Away
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
delitem getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"), getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");
}

// Give Item
getitem getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"), 1;
close;

// **************************** END CORE CODE *****************************

Link to comment
Share on other sites

Wow Zero nice. Unbelievable.. I hope I was good as you. Thanks for this. I'll try it out. It seems that this is easily editable for beginner like me. I'll try it out now. Thanks sir!

Link to comment
Share on other sites

Edit: Added Error Support to Notify Player of Amount of Items Still Missing

// I Was just talking with Brian about this last night actually...


// Create the Category Array
setarray [email protected]_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray [email protected]_0[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 1 is the Index of the Category "Bow")
setarray [email protected]_1[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 2 is the Index of the Category "Dagger")
setarray [email protected]_2[0],1,2,3,4,5,6,7,8,9; 

// Create Item Hunt Group Arrays (By Category)
setarray [email protected]_0[0],501,502,503;
setarray [email protected]_amount_0[0],1,2,3;

setarray [email protected]_1[0],501,502,503;
setarray [email protected]_amount_1[0],1,2,3;

setarray [email protected]_2[0],501,502,503;
setarray [email protected]_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set [email protected], select([email protected]_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
set [email protected]_name$, getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
set [email protected]_menu$, [email protected]_menu$ + ([email protected]_menu$ == "" ? [email protected]_name$ : ":" + [email protected]_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set [email protected]_choice, select([email protected]_menu$) - 1;

// Determine If Player Has Required Items
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
[email protected]_has, countitem(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
[email protected]_requires, getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");
[email protected]_name$, getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
if ([email protected]_has < [email protected]_requires) {
set [email protected]$[getarraysize([email protected]$)], "You Still Need " + ([email protected]_requires - [email protected]_has) + " " + [email protected]_name$ + (([email protected]_requires - [email protected]_has) > 1 ? "'s." : ".");
}
}

// Determine Errors to Display
if (getarraysize([email protected]$)) {
for (set [email protected], 0; [email protected] < getarraysize([email protected]$); set [email protected], [email protected] + 1) {
mes [email protected]$[[email protected]];
}
close;
}

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]");
mes "Item Name: " + getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"));

// Take Items Away
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
delitem getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"), getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");
} 

// Give Item
getitem getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"), 1;
close;

  • Upvote 1
Link to comment
Share on other sites

// Create Item Hunt Group Arrays (By Category)
setarray [email protected]_0[0],501,502,503;
setarray [email protected]_amount_0[0],1,2,3;

Zero just wondering can we add a zeny amount in this item requirement for each item? What that code would be?

Link to comment
Share on other sites

Editted: Added The Ability to Add Zeny to the Mix

// I Was just talking with Brian about this last night actually...


// Create the Category Array
setarray [email protected]_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray [email protected]_0[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 1 is the Index of the Category "Bow")
setarray [email protected]_1[0],1,2,3,4,5,6,7,8,9; 

// Item ID's (The Number 2 is the Index of the Category "Dagger")
setarray [email protected]_2[0],1,2,3,4,5,6,7,8,9; 

// Create Item Hunt Group Arrays (By Category) 
// For adding Zeny, use Item ID 0, and in Amount, use Amount of Zeny
setarray [email protected]_0[0],0,502,503;
setarray [email protected]_amount_0[0],1000,2,3;

setarray [email protected]_1[0],501,502,503;
setarray [email protected]_amount_1[0],1,2,3;

setarray [email protected]_2[0],501,502,503;
setarray [email protected]_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set [email protected], select([email protected]_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
set [email protected]_name$, getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"));
set [email protected]_menu$, [email protected]_menu$ + ([email protected]_menu$ == "" ? [email protected]_name$ : ":" + [email protected]_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set [email protected]_choice, select([email protected]_menu$) - 1;

// Determine If Player Has Required Items
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
[email protected]_id, getd("[email protected]_" + [email protected] + "[" + [email protected] + "]");
[email protected]_requires, getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");

if ([email protected]_id) {
[email protected]_has, countitem([email protected]_id);
[email protected]_name$, getitemname([email protected]_id); 
if ([email protected]_has < [email protected]_requires) {
set [email protected]$[getarraysize([email protected]$)], "You Still Need " + ([email protected]_requires - [email protected]_has) + " " + [email protected]_name$ + (([email protected]_requires - [email protected]_has) > 1 ? "'s." : ".");
}
} else {
// Is Zeny
if (Zeny < [email protected]_requires) {
set [email protected]$[getarraysize([email protected]$)], "You Still Need " + ([email protected]_requires - Zeny) + " z.";
}
}
}

// Determine Errors to Display
if (getarraysize([email protected]$)) {
for (set [email protected], 0; [email protected] < getarraysize([email protected]$); set [email protected], [email protected] + 1) {
mes [email protected]$[[email protected]];
}
close;
}

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]");
mes "Item Name: " + getitemname(getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"));

// Take Items Away
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
delitem getd("[email protected]_" + [email protected] + "[" + [email protected] + "]"), getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");
} 

// Give Item
getitem getd("[email protected]_" + [email protected] + "[" + [email protected]_choice + "]"), 1;
close;

Link to comment
Share on other sites

Editted: Added The Ability to Add Zeny to the Mix

// Determine If Player Has Required Items
for (set [email protected], 0; [email protected] < getarraysize(getd("[email protected]_" + [email protected])); set [email protected], [email protected] + 1) {
[email protected]_id, getd("[email protected]_" + [email protected] + "[" + [email protected] + "]");
[email protected]_requires, getd("[email protected]_amount_" + [email protected] + "[" + [email protected] + "]");

if ([email protected]_id) {
[email protected]_has, countitem([email protected]_id);
[email protected]_name$, getitemname([email protected]_id);

Seems like you forgot a few "set" before the "[email protected]" O.O

Link to comment
Share on other sites

Zero I have tested your script. Sorry for late reply, just finish my study.

There is some problem..

first is the selection of category. When i click at the NPC it only shows one option which is sword. the bow and dagger appear missing.

Then the second is that you said the zero is zeny right

setarray [email protected]_0[0],0,502,503;
setarray [email protected]_amount_0[0],1000,2,3;

but when I want to make the quest it says @delitem 0 is unknow or something like that.

I check at putty it said Debug. so I change it to item ID instead.

BUMP BUMP!

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.