Jump to content
  • 0
Sign in to follow this  
Phoenix

got problem with Quest_shop

Question

i got this error when i reload and 1 jelopy showing on category
[Error]: script:getarg: index (idx=14) out of range (nargs=14) and no default value found
 

 

[cbox]//===== Hercules Script ======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.6a
//===== Compatible With: =====================================
//= Hercules
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
//= Item Preview script by ToastOfDoom.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.2 Added category support.
//= 1.3 More options and fixes.
//= 1.4 Added debug settings.
//= 1.5 Replaced categories with shop IDs.
//= 1.6 Added support for purchasing stackables.
//= 1.6a Added support for previewing costumes and robes.
//============================================================

// Shop NPCs -- supplying no argument displays entire menu.
// callfunc "qshop"{,{,{,...}}};
//============================================================
prontera,164,211,6 script More Head Gear 998,{ callfunc "aqshop",1,2; }


// Script Core
//============================================================
- script quest_ashop -1,{
function Add; function Chk; function Slot; function A_An;
OnInit:
freeloop(1);

// -----------------------------------------------------------
// Basic shop settings.
// -----------------------------------------------------------

set .Announce,1; // Announce quest completion? (1: yes / 0: no)
set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
set .ShowID,0; // Show item IDs? (1: yes / 0: no)
set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
set .MaxStack,800; // Max number of quest items purchased at one time.

// -----------------------------------------------------------
// Points variable -- optional quest requirement.
// setarray .Points$[0],"","";
// -----------------------------------------------------------

setarray .Points$[0],"#CASHPOINTS","Cash Points";

// -----------------------------------------------------------
// Shop IDs -- to add shops, copy dummy data at bottom of file.
// setarray .Shops$[1],"",""{,...};
// -----------------------------------------------------------

setarray .Shops$[1],"More Headgears","Weapons","Other";

// -----------------------------------------------------------
// Quest items -- do NOT use a reward item more than once!
// Add(,,,
// ,,
// ,{,...});
// -----------------------------------------------------------

Add(1,5254,1,5000000,0,642,1,5038,1,7023,5,7038,50,7511,20);
Add(1,5038,1,5000000,0,1038,600,7048,40);
Add(1,5211,1,1000000,0,529,20,530,20,538,20,539,20,748,15,10007,1,975,3,7166,40);
Add(1,5170,1,1000000,0,5172,1,7063,100,982,1);
Add(1,5374,1,5000000,0,2256,5,7799,30,7798,50,750,1);

Add(1,5666,1,5000000,0,2235,5,2246,5,969,200);
Add(1,5372,1,5000000,0,7116,500,923,100,7111,100,519,50,982,10);
Add(1,5253,1,1000000,0,754,5,905,500,521,350);
Add(1,5527,1,1000000,0,622,5,4006,3,705,100,949,100,982,1);
Add(1,5506,1,5000000,0,978,2,7065,50,7166,70,7038,1);
Add(1,5507,1,5000000,0,975,2,1028,50,7038,1,7166,1);
Add(1,5094,1,10000000,0,968,100,909,500,931,500,7086,5);
Add(1,5360,1,1000000,0,2213,1,983,1,914,200,996,5,995,3,7066,50);
Add(1,5058,1,1000000,0,2233,1,983,300,7206,300,7030,1);

Add(1,5137,1,5000000,0,7047,250,5141,5,501,2);
Add(1,5766,1,5000000,0,7107,200,7106,500,982,5);
Add(1,5132,1,1000000,0,2220,1,2254,1,4054,1,7063,250,982,1);
Add(1,5264,1,5000000,0,2226,5,978,10,502,2);
Add(1,5312,1,9000000,0,7150,250,7151,250,7187,100,983,5);
Add(1,5491,1,5000000,0,903,100,7290,5,7152,200,4073,1);
Add(1,5264,1,1000000,0,7038,300,2226,1,982,10);
Add(1,5382,1,1000000,0,2244,1,7297,3,10016,1,969,100);
Add(1,5183,1,1000000,0,604,20,905,100,711,40,7203,50);
Add(1,5765,1,1000000,0,2209,5,2208,5,2507,1,983,5);

Add(2,5378,1,1000000,0,515,50,10007,1,1065,1,7038,5,622);
Add(2,5184,1,9000000,0,5016,1,7321,50,7327,20,12119,10);
Add(2,5477,1,5000000,0,1024,50,7111,50,970,10,974,10,1059,150,7345,100,2656,1,983,1);
Add(2,5320,1,9000000,0,7298,300,7198,300,567,100,568,100,706,5,1202,2,973,5,2221,1);
Add(2,5200,1,5000000,0,7300,5,7113,3,7169,3,7108,1,1029,1,7086,1);



// -----------------------------------------------------------

freeloop(0);
set .menu$,"";
for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
set .menu$, .menu$+.Shops$[.@i]+":";
npcshopdelitem "aqshop"+.@i,909;
}
end;

OnMenu:
set .@size, getarraysize(@i);
if (!.@size) set .@i, select(.menu$);
else if (.@size == 1) set .@i, @i[0];
else {
for(set .@j,0; .@j<.@size; set .@j,.@j+1)
set .@menu$, .@menu$+.Shops$[@i[.@j]]+":";
set .@i, @i[select(.@menu$)-1];
}
deletearray @i[0],getarraysize(@i);
if (.Shops$[.@i] == "") {
message strcharinfo(0),"An error has occurred.";
end;
}
dispbottom "Select one item at a time.";
callshop "aqshop"+.@i,1;
npcshopattach "aqshop"+.@i;
end;

