Jump to content
  • 0

Gachapon npc help with set.array


lionheartallstar

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  11/01/14
  • Last Seen:  

/Gachapon NPC//
prontera,156,196,5 script Gachapon Valkyrie#1 403,{
//Items Available through Gachapon NPC//
setarray .Items[0],7081,7075,7074,5075,501,520,521,522,523,525,526,528,529,530,2433,2424,2423,2291,2295,2289,2288,2299,19816,19820,19828,19824,19819,19816,19839,19825,19827,19830,19831,19832,19833,19836,19837,19839,19840,19843,19847,19848,19851,19852,7835,2261,2262,2263,2264,2265,2266;
setarray .Items[1],7073,7090,20002,502,2423,2424,2423,2301,2302,2304,2305,2307,19801,19802,19806,19807,19812,19814,19891,19893,19896,19900,19897,19885,19871,19837,19861,19859,19891,19896,19810,19815,19834,19838,19850,19868,19879,19883,19887,19888,2287,2288,2289,2365,2366,2367,2368,2369,2370,2371,2381;
setarray .Items[2],4008,503,2395,2396,2398,2399,4067,4075,4094,4098,4097,4100,4134,4147,4148,4144,4143,4142,4141,4139,4165,4145,4146,4138,4137,4135,4168,4169,4198,4200,4199,4174,4276,4302,4318,4346,4353,4342,4357,4360,4359,4356,4363,4361,4365,4366,4365,4367,4374,4375,4372,4386,4388,4389;
setarray .Items[3],4008,504,4403,4404,4405,4406,4407,4408,4419,4420,4424,4425,4425,4425,4426,7837,7838,7830,12102,12103,12104,12105,12106,12107,12108,12110,12111,12112,12113,12114,12115,12116,12117,12118,12119,12120,12122,12123,12124,19803,19804,19808,19809,19811,19813,19817,19818,19821,19822;
setarray .Items[4],4008,505,19845,19846,19849,19854,19860,19862,19866,19870,19872,19874,19876,19877,19878,19880,19881,19892,19884,19895,19898,19899,20000,20005,20006,20009,20008,20011,20017,20018,20019,20021,20023,20024,20028,7080,20030,20029,20039,20045,20046,20047,20048,20049,20051,20057,20058,20056;
setarray .Items[5],4008,7082,7083,20090,20091,20092,20093,20094,20095,20097,20098,20099,20102,20104,20105,20108,20109,20110,20111,20112,20115,20116,20117,20119,20123,20125,20128,20130,20133,20134,20137,20140,20141,20142,20143,20147,20150,20151,20153,20154,20155,20156,20157,20158,20159,20174,20161;
setarray .Items[6],4008,20169,20170,20171,20172,20177,20178,20179,20180,20184,20186,20187,20189,20190,20191,20199,20200,7086,7089,20202,20203,20205,20216,20217,20219,20221,20222,20224,20225,20226,20227,20233,20235,20236,20239,20240,20243,20245,7076,20249,20250,20251,20252,20254,20255,20257,20260;
setarray .Items[7],4008,20284,20288,20290,20294,20296,20299,7079,7078,7092,7088,7091,20322,20323,20324,20325,20326,20327,20329,20330,20331,20332,20335,20336,20337,20343,20344,20346,20347,20349,20350,20352,20353,20354,20355,20359,20354,20369,20386,20387,20389,20388,20392,20391,20368,20395,20393;
setarray .Items[8],7835,7836,7837,7838,7830,7831,7832,7833,7834,7080,7081,7082,7083,7084,7085,7086,7089,7075,7074,7073,7077,7076,7079,7078,7090,7092,7088,7091,20413,20414,20415,20416,20418,20419,20420,20423,20486,20487,20488,20489,20499,20501,20504,20505,20507,20510,20511,20514;
setarray .Items[9],7835,7836,7837,7838,7830,7831,7832,7833,7834,20010,20012,20026,20041,20052,20053,20070,20080,20083,20085,20097,20100,20101,20103,20214,20149,20167,20106,20513,20535,20550,20558,20879,20884,20001,20002,20003,20004,20007,20013,20014,20015,20020,20022,20025,20027,20031,20032,20034,20035,20036;
mes "[Gachapon Valkyrie]";
mes "Hello, you can earn 1 random item of the following:";
mes "God Item Ingredients, Rare Equipments, Cards, Wings or Junks if you give me the following items.";
next;
mes "1 Special Exchange Ticket";
next;
mes "Do you have the items?";
switch(select("-Yes, i have them:-No, let me go fot them")) {
case 1:
mes "Alright, let's see...";
if(countitem(6153) <1){
mes "You don't have them, go for them and then comeback...";
}
else
{
mes "Alright, seems like you have them, here you go, good luck!";
set .Random, rand(getarraysize(.items));
getitem .items[.Random], 1;
delitem 6153,1;
}
close;
case 2:
mes "Alright, good luck on the hunting.";
}
close;
 
}
 

 

Hi I really need help with this npc. so my players are using my gacha tickets and i notice they are only getting items at setarray. items[9]. How do i enable all the arrays to work perfectly fine and have over 300 items that can be obtained from a single npc? (random prize)

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You got a lot of items of item 9 because the last setarray overwrite the value of .Items array starting to index 9

