unknownuser Posted March 9, 2014 Posted March 9, 2014 (edited) //============================================================ quiz_02,340,75,6 script Donate Shop 998,{ callfunc "qshop"; } // Script Core //============================================================ - script quest_shop -1,{ function Add; function Chk; function Slot; function A_An; OnInit: freeloop(1); // ----------------------------------------------------------- // Basic shop settings. // ----------------------------------------------------------- set .Announce,0; // 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,100; // Max number of quest items purchased at one time. // ----------------------------------------------------------- // Points variable -- optional quest requirement. // setarray .Points$[0],"<variable name>","<display name>"; // ----------------------------------------------------------- setarray .Points$[0],"#CASHPOINTS","Cash Points"; // ----------------------------------------------------------- // Shop IDs -- to add shops, copy dummy data at bottom of file. // setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...}; // ----------------------------------------------------------- setarray .Shops$[1],"Weapons List 1","Weapons List 2","Weapons List 3","Footgear","Accessory","Armor","Shield","Garments","Cards","Misc","Usable"; // ----------------------------------------------------------- // Quest items -- do NOT use a reward item more than once! // Add(<shop ID>,<reward ID>,<reward amount>, // <Zeny cost>,<point cost>, // <required item ID>,<required item amount>{,...}); // ----------------------------------------------------------- Add(1,1186,1,0,0,7179,21); Add(1,1228,1,0,0,7179,12); Add(1,1266,1,0,0,7179,12); Add(1,1267,1,0,0,7179,10000); Add(1,1310,1,0,0,7179,38); Add(1,1419,1,0,0,7179,12); Add(1,1424,1,0,0,7179,4); Add(1,1425,1,0,0,7179,12); Add(1,1433,1,0,0,7179,38); Add(1,1530,1,0,0,7179,38); Add(1,1565,1,0,0,7179,30); Add(1,1567,1,0,0,7179,18); Add(1,1628,1,0,0,7179,42); Add(1,1633,1,0,0,7179,21); Add(1,1635,1,0,0,7179,25); Add(1,1637,1,0,0,7179,21); Add(1,1640,1,0,0,7179,38); Add(1,1646,1,0,0,7179,48); Add(1,1649,1,0,0,7179,88); Add(1,1728,1,0,0,7179,12); Add(1,1736,1,0,0,7179,8); Add(2,1738,1,0,0,7179,21); Add(2,1743,1,0,0,7179,21); Add(2,1924,1,0,0,7179,18); Add(2,1927,1,0,0,7179,42); Add(2,1978,1,0,0,7179,18); Add(2,1981,1,0,0,7179,42); Add(2,2000,1,0,0,7179,18); Add(2,12935,1,0,0,7179,4); Add(2,13017,1,0,0,7179,12); Add(2,13023,1,0,0,7179,5); Add(2,13034,1,0,0,7179,18); Add(2,13035,1,0,0,7179,18); Add(2,13037,1,0,0,7179,12); Add(2,13042,1,0,0,7179,10000); Add(2,13110,1,0,0,7179,12); Add(2,13166,1,0,0,7179,18); Add(2,13171,1,0,0,7179,21); Add(2,13176,1,0,0,7179,21); Add(2,13177,1,0,0,7179,21); Add(3,13178,1,0,0,7179,21); Add(3,13179,1,0,0,7179,21); Add(3,13306,1,0,0,7179,28); Add(3,13307,1,0,0,7179,28); Add(3,13412,1,0,0,7179,18); Add(3,13413,1,0,0,7179,18); Add(3,16000,1,0,0,7179,58); Add(3,30701,1,0,0,7179,68); Add(3,30807,1,0,0,7179,4); Add(4,2410,1,0,0,7179,38); Add(4,2421,1,0,0,7179,4); Add(4,2423,1,0,0,7179,70); Add(4,2424,1,0,0,7179,30); Add(4,2433,1,0,0,7179,38); Add(4,2435,1,0,0,7179,21); Add(4,2436,1,0,0,7179,21); Add(4,2437,1,0,0,7179,12); Add(4,2439,1,0,0,7179,1000); Add(4,2468,1,0,0,7179,58); Add(4,13958,1,0,0,7179,3); Add(5,2620,1,0,0,7179,21); Add(5,2629,1,0,0,7179,21); Add(5,2630,1,0,0,7179,5); Add(5,2678,1,0,0,7179,5); Add(5,2679,1,0,0,7179,5); Add(5,2688,1,0,0,7179,4); Add(5,2689,1,0,0,7179,4); Add(5,2690,1,0,0,7179,4); Add(5,2691,1,0,0,7179,4); Add(5,2692,1,0,0,7179,4); Add(5,2693,1,0,0,7179,4); Add(5,2694,1,0,0,7179,4); Add(5,2701,1,0,0,7179,12); Add(5,2702,1,0,0,7179,21); Add(5,2712,1,0,0,7179,42); Add(5,2729,1,0,0,7179,38); Add(5,2730,1,0,0,7179,8); Add(5,2733,1,0,0,7179,21); Add(5,2737,1,0,0,7179,48); Add(5,2744,1,0,0,7179,32); Add(5,2787,1,0,0,7179,21); Add(6,2345,1,0,0,7179,12); Add(6,2347,1,0,0,7179,18); Add(6,2349,1,0,0,7179,18); Add(6,2351,1,0,0,7179,18 ); Add(6,2357,1,0,0,7179,12); Add(6,2367,1,0,0,7179,8); Add(6,2370,1,0,0,7179,38); Add(6,2374,1,0,0,7179,30); Add(6,2375,1,0,0,7179,30); Add(6,2376,1,0,0,7179,80); Add(6,2377,1,0,0,7179,38); Add(6,2378,1,0,0,7179,38); Add(6,2379,1,0,0,7179,38); Add(6,2380,1,0,0,7179,38); Add(6,2381,1,0,0,7179,38); Add(6,2382,1,0,0,7179,30); Add(6,2383,1,0,0,7179,18); Add(6,2384,1,0,0,7179,38); Add(6,2388,1,0,0,7179,12); Add(6,2394,1,0,0,7179,88); Add(7,2115,1,0,0,7179,5); Add(7,2127,1,0,0,7179,42); Add(7,2130,1,0,0,7179,12); Add(7,2131,1,0,0,7179,8); Add(7,2138,1,0,0,7179,21); Add(8,2515,1,0,0,7179,4); Add(8,2524,1,0,0,7179,12); Add(8,2535,1,0,0,7179,12); Add(8,2537,1,0,0,7179,50); Add(8,2538,1,0,0,7179,30); Add(8,2539,1,0,0,7179,21); Add(8,2340,1,0,0,7179,12); Add(8,2541,1,0,0,7179,10000); Add(8,2542,1,0,0,7179,38); Add(8,2543,1,0,0,7179,68); Add(8,2554,1,0,0,7179,68); Add(9,4145,1,0,0,7179,38); Add(9,4357,1,0,0,7179,8); Add(9,4359,1,0,0,7179,18); Add(9,4361,1,0,0,7179,12); Add(9,4365,1,0,0,7179,18); Add(9,4399,1,0,0,7179,35); Add(9,4403,1,0,0,7179,21); Add(9,4427,1,0,0,7179,5); Add(9,4441,1,0,0,7179,42); Add(10,6124,1,0,0,7179,5); Add(10,6223,3,0,0,7179,1); Add(10,6224,3,0,0,7179,1); Add(10,7621,10,0,0,7179,1); Add(10,7767,100,0,0,7179,2); Add(10,7776,1,0,0,7179,2); Add(10,7821,100,0,0,7179,1); Add(10,7822,100,0,0,7179,1); Add(10,7823,100,0,0,7179,1); Add(10,7824,120,0,0,7179,2); Add(10,9028,1,0,0,7179,5); Add(10,9039,1,0,0,7179,8); Add(10,12214,6,0,0,7179,1); Add(10,14033,1,0,0,7179,1); Add(10,14034,1,0,0,7179,1); Add(11,607,120,0,0,7179,1); Add(11,608,250,0,0,7179,1); Add(11,12103,4,0,0,7179,2); Add(11,12114,50,0,0,7179,1); Add(11,12115,50,0,0,7179,1); Add(11,12116,50,0,0,7179,1); Add(11,12117,50,0,0,7179,1); Add(11,12202,50,0,0,7179,1); Add(11,12203,50,0,0,7179,1); Add(11,12204,50,0,0,7179,1); Add(11,12206,50,0,0,7179,1); Add(11,12207,50,0,0,7179,1); Add(11,12210,50,0,0,7179,1); Add(11,12220,10,0,0,7179,5); Add(11,12272,80,0,0,7179,1); Add(11,12273,30,0,0,7179,1); Add(11,12274,30,0,0,7179,1); Add(11,12275,30,0,0,7179,1); Add(11,12280,30,0,0,7179,1); Add(11,13751,1,0,0,7179,1); Add(11,13757,1,0,0,7179,1); // ----------------------------------------------------------- freeloop(0); set .menu$,""; for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) { set .menu$, .menu$+.Shops$[.@i]+":"; npcshopdelitem "qshop"+.@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 "qshop"+.@i,1; npcshopattach "qshop"+.@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<getarraysize(.@q); set .@i,.@i+2) 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[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512)) && @qe[2] > 0) set .@preview,1; addtimer 1000, strnpcinfo(0)+"::OnEnd"; while(1) { switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[6])?" ~ 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<getarraysize(.@q); set .@i,.@i+2) 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 699; close; case 2: setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), 1; if (@qe[1] & 1) changelook LOOK_HEAD_BOTTOM, @qe[2]; if (@qe[1] & 256) changelook LOOK_HEAD_TOP, @qe[2]; if (@qe[1] & 512) changelook LOOK_HEAD_MID, @qe[2]; break; case 3: close; } } OnEnd: if (@qe[6]) { changelook LOOK_HEAD_BOTTOM, @qe[3]; changelook LOOK_HEAD_TOP, @qe[4]; changelook LOOK_HEAD_MID, @qe[5]; } deletearray @qe[0],7; 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<getargcount(); set .@i,.@i+2) { 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 "qshop"+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 qshop { deletearray @i[0],getarraysize(@i); for(set .@i,0; .@i<getargcount(); set .@i,.@i+1) set @i[.@i],getarg(.@i); doevent "quest_shop::OnMenu"; end; } // Dummy shop data -- copy as needed. //============================================================ - shop qshop1 -1,909:-1 - shop qshop2 -1,909:-1 - shop qshop3 -1,909:-1 - shop qshop4 -1,909:-1 - shop qshop5 -1,909:-1 what is wrong here ?? Edited March 9, 2014 by sandbox codebox'd Quote
Microsoft Posted March 9, 2014 Posted March 9, 2014 (edited) Try to add more Dummy Shop Data below: - shop qshop1 -1,909:-1 - shop qshop2 -1,909:-1 - shop qshop3 -1,909:-1 - shop qshop4 -1,909:-1 - shop qshop5 -1,909:-1 - shop qshop1 -1,909:-1 - shop qshop2 -1,909:-1 - shop qshop3 -1,909:-1 - shop qshop4 -1,909:-1 - shop qshop5 -1,909:-1 - shop qshop6 -1,909:-1 - shop qshop7 -1,909:-1 - shop qshop8 -1,909:-1 - shop qshop9 -1,909:-1 - shop qshop10 -1,909:-1 - shop qshop11 -1,909:-1 I don't know if this will help you, but you may try Edited March 9, 2014 by Microsoft Quote
Question
unknownuser
//============================================================
quiz_02,340,75,6 script Donate Shop 998,{ callfunc "qshop"; }
// Script Core
//============================================================
- script quest_shop -1,{
function Add; function Chk; function Slot; function A_An;
OnInit:
freeloop(1);
// -----------------------------------------------------------
// Basic shop settings.
// -----------------------------------------------------------
set .Announce,0; // 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,100; // Max number of quest items purchased at one time.
// -----------------------------------------------------------
// Points variable -- optional quest requirement.
// setarray .Points$[0],"<variable name>","<display name>";
// -----------------------------------------------------------
setarray .Points$[0],"#CASHPOINTS","Cash Points";
// -----------------------------------------------------------
// Shop IDs -- to add shops, copy dummy data at bottom of file.
// setarray .Shops$[1],"<Shop 1>","<Shop 2>"{,...};
// -----------------------------------------------------------
setarray .Shops$[1],"Weapons List 1","Weapons List 2","Weapons List 3","Footgear","Accessory","Armor","Shield","Garments","Cards","Misc","Usable";
// -----------------------------------------------------------
// Quest items -- do NOT use a reward item more than once!
// Add(<shop ID>,<reward ID>,<reward amount>,
// <Zeny cost>,<point cost>,
// <required item ID>,<required item amount>{,...});
// -----------------------------------------------------------
Add(1,1186,1,0,0,7179,21);
Add(1,1228,1,0,0,7179,12);
Add(1,1266,1,0,0,7179,12);
Add(1,1267,1,0,0,7179,10000);
Add(1,1310,1,0,0,7179,38);
Add(1,1419,1,0,0,7179,12);
Add(1,1424,1,0,0,7179,4);
Add(1,1425,1,0,0,7179,12);
Add(1,1433,1,0,0,7179,38);
Add(1,1530,1,0,0,7179,38);
Add(1,1565,1,0,0,7179,30);
Add(1,1567,1,0,0,7179,18);
Add(1,1628,1,0,0,7179,42);
Add(1,1633,1,0,0,7179,21);
Add(1,1635,1,0,0,7179,25);
Add(1,1637,1,0,0,7179,21);
Add(1,1640,1,0,0,7179,38);
Add(1,1646,1,0,0,7179,48);
Add(1,1649,1,0,0,7179,88);
Add(1,1728,1,0,0,7179,12);
Add(1,1736,1,0,0,7179,8);
Add(2,1738,1,0,0,7179,21);
Add(2,1743,1,0,0,7179,21);
Add(2,1924,1,0,0,7179,18);
Add(2,1927,1,0,0,7179,42);
Add(2,1978,1,0,0,7179,18);
Add(2,1981,1,0,0,7179,42);
Add(2,2000,1,0,0,7179,18);
Add(2,12935,1,0,0,7179,4);
Add(2,13017,1,0,0,7179,12);
Add(2,13023,1,0,0,7179,5);
Add(2,13034,1,0,0,7179,18);
Add(2,13035,1,0,0,7179,18);
Add(2,13037,1,0,0,7179,12);
Add(2,13042,1,0,0,7179,10000);
Add(2,13110,1,0,0,7179,12);
Add(2,13166,1,0,0,7179,18);
Add(2,13171,1,0,0,7179,21);
Add(2,13176,1,0,0,7179,21);
Add(2,13177,1,0,0,7179,21);
Add(3,13178,1,0,0,7179,21);
Add(3,13179,1,0,0,7179,21);
Add(3,13306,1,0,0,7179,28);
Add(3,13307,1,0,0,7179,28);
Add(3,13412,1,0,0,7179,18);
Add(3,13413,1,0,0,7179,18);
Add(3,16000,1,0,0,7179,58);
Add(3,30701,1,0,0,7179,68);
Add(3,30807,1,0,0,7179,4);
Add(4,2410,1,0,0,7179,38);
Add(4,2421,1,0,0,7179,4);
Add(4,2423,1,0,0,7179,70);
Add(4,2424,1,0,0,7179,30);
Add(4,2433,1,0,0,7179,38);
Add(4,2435,1,0,0,7179,21);
Add(4,2436,1,0,0,7179,21);
Add(4,2437,1,0,0,7179,12);
Add(4,2439,1,0,0,7179,1000);
Add(4,2468,1,0,0,7179,58);
Add(4,13958,1,0,0,7179,3);
Add(5,2620,1,0,0,7179,21);
Add(5,2629,1,0,0,7179,21);
Add(5,2630,1,0,0,7179,5);
Add(5,2678,1,0,0,7179,5);
Add(5,2679,1,0,0,7179,5);
Add(5,2688,1,0,0,7179,4);
Add(5,2689,1,0,0,7179,4);
Add(5,2690,1,0,0,7179,4);
Add(5,2691,1,0,0,7179,4);
Add(5,2692,1,0,0,7179,4);
Add(5,2693,1,0,0,7179,4);
Add(5,2694,1,0,0,7179,4);
Add(5,2701,1,0,0,7179,12);
Add(5,2702,1,0,0,7179,21);
Add(5,2712,1,0,0,7179,42);
Add(5,2729,1,0,0,7179,38);
Add(5,2730,1,0,0,7179,8);
Add(5,2733,1,0,0,7179,21);
Add(5,2737,1,0,0,7179,48);
Add(5,2744,1,0,0,7179,32);
Add(5,2787,1,0,0,7179,21);
Add(6,2345,1,0,0,7179,12);
Add(6,2347,1,0,0,7179,18);
Add(6,2349,1,0,0,7179,18);
Add(6,2351,1,0,0,7179,18 );
Add(6,2357,1,0,0,7179,12);
Add(6,2367,1,0,0,7179,8);
Add(6,2370,1,0,0,7179,38);
Add(6,2374,1,0,0,7179,30);
Add(6,2375,1,0,0,7179,30);
Add(6,2376,1,0,0,7179,80);
Add(6,2377,1,0,0,7179,38);
Add(6,2378,1,0,0,7179,38);
Add(6,2379,1,0,0,7179,38);
Add(6,2380,1,0,0,7179,38);
Add(6,2381,1,0,0,7179,38);
Add(6,2382,1,0,0,7179,30);
Add(6,2383,1,0,0,7179,18);
Add(6,2384,1,0,0,7179,38);
Add(6,2388,1,0,0,7179,12);
Add(6,2394,1,0,0,7179,88);
Add(7,2115,1,0,0,7179,5);
Add(7,2127,1,0,0,7179,42);
Add(7,2130,1,0,0,7179,12);
Add(7,2131,1,0,0,7179,8);
Add(7,2138,1,0,0,7179,21);
Add(8,2515,1,0,0,7179,4);
Add(8,2524,1,0,0,7179,12);
Add(8,2535,1,0,0,7179,12);
Add(8,2537,1,0,0,7179,50);
Add(8,2538,1,0,0,7179,30);
Add(8,2539,1,0,0,7179,21);
Add(8,2340,1,0,0,7179,12);
Add(8,2541,1,0,0,7179,10000);
Add(8,2542,1,0,0,7179,38);
Add(8,2543,1,0,0,7179,68);
Add(8,2554,1,0,0,7179,68);
Add(9,4145,1,0,0,7179,38);
Add(9,4357,1,0,0,7179,8);
Add(9,4359,1,0,0,7179,18);
Add(9,4361,1,0,0,7179,12);
Add(9,4365,1,0,0,7179,18);
Add(9,4399,1,0,0,7179,35);
Add(9,4403,1,0,0,7179,21);
Add(9,4427,1,0,0,7179,5);
Add(9,4441,1,0,0,7179,42);
Add(10,6124,1,0,0,7179,5);
Add(10,6223,3,0,0,7179,1);
Add(10,6224,3,0,0,7179,1);
Add(10,7621,10,0,0,7179,1);
Add(10,7767,100,0,0,7179,2);
Add(10,7776,1,0,0,7179,2);
Add(10,7821,100,0,0,7179,1);
Add(10,7822,100,0,0,7179,1);
Add(10,7823,100,0,0,7179,1);
Add(10,7824,120,0,0,7179,2);
Add(10,9028,1,0,0,7179,5);
Add(10,9039,1,0,0,7179,8);
Add(10,12214,6,0,0,7179,1);
Add(10,14033,1,0,0,7179,1);
Add(10,14034,1,0,0,7179,1);
Add(11,607,120,0,0,7179,1);
Add(11,608,250,0,0,7179,1);
Add(11,12103,4,0,0,7179,2);
Add(11,12114,50,0,0,7179,1);
Add(11,12115,50,0,0,7179,1);
Add(11,12116,50,0,0,7179,1);
Add(11,12117,50,0,0,7179,1);
Add(11,12202,50,0,0,7179,1);
Add(11,12203,50,0,0,7179,1);
Add(11,12204,50,0,0,7179,1);
Add(11,12206,50,0,0,7179,1);
Add(11,12207,50,0,0,7179,1);
Add(11,12210,50,0,0,7179,1);
Add(11,12220,10,0,0,7179,5);
Add(11,12272,80,0,0,7179,1);
Add(11,12273,30,0,0,7179,1);
Add(11,12274,30,0,0,7179,1);
Add(11,12275,30,0,0,7179,1);
Add(11,12280,30,0,0,7179,1);
Add(11,13751,1,0,0,7179,1);
Add(11,13757,1,0,0,7179,1);
// -----------------------------------------------------------
freeloop(0);
set .menu$,"";
for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1) {
set .menu$, .menu$+.Shops$[.@i]+":";
npcshopdelitem "qshop"+.@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 "qshop"+.@i,1;
npcshopattach "qshop"+.@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<getarraysize(.@q); set .@i,.@i+2)
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[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512)) && @qe[2] > 0)
set .@preview,1;
addtimer 1000, strnpcinfo(0)+"::OnEnd";
while(1) {
switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((.@preview && !@qe[6])?" ~ 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<getarraysize(.@q); set .@i,.@i+2)
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 699;
close;
case 2:
setarray @qe[3], getlook(LOOK_HEAD_BOTTOM), getlook(LOOK_HEAD_TOP), getlook(LOOK_HEAD_MID), 1;
if (@qe[1] & 1) changelook LOOK_HEAD_BOTTOM, @qe[2];
if (@qe[1] & 256) changelook LOOK_HEAD_TOP, @qe[2];
if (@qe[1] & 512) changelook LOOK_HEAD_MID, @qe[2];
break;
case 3:
close;
}
}
OnEnd:
if (@qe[6]) {
changelook LOOK_HEAD_BOTTOM, @qe[3];
changelook LOOK_HEAD_TOP, @qe[4];
changelook LOOK_HEAD_MID, @qe[5];
}
deletearray @qe[0],7;
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<getargcount(); set .@i,.@i+2) {
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 "qshop"+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 qshop {
deletearray @i[0],getarraysize(@i);
for(set .@i,0; .@i<getargcount(); set .@i,.@i+1)
set @i[.@i],getarg(.@i);
doevent "quest_shop::OnMenu";
end;
}
// Dummy shop data -- copy as needed.
//============================================================
- shop qshop1 -1,909:-1
- shop qshop2 -1,909:-1
- shop qshop3 -1,909:-1
- shop qshop4 -1,909:-1
- shop qshop5 -1,909:-1
what is wrong here ??
Edited by sandboxcodebox'd
1 answer 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.