sotf Posted March 3, 2013 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Members Topic Count: 146 Topics Per Day: 0.06 Content Count: 355 Reputation: 8 Joined: 04/16/18 Last Seen: October 21, 2024 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted March 5, 2013 prontera,180,160,5 script yuio 88,{ if( countitem( .rare_ticket ) ) { mes "A Rare ticket !"; .@r = 500; // chance } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; .@r = 100; // chance } else { mes "Hmmm.. what?"; close; } if( select( "Use it", "Cancel" ) -1 ) close; if( .@r > 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted March 5, 2013 (edited) 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 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 1 Quote Link to comment Share on other sites More sharing options...
sotf Posted March 6, 2013 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Members Topic Count: 98 Topics Per Day: 0.02 Content Count: 1302 Reputation: 79 Joined: 12/04/12 Last Seen: September 26, 2019 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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 .@r, .rate_chance_rare; // chance set .@ticket, .rare_ticket ; } else if( countitem( .normal_ticket ) ) { mes "A Normal ticket !"; set .@r, .rate_chance_normal; // chance set .@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: 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"+ .@i +"[0]" ) ) { setd ".size_rare"+ .@i, getarraysize( getd( ".rare_ID"+ .@i ) ); set .size_tot_rare, .size_tot_rare + getarraysize( getd( ".rare_ID"+ .@i ) ); set .@i, .@i +1; } set .@i, 0; while( getd( ".normal_ID"+ .@i +"[0]" ) ) { setd ".size_normal"+ .@i, getarraysize( getd( ".normal_ID"+ .@i ) ); set .size_tot_normal, .size_tot_normal + getarraysize( getd( ".normal_ID"+ .@i ) ); set .@i, .@i +1; } end; function Getcostume { if( getarg(0) == "normal" ) { set .@r, rand( 1, .size_tot_normal ); while( .@r > .@tmp ) { set .@tmp, .@tmp + getd( ".size_normal"+ .@i ); set .@i, .@i +1; } set .@in, .@r - ( .@tmp - getd( ".size_normal"+ .@i ) ) -1; return getd( ".normal_ID"+ .@i +"[ "+ .@in +" ]" ); } else { set .@r, rand( 1,.size_tot_rare ); while( .@r > .@tmp ) { set .@tmp, .@tmp + getd( ".size_rare" + .@i ); set .@i, .@i +1; } set .@in, .@r - ( .@tmp - getd( ".size_rare" + .@i ) ) -1; return getd( ".rare_ID"+ .@i +"[ "+ .@in +" ]" ); } } } Edited March 10, 2013 by Capuche Quote Link to comment Share on other sites More sharing options...
sotf Posted March 14, 2013 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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 .@s, select( "No ! Goood bye.", "Trade", "More informations" ); if( .@s == 1 ) mes "Okay have a nice day."; else if( .@s == 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 .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) if( !@inventorylist_expire[.@i] ) { while( getd( ".costume_id"+ .@k +"[0]" ) ) { while( .@j < getd( ".size_costume"+ .@k ) && @inventorylist_id[.@i] != getd( ".costume_id"+ .@k +"["+ .@j +"]" ) ) set .@j, .@j + 1; if( .@j != getd( ".size_costume"+ .@k ) ) { for( set .@h, 0; .@h < @inventorylist_amount[.@i]; set .@h, .@h + 1 ) { if( getarg(0,1) ) npcshopadditem "costume_shop",@inventorylist_id[.@i],0; set .@size_shop, .@size_shop + 1; } break; } set .@j, 0; set .@k, .@k + 1; } set .@k, 0; } return .@size_shop; OnBuyItem: if( !checkweight2( .item_exchangeID,.item_count ) ) { message strcharinfo(0),"You need additional weight capacity to complete this trade."; close; } set .@count, getarraysize( @bought_nameid ); for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) { set .@check, .item_count[.@i] * .@count; if( .@check > 30000) { message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[.@i] ) +"."; end; } set .@gain$, .@gain$ + ( getstrlen( .@gain$ ) ? ", " : "" ) + .@check +" "+ getitemname( .item_exchangeID[.@i] ); } mes "Sell the costume for "+ .@gain$ +"?"; next; if( select( "Yes, I sell", "No" ) -1 ) close; for( set .@i, 0; .@i < .@count; set .@i, .@i + 1 ) delitem @bought_nameid[.@i], @bought_quantity[.@i]; for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) getitem .item_exchangeID[.@i], .item_count[.@i] * .@count; 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"+ .@i +"[0]" ) ) { setd ".size_costume"+ .@i, getarraysize( getd( ".costume_id"+ .@i ) ); set .@i, .@i +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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 .@size_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 .@count, getarraysize( @bought_nameid ); 56 : for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) { Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted March 19, 2013 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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 .@s, select( "No ! Goood bye.", "Trade", "More informations" ); if( .@s == 1 ) mes "Okay have a nice day."; else if( .@s == 3 ) { mes "blabla more informations."; } getinventorylist; for( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i + 1 ) if( !@inventorylist_expire[.@i] ) { while( getd( ".costume_id"+ .@k +"[0]" ) ) { while( .@j < getd( ".size_costume"+ .@k ) && @inventorylist_id[.@i] != getd( ".costume_id"+ .@k +"["+ .@j +"]" ) ) set .@j, .@j + 1; if( .@j != getd( ".size_costume"+ .@k ) ) { for( set .@h, 0; .@h < @inventorylist_amount[.@i]; set .@h, .@h + 1 ) { set .@list_id[ .@size_shop ], @inventorylist_id[.@i]; set .@size_shop, .@size_shop + 1; } break; } set .@j, 0; set .@k, .@k + 1; } set .@k, 0; } if( !.@size_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 .@i, 0; .@i < .@size_shop; set .@i, .@i + 1 ) npcshopadditem "costume_shop",.@list_id[.@i],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 .@count, getarraysize( @bought_nameid ); for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) { set .@check, .item_count[.@i] * .@count; if( .@check > 30000) { message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[.@i] ) +"."; end; } set .@gain$, .@gain$ + ( getstrlen( .@gain$ ) ? ", " : "" ) + .@check +" "+ getitemname( .item_exchangeID[.@i] ); } mes "Sell the costume for "+ .@gain$ +"?"; next; if( select( "Yes, I sell", "No" ) -1 ) close; for( set .@i, 0; .@i < .@count; set .@i, .@i + 1 ) delitem @bought_nameid[.@i], @bought_quantity[.@i]; for( set .@i, 0; .@i < .size_count; set .@i, .@i + 1 ) getitem .item_exchangeID[.@i], .item_count[.@i] * .@count; 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"+ .@i +"[0]" ) ) { setd ".size_costume"+ .@i, getarraysize( getd( ".costume_id"+ .@i ) ); set .@i, .@i +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 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 173 Reputation: 9 Joined: 11/14/12 Last Seen: June 7, 2023 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 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 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...
Question
sotf
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
24 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.