//Gachapon NPC//
prontera,156,196,5	script	Gachapon Valkyrie#1	403,{
//Items Available through Gachapon NPC//
setarray .@items0[0],7081,7075,7074,5075,501,520,521,522,523,525,526,528,529,530,2433,2424,2423,2291,2295,2289,2288,2299,19816,19820,19828,19824,19819,19816,19839,19825,19827,19830,19831,19832,19833,19836,19837,19839,19840,19843,19847,19848,19851,19852,7835,2261,2262,2263,2264,2265,2266;
setarray .@items1[0],7073,7090,20002,502,2423,2424,2423,2301,2302,2304,2305,2307,19801,19802,19806,19807,19812,19814,19891,19893,19896,19900,19897,19885,19871,19837,19861,19859,19891,19896,19810,19815,19834,19838,19850,19868,19879,19883,19887,19888,2287,2288,2289,2365,2366,2367,2368,2369,2370,2371,2381;
setarray .@items2[0],4008,503,2395,2396,2398,2399,4067,4075,4094,4098,4097,4100,4134,4147,4148,4144,4143,4142,4141,4139,4165,4145,4146,4138,4137,4135,4168,4169,4198,4200,4199,4174,4276,4302,4318,4346,4353,4342,4357,4360,4359,4356,4363,4361,4365,4366,4365,4367,4374,4375,4372,4386,4388,4389;
setarray .@items3[0],4008,504,4403,4404,4405,4406,4407,4408,4419,4420,4424,4425,4425,4425,4426,7837,7838,7830,12102,12103,12104,12105,12106,12107,12108,12110,12111,12112,12113,12114,12115,12116,12117,12118,12119,12120,12122,12123,12124,19803,19804,19808,19809,19811,19813,19817,19818,19821,19822;
setarray .@items4[0],4008,505,19845,19846,19849,19854,19860,19862,19866,19870,19872,19874,19876,19877,19878,19880,19881,19892,19884,19895,19898,19899,20000,20005,20006,20009,20008,20011,20017,20018,20019,20021,20023,20024,20028,7080,20030,20029,20039,20045,20046,20047,20048,20049,20051,20057,20058,20056;
setarray .@items5[0],4008,7082,7083,20090,20091,20092,20093,20094,20095,20097,20098,20099,20102,20104,20105,20108,20109,20110,20111,20112,20115,20116,20117,20119,20123,20125,20128,20130,20133,20134,20137,20140,20141,20142,20143,20147,20150,20151,20153,20154,20155,20156,20157,20158,20159,20174,20161;
setarray .@items6[0],4008,20169,20170,20171,20172,20177,20178,20179,20180,20184,20186,20187,20189,20190,20191,20199,20200,7086,7089,20202,20203,20205,20216,20217,20219,20221,20222,20224,20225,20226,20227,20233,20235,20236,20239,20240,20243,20245,7076,20249,20250,20251,20252,20254,20255,20257,20260;
setarray .@items7[0],4008,20284,20288,20290,20294,20296,20299,7079,7078,7092,7088,7091,20322,20323,20324,20325,20326,20327,20329,20330,20331,20332,20335,20336,20337,20343,20344,20346,20347,20349,20350,20352,20353,20354,20355,20359,20354,20369,20386,20387,20389,20388,20392,20391,20368,20395,20393;
setarray .@items8[0],7835,7836,7837,7838,7830,7831,7832,7833,7834,7080,7081,7082,7083,7084,7085,7086,7089,7075,7074,7073,7077,7076,7079,7078,7090,7092,7088,7091,20413,20414,20415,20416,20418,20419,20420,20423,20486,20487,20488,20489,20499,20501,20504,20505,20507,20510,20511,20514;
setarray .@items9[0],7835,7836,7837,7838,7830,7831,7832,7833,7834,20010,20012,20026,20041,20052,20053,20070,20080,20083,20085,20097,20100,20101,20103,20214,20149,20167,20106,20513,20535,20550,20558,20879,20884,20001,20002,20003,20004,20007,20013,20014,20015,20020,20022,20025,20027,20031,20032,20034,20035,20036;
mes "[Gachapon Valkyrie]";
mes "Hello, you can earn 1 random item of the following:";
mes "God Item Ingredients, Rare Equipments, Cards, Wings or Junks if you give me the following items.";
next;
mes "1 Special Exchange Ticket";
next;
mes "Do you have the items?";
switch(select("-Yes, i have them:-No, let me go fot them")) {
case 1:
	mes "Alright, let's see...";
	if(countitem(6153) <1){
		mes "You don't have them, go for them and then comeback...";
	}
	else {
		mes "Alright, seems like you have them, here you go, good luck!";
		set .@random_array, rand(10);
		set .@random_index, rand(getarraysize( getd( ".@items"+ .@random_array ) ));
		getitem getd( ".@items"+ .@random_array +"["+ .@random_index +"]" ), 1;
		delitem 6153,1;
	}
	close;
case 2:
	mes "Alright, good luck on the hunting.";
	close;
}
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  11/01/14
  • Last Seen:  

alright, thank you i will try the code again.


Ok now I would like to add 10 more arrays.

 

Is there anything I should change in the getitem?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  1479
  • Reputation:   172
  • Joined:  12/14/11
  • Last Seen:  

no. just edit the red part:

set .@random_array, rand(10);

 

rand(10) will result 0 ~ 9. the next, you count by yourself.

rand (20) will ofc result 0 ~ 19

so the next array should end on 19

  • Upvote 1
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...