If the slot occupied, then you can replace it with another option
Need help with this script function
function script item_option {
disable_items;
setarray .@eq[1], EQI_HEAD_TOP,EQI_ARMOR,EQI_HAND_L,EQI_HAND_R,EQI_GARMENT,EQI_SHOES,EQI_ACC_L,EQI_ACC_R,EQI_HEAD_MID,EQI_HEAD_LOW;
.@sz = getarraysize(.@eq); // Reduce getarraysize calls [Secret]
for(.@i = 1; .@i < .@sz; ++.@i){
if(getequipisequiped(.@eq[.@i])){
.@menu$ = .@menu$ + F_getpositionname(.@eq[.@i]) + " ~ [ " + getequipname(.@eq[.@i]) + " ]";
.@equipped = 1;
}
.@menu$ = .@menu$ + ":";
}
if (.@equipped == 0) {
message strcharinfo(0), "I don’t think I can improve the items you have...";
getitem 6027,1;
end;
}
.@part = .@eq[prompt(.@menu$)];
if (!getequipisequiped(.@part)) {
message strcharinfo(0), "You canceled the action.";
getitem 6027,1;
end;
}
mes "[ Select Item Option ]"," ";
mes "Please indicate option number","which you want to apply.";
mes "See list in chat :";
dispbottom "-------------------------";
dispbottom "#3 : Str";
dispbottom "#4 : Agi";
dispbottom "#5 : Vit";
dispbottom "#6 : Int";
dispbottom "#7 : Dex";
dispbottom "#8 : Luk";
dispbottom "#9 : MaxHPrate";
dispbottom "#10 : MaxSPrate";
dispbottom "#13 : AtkRate";
dispbottom "#14 : MatkRate";
dispbottom "#25 : Sub Neutral";
dispbottom "#35 : Sub Ele_All";
dispbottom "#94 : SubRace Player";
dispbottom "#185: UnbreakableWeapon";
dispbottom "#186: UnbreakableArmor";
dispbottom "-------------------------";
next;
input .@opt;
if(.@opt == 0){ message strcharinfo(0), "There is no such option."; getitem 6027,1; end; }
mes "[ Select Item Option ]"," ";
mes "Selected Option Type : " + .@opt;
//mes " ";
//mes "Please indicate the value you want to apply.";
//next;
//input .@val;
mes " ";
mes "Please indicate the slot where you want to insert the option [1-4]";
next;
input .@idx_real;
if(.@idx_real == 0){ message strcharinfo(0), "This is not a slot."; getitem 6027,1; end; }
set .@idx,.@idx_real-1;
if(getequiprandomoption(.@part, .@idx, ROA_ID, getcharid(0))){
if(.@idx > 3) {
mes "[ Select Item Option ]";
message strcharinfo(0), "No free slot.";
getitem 6027,1;
end;
}
}
mes "[ Select Item Option ]"," ";
mes "Selected :";
mes "^6A01A1"+.@opt+"^000000 Type";
//mes "^B91E1E"+.@val+"^000000 Value";
mes "^0C9610"+.@idx_real+"^000000 Slot";
close2;
setrandomoption(.@part,.@idx,.@opt,1,.@idx,getcharid(0));
end;
}
Up