Jump to content
  • 0

[Request] Quest Npc


Chronos

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  85
  • Reputation:   11
  • Joined:  11/06/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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 .@main_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray .@equip_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 .@equip_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 .@equip_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 .@items_0[0],0,502,503;
setarray .@items_amount_0[0],1000,2,3;

setarray .@items_1[0],501,502,503;
setarray .@items_amount_1[0],1,2,3;

setarray .@items_2[0],501,502,503;
setarray .@items_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set .@category, select(.@main_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set .@a, 0; .@a < getarraysize(getd(".@equip_" + .@category)); set .@a, .@a + 1) {
set .@item_name$, getitemname(getd(".@equip_" + .@category + "[" + .@a + "]"));
set .@sub_menu$, .@sub_menu$ + (.@sub_menu$ == "" ? .@item_name$ : ":" + .@item_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set .@item_choice, select(.@sub_menu$) - 1;

// Determine If Player Has Required Items
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
set .@item_id, getd(".@items_" + .@category + "[" + .@a + "]");
set .@item_requires, getd(".@items_amount_" + .@category + "[" + .@a + "]");

if (.@item_id) {
set .@player_has, countitem(.@item_id);
set .@item_name$, getitemname(.@item_id); 
if (.@player_has < .@item_requires) {
set .@errors$[getarraysize(.@errors$)], "You Still Need " + (.@item_requires - .@player_has) + " " + .@item_name$ + ((.@item_requires - .@player_has) > 1 ? "'s." : ".");
}
} else {
// Is Zeny
if (Zeny < .@item_requires) {
set .@errors$[getarraysize(.@errors$)], "You Still Need " + (.@item_requires - Zeny) + " z.";
}
}
}

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

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd(".@equip_" + .@category + "[" + .@item_choice + "]");
mes "Item Name: " + getitemname(getd(".@equip_" + .@category + "[" + .@item_choice + "]"));

// Take Items Away
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
delitem getd(".@items_" + .@category + "[" + .@a + "]"), getd(".@items_amount_" + .@category + "[" + .@a + "]");
} 

