Jump to content
  • 0

TCG shop items limited [request for help]


fallen0519

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.01
  • Content Count:  52
  • Reputation:   2
  • Joined:  02/15/14
  • Last Seen:  

Can anyone teach me how to extend the NPC item list because it only shows 64 items from the 100 items in script below, thanks much.

yuno,24,207,5	script	Costume Trader	626,{
mes .name$;
mes "You currently have "+countitem(.tcg_item)+" TCG.";
mes "Would you like to look at the shop?";
next;
if(select("Yes:No") == 2) {
close;
}
close2;
callshop "Costume_SHOP",1;
npcshopattach "Costume_SHOP";
dispbottom "You currently have "+countitem(.tcg_item)+" TCG.";
end;

OnBuyItem:
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.TCG_ITEMS); set @j,@j+2) {
if(.TCG_ITEMS[@j] == @bought_nameid[@i]) {
set @itemcost,(.TCG_ITEMS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
break;
}
}
}
if(@totalcost > countitem(.tcg_item)) {
dispbottom "You don't have enough TCG.";
}
else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
}
delitem .tcg_item,@totalcost;
dispbottom "Thank you for shopping.";
dispbottom "You now have "+countitem(.tcg_item)+" TCG left.";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
end;

OnInit:
npcshopdelitem "Costume_SHOP",7227; // Leave this alone
set .name$,"[Costume Trader]";
set .tcg_item,7227; // Input TCG ID
setarray .TCG_ITEMS[0],29801,100,29802,100,29806,100,29807,100,29812,100,29814,100,29816,100,29819,100,29820,100,29824,100,29825,100,29827,100,29828,100,29830,100,29831,100,29832,100,29833,100,29836,100,29837,100,29839,100,29840,100,29843,100,29847,100,29848,100,29851,100,29852,100,29853,100,29855,100,29856,100,29857,100,29858,100,29859,100,29861,100,29863,100,29864,100,29865,100,29867,100,29869,100,29871,100,29873,100,29875,100,29884,100,29885,100,29886,100,29890,100,29891,100,29893,100,29896,100,29897,100,210000,100,29810,100,29815,100,29834,100,29838,100,29850,100,29868,100,29879,100,29882,100,29883,100,29887,100,29888,100,29889,100,29803,100,29804,100,29805,100,29808,100,29809,100,29811,100,29813,100,29817,100,29818,100,29821,100,29822,100,29823,100,29826,100,29829,100,29835,100,29841,100,29842,100,29844,100,29845,100,29846,100,29849,100,29854,100,29860,100,29862,100,29866,100,29870,100,29872,100,29874,100,29876,100,29877,100,29878,100,29880,100,29881,100,29892,100,29894,100,29895,100,29898,100,298100,100; // Input as many items as you want (item::price)



for(set .@i,0; .@i < getarraysize(.TCG_ITEMS); set .@i,.@i+2) {
npcshopadditem "Costume_SHOP",.TCG_ITEMS[.@i],.TCG_ITEMS[(.@i+1)];
}
}
-	shop	Costume_SHOP	-1,7227:1
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

split the array to 2 array ...


setarray .item_id,........
setarray .item_cost,.......

.@size = getarraysize( .item_id );
for( .@i = 0; .@i < .@size; .@i++ )
    npcshopadditem "Costume_SHOP",.item_id[.@i],item_cost[.@i];

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Use SQL instead. rAthena array can store only up to 128 values. 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  949
  • Reputation:   174
  • Joined:  06/12/12
  • Last Seen:  

I believe there's a src config for that, I just forgot what @clydelion told me before..

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

×
×
  • Create New...