sotf Posted March 3, 2013 Share Posted March 3, 2013 Hi rAthena boards! I was wondering if you could help me on this one. Our server has tons of Costume Headgears, I mean seriously. Tons. Now, what I want to have(if Possible) is a Gacha NPC that gives you a random Costume Headgear when you gave it a ticket/item of some sort. And also if it could have 2 different kinds of ticket, a premium one(via donate) and a regular one which can be acquired in-game. If I give the npc the premium ticket, I would have a greater chance to get rare costume. And if I give it the regular one, I would have a lesser chance to get rare costume. I hope you awesome guys could help me on this one! Thanks in advance! Quote Link to comment Share on other sites More sharing options...
0 IsabelaFernandez Posted July 12, 2018 Share Posted July 12, 2018 On 3/5/2013 at 3:36 PM, Capuche said: prontera,155,177,5 script yuio 88,{ function Getcostume; if( countitem( .rare_ticket ) ) { mes "A Rare ticket !"; .@r = .rate_chance_rare; // chance .@ticket = .rare_ticket ; } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; .@r = .rate_chance_normal; // chance .@ticket = .normal_ticket; } else { mes "Hmmm.. what?"; close; } if( select( "Use it", "Cancel" ) -1 ) close; delitem .@ticket, 1; if( .@r > rand( 1, 1000 ) ) { // chance 50% for rare ticket mes "You got a rare costum."; getitem Getcostume( "rare" ), 1; close; } else { mes "You got a normal costum."; getitem Getcostume( "normal" ), 1; close; } OnInit: .normal_ticket = 501; .rare_ticket = 502; .rate_chance_rare = 500; // chance to get a rare costume with rare ticket .rate_chance_normal = 100; // chance to get a rare costume with normal ticket // rare costume ID // size array must be < 128 // use the synthaxe .rare_IDX for adding news array // ------------------------------------------------ setarray .rare_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID8,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID9,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID10,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // normal costume ID // size array must be < 128 // use the synthaxe .normal_IDX for adding news array // ------------------------------------------------ setarray .normal_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // Don't touch // ----------- callsub L_size, "rare"; callsub L_size, "normal"; end; L_size: while( getd( "."+ getarg(0) +"_ID"+ .@i +"[0]" ) ) { setd ".size_"+ getarg(0) +""+ .@i, getarraysize( getd( "."+ getarg(0) +"_ID"+ .@i ) ); setd ".size_tot_"+ getarg(0), getd( ".size_tot_"+ getarg(0) ) + getarraysize( getd( "."+ getarg(0) +"_ID"+ .@i ) ); .@i++; } return; function Getcostume { .@r = rand( 1, getd( ".size_tot_"+ getarg(0) ) ); .@i = -1; while( .@r > .@tmp ) .@tmp = .@tmp + getd( ".size_"+ getarg(0) + .@i++ ); .@in = .@r - ( .@tmp - getd( ".size_"+ getarg(0) + .@i ) ) -1; return getd( "."+ getarg(0) +"_ID"+ .@i +"[ "+ .@in +" ]" ); } } EDIT how I can put that to work on my server? I really want this NPC but still not work for me Quote Link to comment Share on other sites More sharing options...
sotf Posted March 5, 2013 Author Share Posted March 5, 2013 *bump* I hope bumping is allowed Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 5, 2013 Share Posted March 5, 2013 prontera,180,160,5 script yuio 88,{ if( countitem( .rare_ticket ) ) { mes "A Rare ticket !"; [email protected] = 500; // chance } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; [email protected] = 100; // chance } else { mes "Hmmm.. what?"; close; } if( select( "Use it", "Cancel" ) -1 ) close; if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket mes "You got a rare costum."; close; } else { mes "You got a normal costum."; close; } OnInit: .normal_ticket = 501; .rare_ticket = 502; end; } Hi And also if it could have 2 different kinds of ticket, a premium one(via donate) and a regular one which can be acquired in-game. If I give the npc the premium ticket, I would have a greater chance to get rare costume. And if I give it the regular one, I would have a lesser chance to get rare costume. What is the difference between rare and normal costum ? Each one have his own band of ID ( 20000-22000 and 22001-23000 for example) ? One have some characteristics and not the others ? something like that Quote Link to comment Share on other sites More sharing options...
sotf Posted March 5, 2013 Author Share Posted March 5, 2013 Ah thanks! Uh no not really, the IDs are mixed.Is it possible to have a NPC script like that where I can just edit to input the IDs of those normal and rare costumes? Because the IDs are really really really mixed haha! Anyways, thank you for the respond! Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 5, 2013 Share Posted March 5, 2013 (edited) prontera,155,177,5 script yuio 88,{ function Getcostume; if( countitem( .rare_ticket ) ) { mes "A Rare ticket !"; [email protected] = .rate_chance_rare; // chance [email protected] = .rare_ticket ; } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; [email protected] = .rate_chance_normal; // chance [email protected] = .normal_ticket; } else { mes "Hmmm.. what?"; close; } if( select( "Use it", "Cancel" ) -1 ) close; delitem [email protected], 1; if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket mes "You got a rare costum."; getitem Getcostume( "rare" ), 1; close; } else { mes "You got a normal costum."; getitem Getcostume( "normal" ), 1; close; } OnInit: .normal_ticket = 501; .rare_ticket = 502; .rate_chance_rare = 500; // chance to get a rare costume with rare ticket .rate_chance_normal = 100; // chance to get a rare costume with normal ticket // rare costume ID // size array must be < 128 // use the synthaxe .rare_IDX for adding news array // ------------------------------------------------ setarray .rare_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID8,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID9,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID10,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // normal costume ID // size array must be < 128 // use the synthaxe .normal_IDX for adding news array // ------------------------------------------------ setarray .normal_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // Don't touch // ----------- callsub L_size, "rare"; callsub L_size, "normal"; end; L_size: while( getd( "."+ getarg(0) +"_ID"+ [email protected] +"[0]" ) ) { setd ".size_"+ getarg(0) +""+ [email protected], getarraysize( getd( "."+ getarg(0) +"_ID"+ [email protected] ) ); setd ".size_tot_"+ getarg(0), getd( ".size_tot_"+ getarg(0) ) + getarraysize( getd( "."+ getarg(0) +"_ID"+ [email protected] ) ); [email protected]++; } return; function Getcostume { [email protected] = rand( 1, getd( ".size_tot_"+ getarg(0) ) ); [email protected] = -1; while( [email protected] > [email protected] ) [email protected] = [email protected] + getd( ".size_"+ getarg(0) + [email protected]++ ); [email protected] = [email protected] - ( [email protected] - getd( ".size_"+ getarg(0) + [email protected] ) ) -1; return getd( "."+ getarg(0) +"_ID"+ [email protected] +"[ "+ [email protected] +" ]" ); } } EDIT Ah thanks! Uh no not really, the IDs are mixed. Is it possible to have a NPC script like that where I can just edit to input the IDs of those normal and rare costumes? Because the IDs are really really really mixed haha! Anyways, thank you for the respond! Edited March 5, 2013 by Capuche Quote Link to comment Share on other sites More sharing options...
sotf Posted March 6, 2013 Author Share Posted March 6, 2013 Wow thank you so much! This will be a great help! I will test this as soon as possible! Thanks again! Hey, I just tested your script but I am stucked at this part. No items, no close button, no anything *photo attatched* Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 6, 2013 Share Posted March 6, 2013 Works for rA only You must reloadscript for OnInit Label Quote Link to comment Share on other sites More sharing options...
sotf Posted March 7, 2013 Author Share Posted March 7, 2013 I am sure that I am using rAthena. What do you mean by 'You must reloadscript for OnInit Label' ? Quote Link to comment Share on other sites More sharing options...
mrlongshen Posted March 7, 2013 Share Posted March 7, 2013 Lol. After load script.please reloadscript back. Or close ur server and start again. Quote Link to comment Share on other sites More sharing options...
sotf Posted March 9, 2013 Author Share Posted March 9, 2013 Uh so I did everything you told me(as far as I know lol) But.... [Debug]: Data: number value=0[Debug]: Function: set[Debug]: Source (NPC): yuio at prontera (155,177)[Error]: script:set: not a variable[Debug]: Data: number value=0[Debug]: Source (NPC): yuio at prontera (155,177) ^what does that mean? Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 9, 2013 Share Posted March 9, 2013 I don't have this kind of error What is your emulator (eA, rA, 3ceam, cronus...) ? Did you made some modifications ? You make a @reloadscript ? Are you always stuck without close button ? Quote Link to comment Share on other sites More sharing options...
sotf Posted March 9, 2013 Author Share Posted March 9, 2013 rAthena Development Team presents ____ ___ __ __ / __ \/ | / /_/ /_ ___ ____ ____ _ / /_/ / /| |/ __/ __ \/ _ \/ __ \/ __ `/ / _, _/ ___ / /_/ / / / __/ / / / /_/ / /_/ |_/_/ |_\__/_/ /_/\___/_/ /_/\___,_/ http://rathena.org/board/[info]: SVN Revision: '1612512'. Modification, I changed the ID for the tickets(for testing purposes) I always do @reloadscript everytime I put new scripts/npc file. And yes I am always stuck on that part Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 10, 2013 Share Posted March 10, 2013 (edited) Try this one prontera,155,177,5 script yuio 88,{ function Getcostume; if( countitem( .rare_ticket ) ) { mes "A Rare ticket !"; set [email protected], .rate_chance_rare; // chance set [email protected], .rare_ticket ; } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; set [email protected], .rate_chance_normal; // chance set [email protected], .normal_ticket; } else { mes "Hmmm.. what?"; close; } if( select( "Use it", "Cancel" ) -1 ) close; delitem [email protected], 1; if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket mes "You got a rare costum."; getitem Getcostume( "rare" ), 1; close; } else { mes "You got a normal costum."; getitem Getcostume( "normal" ), 1; close; } OnInit: set .normal_ticket, 501; set .rare_ticket, 502; set .rate_chance_rare, 500; // chance to get a rare costume with rare ticket set .rate_chance_normal, 100; // chance to get a rare costume with normal ticket // rare costume ID // size array must be < 128 // use the synthaxe .rare_IDX for adding news array // ------------------------------------------------ setarray .rare_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID8,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID9,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .rare_ID10,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // normal costume ID // size array must be < 128 // use the synthaxe .normal_IDX for adding news array // ------------------------------------------------ setarray .normal_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; setarray .normal_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600; // Don't touch // ----------- while( getd( ".rare_ID"+ [email protected] +"[0]" ) ) { setd ".size_rare"+ [email protected], getarraysize( getd( ".rare_ID"+ [email protected] ) ); set .size_tot_rare, .size_tot_rare + getarraysize( getd( ".rare_ID"+ [email protected] ) ); set [email protected], [email protected] +1; } set [email protected], 0; while( getd( ".normal_ID"+ [email protected] +"[0]" ) ) { setd ".size_normal"+ [email protected], getarraysize( getd( ".normal_ID"+ [email protected] ) ); set .size_tot_normal, .size_tot_normal + getarraysize( getd( ".normal_ID"+ [email protected] ) ); set [email protected], [email protected] +1; } end; function Getcostume { if( getarg(0) == "normal" ) { set [email protected], rand( 1, .size_tot_normal ); while( [email protected] > [email protected] ) { set [email protected], [email protected] + getd( ".size_normal"+ [email protected] ); set [email protected], [email protected] +1; } set [email protected], [email protected] - ( [email protected] - getd( ".size_normal"+ [email protected] ) ) -1; return getd( ".normal_ID"+ [email protected] +"[ "+ [email protected] +" ]" ); } else { set [email protected], rand( 1,.size_tot_rare ); while( [email protected] > [email protected] ) { set [email protected], [email protected] + getd( ".size_rare" + [email protected] ); set [email protected], [email protected] +1; } set [email protected], [email protected] - ( [email protected] - getd( ".size_rare" + [email protected] ) ) -1; return getd( ".rare_ID"+ [email protected] +"[ "+ [email protected] +" ]" ); } } } Edited March 10, 2013 by Capuche Quote Link to comment Share on other sites More sharing options...
sotf Posted March 14, 2013 Author Share Posted March 14, 2013 (edited) ^Thanks! It now works. Now I am wondering, what will my players do if they have too much of the same costume? How would they dispose of it they will get back a part of their expenses with the tickets? Is it possible to have an NPC that shows a selection of costumes and sells one by one for let's say.... 7539 (Poring Coin) Something like this: =========================Hi Good Day! Do you have spare costumesthat you wanna get rid of?=========================(menu)YesNo=========================(If No)Okay have a nice day.[close]=========================(if Yes but no costumes in the inventory)Hmm I don't see any costumes on yourinventory. Please check your inventory. [close]=========================(If Yes and have costumes in inventory)Okay, here's a list of the costumesin your inventory.=========================(menu)Costume1Costume2Costume3etc etc [select][cancel]=========================(if a costume is selected)Sell this for 10 Poring Coins?=========================(menu)YesNo=========================(if yes, NPC deletes the costume and gives the player 10 Poring Coins)=========================(if no)Okay, have a nice day! [close]========================= So basically that's what I would like the NPC to be like, I just don't know how to code these stuffs If possible, again, could the npc be like where I can input the IDs of the sellable costumes and the item and amount I'd like the NPC to give the players when they sell one? Thanks in advance! (Sorry for the late replies, been busy these past few weeks) Edited March 14, 2013 by orochimakoto Quote Link to comment Share on other sites More sharing options...
sotf Posted March 16, 2013 Author Share Posted March 16, 2013 BUMP! Please help me on this one too, thanks in advance! Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 18, 2013 Share Posted March 18, 2013 - shop costume_shop -1,501:-1 prontera,150,180,5 script bghjkl 58,{ mes "Hi Good Day! Do you have spare costumes !"; mes "that you wanna get rid of?"; next; set [email protected], select( "No ! Goood bye.", "Trade", "More informations" ); if( [email protected] == 1 ) mes "Okay have a nice day."; else if( [email protected] == 3 ) { mes "blabla more informations."; } else if( !callsub( L_CheckInventory,0 ) ) mes "Hmm I don't see any costumes on your inventory. Please check your inventory."; else { mes "Okay, here's a list of the costumes in your inventory."; next; npcshopitem "costume_shop",501,-1; callsub L_CheckInventory; npcshopdelitem "costume_shop",501; callshop "costume_shop", 1; npcshopattach "costume_shop"; } close; L_CheckInventory: getinventorylist; for( set [email protected], 0; [email protected] < @inventorylist_count; set [email protected], [email protected] + 1 ) if( [email protected]_expire[[email protected]] ) { while( getd( ".costume_id"+ [email protected] +"[0]" ) ) { while( [email protected] < getd( ".size_costume"+ [email protected] ) && @inventorylist_id[[email protected]] != getd( ".costume_id"+ [email protected] +"["+ [email protected] +"]" ) ) set [email protected], [email protected] + 1; if( [email protected] != getd( ".size_costume"+ [email protected] ) ) { for( set [email protected], 0; [email protected] < @inventorylist_amount[[email protected]]; set [email protected], [email protected] + 1 ) { if( getarg(0,1) ) npcshopadditem "costume_shop",@inventorylist_id[[email protected]],0; set [email protected]_shop, [email protected]_shop + 1; } break; } set [email protected], 0; set [email protected], [email protected] + 1; } set [email protected], 0; } return [email protected]_shop; OnBuyItem: if( !checkweight2( .item_exchangeID,.item_count ) ) { message strcharinfo(0),"You need additional weight capacity to complete this trade."; close; } set [email protected], getarraysize( @bought_nameid ); for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) { set [email protected], .item_count[[email protected]] * [email protected]; if( [email protected] > 30000) { message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[[email protected]] ) +"."; end; } set [email protected]$, [email protected]$ + ( getstrlen( [email protected]$ ) ? ", " : "" ) + [email protected] +" "+ getitemname( .item_exchangeID[[email protected]] ); } mes "Sell the costume for "+ [email protected]$ +"?"; next; if( select( "Yes, I sell", "No" ) -1 ) close; for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 ) delitem @bought_nameid[[email protected]], @bought_quantity[[email protected]]; for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) getitem .item_exchangeID[[email protected]], .item_count[[email protected]] * [email protected]; mes "good bye."; close; OnInit: // Item gained // ----------- setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,... setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID ) set .size_count, getarraysize( .item_count ); // Costume trade ID // size array must be < 128 // use the synthaxe .costume_idX for adding news array // ------------------------------------------------ setarray .costume_id0, 20000, 20001; setarray .costume_id1, 20002, 20003; while( getd( ".costume_id"+ [email protected] +"[0]" ) ) { setd ".size_costume"+ [email protected], getarraysize( getd( ".costume_id"+ [email protected] ) ); set [email protected], [email protected] +1; } end; } setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,... setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID ) Item gained setarray .costume_id0, 20000, 20001; setarray .costume_id1, 20002, 20003; Costumes ID to exchange Quote Link to comment Share on other sites More sharing options...
sotf Posted March 19, 2013 Author Share Posted March 19, 2013 ^Thank you so much! I will test this as soon as I can! Quote Link to comment Share on other sites More sharing options...
sotf Posted March 19, 2013 Author Share Posted March 19, 2013 I get this error:[Error]: Loading NPC file: npc/custom/gachabuyer.txtscript error on npc/custom/gachabuyer.txt line 51 parse_simpleexpr: unmatch ')' 46 : 47 : } 48 : return [email protected]_shop; 49 : 50 : OnBuyItem:* 51 : if( !checkweight2'(' .item_exchangeID,.item_count ) ) { 52 : message strcharinfo(0),"You need additional weight capacity to complete this trade."; 53 : close; 54 : } 55 : set [email protected], getarraysize( @bought_nameid ); 56 : for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) { Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted March 19, 2013 Share Posted March 19, 2013 checkweight2? I'm not sure if that command exists Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 19, 2013 Share Posted March 19, 2013 - shop costume_shop -1,501:-1 prontera,150,180,5 script bghjkl 58,{ mes "Hi Good Day! Do you have spare costumes !"; mes "that you wanna get rid of?"; next; set [email protected], select( "No ! Goood bye.", "Trade", "More informations" ); if( [email protected] == 1 ) mes "Okay have a nice day."; else if( [email protected] == 3 ) { mes "blabla more informations."; } getinventorylist; for( set [email protected], 0; [email protected] < @inventorylist_count; set [email protected], [email protected] + 1 ) if( [email protected]_expire[[email protected]] ) { while( getd( ".costume_id"+ [email protected] +"[0]" ) ) { while( [email protected] < getd( ".size_costume"+ [email protected] ) && @inventorylist_id[[email protected]] != getd( ".costume_id"+ [email protected] +"["+ [email protected] +"]" ) ) set [email protected], [email protected] + 1; if( [email protected] != getd( ".size_costume"+ [email protected] ) ) { for( set [email protected], 0; [email protected] < @inventorylist_amount[[email protected]]; set [email protected], [email protected] + 1 ) { set [email protected]_id[ [email protected]_shop ], @inventorylist_id[[email protected]]; set [email protected]_shop, [email protected]_shop + 1; } break; } set [email protected], 0; set [email protected], [email protected] + 1; } set [email protected], 0; } if( [email protected]ize_shop ) mes "Hmm I don't see any costumes on your inventory. Please check your inventory."; else { mes "Okay, here's a list of the costumes in your inventory."; next; npcshopitem "costume_shop",501,-1; for( set [email protected], 0; [email protected] < [email protected]_shop; set [email protected], [email protected] + 1 ) npcshopadditem "costume_shop",[email protected]_id[[email protected]],0; npcshopdelitem "costume_shop",501; callshop "costume_shop", 1; npcshopattach "costume_shop"; } close; OnBuyItem: // if( !checkweight2( .item_exchangeID,.item_count ) ) { // message strcharinfo(0),"You need additional weight capacity to complete this trade."; // close; // } set [email protected], getarraysize( @bought_nameid ); for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) { set [email protected], .item_count[[email protected]] * [email protected]; if( [email protected] > 30000) { message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[[email protected]] ) +"."; end; } set [email protected]$, [email protected]$ + ( getstrlen( [email protected]$ ) ? ", " : "" ) + [email protected] +" "+ getitemname( .item_exchangeID[[email protected]] ); } mes "Sell the costume for "+ [email protected]$ +"?"; next; if( select( "Yes, I sell", "No" ) -1 ) close; for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 ) delitem @bought_nameid[[email protected]], @bought_quantity[[email protected]]; for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) getitem .item_exchangeID[[email protected]], .item_count[[email protected]] * [email protected]; mes "good bye."; close; OnInit: // Item gained // ----------- setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,... setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID ) set .size_count, getarraysize( .item_count ); // Costume trade ID // size array must be < 128 // use the synthaxe .costume_idX for adding news array // ------------------------------------------------ setarray .costume_id0, 20000, 20001; setarray .costume_id1, 20002, 20003; while( getd( ".costume_id"+ [email protected] +"[0]" ) ) { setd ".size_costume"+ [email protected], getarraysize( getd( ".costume_id"+ [email protected] ) ); set [email protected], [email protected] +1; } end; } I think it would be fine without checkweight's prevention. checkweight2? I'm not sure if that command exists I'm sure that command exist *checkweight(<item id>,<amount>{,<item id>,<amount>,<item id>,<amount>,...}); *checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...}); *checkweight2(<id_array>,<amount_array>); Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted March 19, 2013 Share Posted March 19, 2013 Ahh.. it looks like I have the old version --------------------------------------- *checkweight(<item id>,<amount>) *checkweight("<item name>",<amount>) This function will compute and return 1 if the total weight of a specified..... Quote Link to comment Share on other sites More sharing options...
sotf Posted March 20, 2013 Author Share Posted March 20, 2013 Thank you so much! It works now! I'll just edit them a bit to fit the needs of our server! I will let you guys know about it once I set it all up Quote Link to comment Share on other sites More sharing options...
sotf Posted March 20, 2013 Author Share Posted March 20, 2013 Hi! I just updated my rAthena to the latest revision, and I got a few issues. On the first NPC, I sometimes get nothing from it. and on the second NPC I am stuck at this *see photo below* Quote Link to comment Share on other sites More sharing options...
Capuche Posted March 21, 2013 Share Posted March 21, 2013 On the first NPC, I sometimes get nothing from it. If you try with my test array, I put some nonexistent ID and on the second NPC I am stuck at this *see photo below* I also tried and I don't have this kind of problem (lastest version too) So check if there are some errors in your mapserv when you click on the npc, otherwise I can't help you Quote Link to comment Share on other sites More sharing options...
Hi rAthena boards! I was wondering if you could help me on this one.
Our server has tons of Costume Headgears, I mean seriously. Tons.
Now, what I want to have(if Possible) is a Gacha NPC that gives you a random Costume Headgear when you gave it a ticket/item of some sort.
And also if it could have 2 different kinds of ticket, a premium one(via donate) and a regular one which can be acquired in-game.
If I give the npc the premium ticket, I would have a greater chance to get rare costume.
And if I give it the regular one, I would have a lesser chance to get rare costume.
I hope you awesome guys could help me on this one! Thanks in advance!
Link to comment
Share on other sites