// Give Item
getitem getd(".@equip_" + .@category + "[" + .@item_choice + "]"), 1;
close;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  311
  • Reputation:   46
  • Joined:  11/06/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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 .@a, 0; .@a < getarraysize(.items); set .@a, .@a + 1) {
			 set .@menu$,  (.@menu$ == "" ? getitemname(.items[.@a]) + " Quest" : .@menu$ + ":" + getitemname(.items[.@a]) + " Quest");
		  }

	  set .@my_item, select(.@menu$) - 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[.@my_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[.@my_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


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

erm..i just feel weird in this..

.@menu == "" ? .@menu = getitemname(.items[.@a]) + " Quest" : .@menu + getitemname(.items[.@a]) + " Quest";

will it work also ?

i mean usually it would be look like this ?

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

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 .@i,0; .@i < getarraysize( .ItemList ); set .@i,.@i + 1 ){
set @Menu$,@Menu$ + getitemname( .ItemList[.@i] )+":";
}
next;
set .@i,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[.@i],1;
mes "gained 1 "+getitemname( .ItemList[.@i] );
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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

erm..i just feel weird in this..

.@menu == "" ? .@menu = getitemname(.items[.@a]) + " Quest" : .@menu + getitemname(.items[.@a]) + " Quest";

will it work also ?

i mean usually it would be look like this ?

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

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 (.@menu$ == "") { .@menu$ = getitemname(.items[.@a]) + " Quest"; }
else { .@menu$ = .@menu$ + ":" + getitemname(.items[.@a]) + " Quest"; }

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  311
  • Reputation:   46
  • Joined:  11/06/11
  • Last Seen:  

Oh their, well that's good. actually im not really good on that.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  241
  • Reputation:   46
  • Joined:  11/08/11
  • Last Seen:  

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 .@a, 0; .@a < getarraysize(.items); set .@a, .@a + 1) {
 	           set .@menu$,  (.@menu$ == "" ? getitemname(.items[.@a]) + " Quest" : .@menu$ + ":" + getitemname(.items[.@a]) + " Quest");
          }

	  set .@my_item, select(.@menu$) - 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[.@my_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[.@my_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


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   0
  • Joined:  11/13/11
  • Last Seen:  

codebox is still working or not?? just asking :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  974
  • Reputation:   41
  • Joined:  11/13/11
  • Last Seen:  

it's working, it's just this is a different kind of forum but still this is an ipb

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  311
  • Reputation:   46
  • Joined:  11/06/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

Modified above posts to use codebox...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

Owh. So the conclusion is I make 2 NPC right. Haha. Thanks btw Zero

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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 .@main_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray .@equip_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 .@equip_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 .@equip_2[0],1,2,3,4,5,6,7,8,9;

// Create Item Hunt Group Arrays (By Category)
setarray .@items_0[0],501,502,503;
setarray .@items_amount_0[0],1,2,3;

setarray .@items_1[0],501,502,503;
setarray .@items_amount_1[0],1,2,3;

setarray .@items_2[0],501,502,503;
setarray .@items_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 .@category, select(.@main_menu$) - 1;

// Now Build the Menu Based on This Selection
for (set .@a, 0; .@a < getarraysize(getd(".@equip_" + .@category)); set .@a, .@a + 1) {
set .@item_name$, getitemname(getd(".@equip_" + .@category + "[" + .@a + "]"));
set .@sub_menu$, .@sub_menu$ + (.@sub_menu$ == "" ? .@item_name$ : ":" + .@item_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set .@item_choice, select(.@sub_menu$) - 1;

// Determine If Player Has Required Items
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
if (countitem(getd(".@items_" + .@category + "[" + .@a + "]")) < getd(".@items_amount_" + .@category + "[" + .@a + "]")) {
mes "You Do Not Have All The Items";
close;
}
}

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd(".@equip_" + .@category + "[" + .@item_choice + "]");
mes "Item Name: " + getitemname(getd(".@equip_" + .@category + "[" + .@item_choice + "]"));

// Take Items Away
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
delitem getd(".@items_" + .@category + "[" + .@a + "]"), getd(".@items_amount_" + .@category + "[" + .@a + "]");
}

// Give Item
getitem getd(".@equip_" + .@category + "[" + .@item_choice + "]"), 1;
close;

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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 .@main_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray .@equip_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 .@equip_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 .@equip_2[0],1,2,3,4,5,6,7,8,9; 

// Create Item Hunt Group Arrays (By Category)
setarray .@items_0[0],501,502,503;
setarray .@items_amount_0[0],1,2,3;

setarray .@items_1[0],501,502,503;
setarray .@items_amount_1[0],1,2,3;

setarray .@items_2[0],501,502,503;
setarray .@items_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set .@category, select(.@main_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set .@a, 0; .@a < getarraysize(getd(".@equip_" + .@category)); set .@a, .@a + 1) {
set .@item_name$, getitemname(getd(".@equip_" + .@category + "[" + .@a + "]"));
set .@sub_menu$, .@sub_menu$ + (.@sub_menu$ == "" ? .@item_name$ : ":" + .@item_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set .@item_choice, select(.@sub_menu$) - 1;

// Determine If Player Has Required Items
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
.@player_has, countitem(getd(".@items_" + .@category + "[" + .@a + "]"));
.@item_requires, getd(".@items_amount_" + .@category + "[" + .@a + "]");
.@item_name$, getitemname(getd(".@items_" + .@category + "[" + .@a + "]"));
if (.@player_has < .@item_requires) {
set .@errors$[getarraysize(.@errors$)], "You Still Need " + (.@item_requires - .@player_has) + " " + .@item_name$ + ((.@item_requires - .@player_has) > 1 ? "'s." : ".");
}
}

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

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd(".@equip_" + .@category + "[" + .@item_choice + "]");
mes "Item Name: " + getitemname(getd(".@equip_" + .@category + "[" + .@item_choice + "]"));

// Take Items Away
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
delitem getd(".@items_" + .@category + "[" + .@a + "]"), getd(".@items_amount_" + .@category + "[" + .@a + "]");
} 

// Give Item
getitem getd(".@equip_" + .@category + "[" + .@item_choice + "]"), 1;
close;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

// Create Item Hunt Group Arrays (By Category)
setarray .@items_0[0],501,502,503;
setarray .@items_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


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  615
  • Reputation:   201
  • Joined:  11/09/11
  • Last Seen:  

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 .@main_menu$[0],"Sword","Bow","Dagger";

// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray .@equip_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 .@equip_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 .@equip_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 .@items_0[0],0,502,503;
setarray .@items_amount_0[0],1000,2,3;

setarray .@items_1[0],501,502,503;
setarray .@items_amount_1[0],1,2,3;

setarray .@items_2[0],501,502,503;
setarray .@items_amount_2[0],1,2,3; 


// Display Categories to Player and Store Answer as Index (-1 Stores as Array Index)
set .@category, select(.@main_menu$) - 1; 

// Now Build the Menu Based on This Selection
for (set .@a, 0; .@a < getarraysize(getd(".@equip_" + .@category)); set .@a, .@a + 1) {
set .@item_name$, getitemname(getd(".@equip_" + .@category + "[" + .@a + "]"));
set .@sub_menu$, .@sub_menu$ + (.@sub_menu$ == "" ? .@item_name$ : ":" + .@item_name$);
}

// Now Offer the New Menu to the Player as Index (-1 Stores as Array Index)
set .@item_choice, select(.@sub_menu$) - 1;

// Determine If Player Has Required Items
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
.@item_id, getd(".@items_" + .@category + "[" + .@a + "]");
.@item_requires, getd(".@items_amount_" + .@category + "[" + .@a + "]");

if (.@item_id) {
.@player_has, countitem(.@item_id);
.@item_name$, getitemname(.@item_id); 
if (.@player_has < .@item_requires) {
set .@errors$[getarraysize(.@errors$)], "You Still Need " + (.@item_requires - .@player_has) + " " + .@item_name$ + ((.@item_requires - .@player_has) > 1 ? "'s." : ".");
}
} else {
// Is Zeny
if (Zeny < .@item_requires) {
set .@errors$[getarraysize(.@errors$)], "You Still Need " + (.@item_requires - Zeny) + " z.";
}
}
}

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

// Now For Debugging Purposes
mes "Item ID Chosen: " + getd(".@equip_" + .@category + "[" + .@item_choice + "]");
mes "Item Name: " + getitemname(getd(".@equip_" + .@category + "[" + .@item_choice + "]"));

// Take Items Away
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
delitem getd(".@items_" + .@category + "[" + .@a + "]"), getd(".@items_amount_" + .@category + "[" + .@a + "]");
} 

// Give Item
getitem getd(".@equip_" + .@category + "[" + .@item_choice + "]"), 1;
close;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Editted: Added The Ability to Add Zeny to the Mix

// Determine If Player Has Required Items
for (set .@a, 0; .@a < getarraysize(getd(".@items_" + .@category)); set .@a, .@a + 1) {
.@item_id, getd(".@items_" + .@category + "[" + .@a + "]");
.@item_requires, getd(".@items_amount_" + .@category + "[" + .@a + "]");

if (.@item_id) {
.@player_has, countitem(.@item_id);
.@item_name$, getitemname(.@item_id);

Seems like you forgot a few "set" before the ".@" O.O

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  37
  • Topics Per Day:  0.01
  • Content Count:  126
  • Reputation:   6
  • Joined:  11/18/11
  • Last Seen:  

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 .@items_0[0],0,502,503;
setarray .@items_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...