OnBuyItem:
// .@q[] : RewardID, BoughtAmt, RewardAmt, BaseAmt, ReqZeny, ReqPts, { ReqItem, ReqAmt, ... }
setarray .@q[0],@bought_nameid[0],((@bought_quantity[0] > .MaxStack)?.MaxStack:@bought_quantity[0]);
copyarray .@q[3],getd(".q_"+.@q[0]+"[0]"),getarraysize(getd(".q_"+.@q[0]));
set .@q[2],.@q[1]*.@q[3];
if (!.@q[2] || .@q[2] > 30000) {
message strcharinfo(0),"You can't purchase that many "+getitemname(.@q[0])+".";
end;
}
mes "[Quest Shop]";
mes "Reward: ^0055FF"+((.@q[2] > 1)?.@q[2]+"x ":"")+Slot(.@q[0])+"^000000";
mes "Requirements:";
if (.@q[4]) mes " > "+Chk(Zeny,.@q[4]*.@q[1])+(.@q[4]*.@q[1])+" Zeny^000000";
if (.@q[5]) mes " > "+Chk(getd(.Points$[0]),.@q[5]*.@q[1])+(.@q[5]*.@q[1])+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+(.@q[5]*.@q[1])+")^000000";
if (.@q[6]) for(set .@i,6; .@i mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000";
next;
setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11);
if (@qe[2] > 0 && ((@qe[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512) || (@qe[1] & 1024) || (@qe[1] & 2048) || (@qe[1] & 4096) || (@qe[1] & 4) || (@qe[1] & 8192)))
set .@preview,1;
addtimer 1000, strnpcinfo(0)+"::OnEnd";
while(1) {
switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[7])?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
case 1:
if (@qe[0]) {
mes "[Quest Shop]";
mes "You're missing one or more quest requirements.";
close;
}
if (!checkweight(.@q[0],.@q[2])) {
mes "[Quest Shop]";
mes "^FF0000You need "+(((.@q[2]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
close;
}
if (.@q[4]) set Zeny, Zeny-(.@q[4]*.@q[1]);
if (.@q[5]) setd .Points$[0], getd(.Points$[0])-(.@q[5]*.@q[1]);
if (.@q[6]) for(set .@i,6; .@i delitem .@q[.@i],.@q[.@i+1]*.@q[1];
getitem .@q[0],.@q[2];
if (.Announce) announce strcharinfo(0)+" has created "+((.@q[2] > 1)?.@q[2]+"x "+getitemname(.@q[0]):A_An(getitemname(.@q[0])))+"!",0;
specialeffect2 EF_FLOWERLEAF;
close;
case 2:
setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), getlook(LOOK_ROBE), 1;
if ((@qe[1] & 1) || (@qe[1] & 4096)) changelook LOOK_HEAD_BOTTOM, @qe[2];
else if ((@qe[1] & 256) || (@qe[1] & 1024)) changelook LOOK_HEAD_TOP, @qe[2];
else if ((@qe[1] & 512) || (@qe[1] & 2048)) changelook LOOK_HEAD_MID, @qe[2];
else if ((@qe[1] & 4) || (@qe[1] & 8192)) changelook LOOK_ROBE, @qe[2];
break;
case 3:
close;
}
}

OnEnd:
if (@qe[7]) {
changelook LOOK_HEAD_BOTTOM, @qe[3];
changelook LOOK_HEAD_TOP, @qe[4];
changelook LOOK_HEAD_MID, @qe[5];
changelook LOOK_ROBE, @qe[6];
}
deletearray @qe[0],8;
end;

function Add {
if (getitemname(getarg(1)) == "null") {
debugmes "Quest reward #"+getarg(1)+" invalid (skipped).";
return;
}
setarray .@j[0],getarg(2),getarg(3),getarg(4);
for(set .@i,5; .@i if (getitemname(getarg(.@i)) == "null") {
debugmes "Quest requirement #"+getarg(.@i)+" invalid (skipped).";
return;
} else
setarray .@j[.@i-2],getarg(.@i),getarg(.@i+1);
}
copyarray getd(".q_"+getarg(1)+"[0]"),.@j[0],getarraysize(.@j);
npcshopadditem "aqshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
return;
}

function Chk {
if (getarg(0) < getarg(1)) {
set @qe[0],1;
return "^FF0000";
} else
return "^00FF00";
}

function Slot {
set .@s$,getitemname(getarg(0));
switch(.ShowSlot) {
case 1: if (!getitemslots(getarg(0))) return .@s$;
case 2: if (getiteminfo(getarg(0),2) == 4 || getiteminfo(getarg(0),2) == 5) return .@s$+" ["+getitemslots(getarg(0))+"]";
default: return .@s$;
}
}

function A_An {
setarray .@A$[0],"a","e","i","o","u";
set .@B$, "_"+getarg(0);
for(set .@i,0; .@i<5; set .@i,.@i+1)
if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
return "a "+getarg(0);
}
}

function script aqshop {
deletearray @i[0],getarraysize(@i);
for(set .@i,0; .@i set @i[.@i],getarg(.@i);
doevent "quest_ashop::OnMenu";
end;
}


// Dummy shop data -- copy as needed.
//============================================================
- shop aqshop1 -1,909:-1
- shop aqshop2 -1,909:-1
- shop aqshop3 -1,909:-1
- shop aqshop4 -1,909:-1
- shop aqshop5 -1,909:-1[/cbox]();>();>(.@q);>(.@q);>

Share this post


Link to post
Share on other sites

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

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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