prontera,157,163,4 script Donate Costume Enchanter 101,{
disable_items;
mes .n$;
mes "Hello, "+strcharinfo(0)+"!";
mes "I can enchant your costume equipment with up to 2 random enchantments.";
mes ( (.enchant_cost[0] > 0)?"The cost is "+.enchant_cost[1]+"x "+getitemname(.enchant_cost[0])+".":"This service is free.");
next;
mes "Please select the costume you want to enchant:";
for ( set .@s,0; .@s < getarraysize(.equip_slot); set .@s,.@s + 1) {
set .@c_m$,.@c_m$ + ((getequipid(.equip_slot[.@s]) != -1) ? "["+.equip_slot_name[.@s]+"] "+getitemname(getequipid(.equip_slot[.@s])) : "") + ( (.equip_slot[.@s+1] != 0)?":":"");
}
set .@c_m$,.@c_m$ + ":- Cancel";
set .@c,select(.@c_m$);
if(.@c > getarraysize(.equip_slot)) close;
set .@part,.equip_slot[.@c-1];
set .@hg,getequipid(.@part); // Saving Item ID
set .@ref,getequiprefinerycnt(.@part); // Saving Refine Level
set .@card1,getequipcardid(.@part,0); // Save Item ID of Card Slot 1
// Validate Item ID
if (is_valid_item(.@hg) == 0) {
mes "This item cannot be enchanted.";
close;
}
mes "Selected Equipment: "+getitemname(.@hg);
next;
if (.enchant_cost[0] > 0 && countitem(.enchant_cost[0]) < .enchant_cost[1]) {
mes "You do not have enough "+getitemname(.enchant_cost[0])+" to proceed.";
close;
}
delitem .enchant_cost[0],.enchant_cost[1];
mes "Enchanting your equipment...";
next;
emotion ET_THX;
set .@rune,rand(0,getarraysize(.enchant_id)/3)*3; // First enchant
set .@rune2,rand(0,getarraysize(.enchant_id)/3)*3; // Second enchant
if (.enchant_id[.@rune] == 0 || .enchant_id[.@rune2] == 0) {
mes "Enchantment ^FF0000Failed^000000. I'm really sorry >.<";
close;
}
mes "Your equipment has been successfully enchanted with:";
mes "^FF0000"+getitemname(.enchant_id[.@rune])+"^000000 and ^FF0000"+getitemname(.enchant_id[.@rune2])+"^000000.";
enable_items;
close;
// Check if the item ID is valid for any category
if (inarray(.upper_items, .@hg) != -1) return 1;
if (inarray(.middle_items, .@hg) != -1) return 1;
if (inarray(.lower_items, .@hg) != -1) return 1;
if (inarray(.garment_items, .@hg) != -1) return 1;
return 0; // Invalid item if not found in any category
}
Question
Imbecile
Hello. So i planned to use this script
prontera,157,163,4 script Donate Costume Enchanter 101,{
disable_items;
mes .n$;
mes "Hello, "+strcharinfo(0)+"!";
mes "I can enchant your costume equipment with up to 2 random enchantments.";
mes ( (.enchant_cost[0] > 0)?"The cost is "+.enchant_cost[1]+"x "+getitemname(.enchant_cost[0])+".":"This service is free.");
next;
mes "Please select the costume you want to enchant:";
for ( set .@s,0; .@s < getarraysize(.equip_slot); set .@s,.@s + 1) {
set .@c_m$,.@c_m$ + ((getequipid(.equip_slot[.@s]) != -1) ? "["+.equip_slot_name[.@s]+"] "+getitemname(getequipid(.equip_slot[.@s])) : "") + ( (.equip_slot[.@s+1] != 0)?":":"");
}
set .@c_m$,.@c_m$ + ":- Cancel";
set .@c,select(.@c_m$);
if(.@c > getarraysize(.equip_slot)) close;
set .@part,.equip_slot[.@c-1];
set .@hg,getequipid(.@part); // Saving Item ID
set .@ref,getequiprefinerycnt(.@part); // Saving Refine Level
set .@card1,getequipcardid(.@part,0); // Save Item ID of Card Slot 1
// Validate Item ID
if (is_valid_item(.@hg) == 0) {
mes "This item cannot be enchanted.";
close;
}
mes "Selected Equipment: "+getitemname(.@hg);
next;
if (.enchant_cost[0] > 0 && countitem(.enchant_cost[0]) < .enchant_cost[1]) {
mes "You do not have enough "+getitemname(.enchant_cost[0])+" to proceed.";
close;
}
delitem .enchant_cost[0],.enchant_cost[1];
mes "Enchanting your equipment...";
next;
emotion ET_THX;
set .@rune,rand(0,getarraysize(.enchant_id)/3)*3; // First enchant
set .@rune2,rand(0,getarraysize(.enchant_id)/3)*3; // Second enchant
if (.enchant_id[.@rune] == 0 || .enchant_id[.@rune2] == 0) {
mes "Enchantment ^FF0000Failed^000000. I'm really sorry >.<";
close;
}
delequip .@part;
getitem2 .@hg,1,1,.@ref,0,.@card1,.enchant_id[.@rune],0,.enchant_id[.@rune2];
equip .@hg;
mes "Your equipment has been successfully enchanted with:";
mes "^FF0000"+getitemname(.enchant_id[.@rune])+"^000000 and ^FF0000"+getitemname(.enchant_id[.@rune2])+"^000000.";
enable_items;
close;
function is_valid_item {
setarray .upper_items[0],31589,31429,20432,19836,400124,31513,31849,20316;
setarray .middle_items[0],31923,31515,31186,410226,410108,31301,31847,410049,31380,31686;
setarray .lower_items[0],31057,31545,31178,420152,31300,31533;
setarray .garment_items[0],480243,480244,20599,480288,20621,20988,480223,480361,480096;
// Check if the item ID is valid for any category
if (inarray(.upper_items, .@hg) != -1) return 1;
if (inarray(.middle_items, .@hg) != -1) return 1;
if (inarray(.lower_items, .@hg) != -1) return 1;
if (inarray(.garment_items, .@hg) != -1) return 1;
return 0; // Invalid item if not found in any category
}
OnInit:
setarray .equip_slot[0],EQI_COSTUME_HEAD_TOP,EQI_COSTUME_HEAD_MID,EQI_COSTUME_HEAD_LOW,EQI_COSTUME_GARMENT;
setarray .equip_slot_name[0],"Top","Middle","Lower","Garment";
setarray .enchant_cost[0],3000003,10; // Item ID, Amount
setarray .enchant_id[0],4700,50,1,4701,5,1,4710,50,1,4711,5,1,4720,50,1,4721,5,1,4730,50,1,4731,5,1;
end;
}
but I got error like this :
parse_simpleexpr: unmatched ')'
17 : set .@hg,getequipid(.@part); // Saving Item ID
18 : set .@ref,getequiprefinerycnt(.@part); // Saving Refine Level
19 : set .@card1,getequipcardid(.@part,0); // Save Item ID of Card Slot 1
20 :
21 : // Validate Item ID
* 22 : if (is_valid_item'('@hg) == 0) {
23 : mes "This item cannot be enchanted.";
24 : close;
25 : }
26 :
27 : mes "Selected Equipment: "+getitemname(.@hg);
I already googled and try everything but it still not working at all. I need help
Link to comment
Share on other sites
3 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.