I've requested a NPC to have a sub category for one category.
Meaning
Sword
-10 sub category
Dagger
-10 sub category
and so on..
Thanks to Z3R0 he have made me that NPC but there is some minor error.
prontera,155,181,5 script Sample 757,{
// I Was just talking with Brian about this last night actually...
// Create the Category Array
setarray .@main_menu$[0],"Sword","Spear","Dagger";
// Item ID's (The Number 0 is the Index of the Category "Sword")
setarray .@equip_0[0],13439,13435,13436,4,5,6,7,8,9;
// Item ID's (The Number 1 is the Index of the Category "Bow")
setarray .@equip_1[0],1443,1439,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],501,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;
}
this is the script. the error is when I click at that NPC. Only have one category which is sword. I didn't see bow or dagger. Can someone help me?
Question
pojiejapan
I've requested a NPC to have a sub category for one category.
Meaning
Sword
-10 sub category
Dagger
-10 sub category
and so on..
Thanks to Z3R0 he have made me that NPC but there is some minor error.
this is the script. the error is when I click at that NPC. Only have one category which is sword. I didn't see bow or dagger. Can someone help me?
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.