Jump to content
  • 0

Costume(Headgear) GACHA NPC


Question

Posted

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!

24 answers to this question

Recommended Posts

  • 0
Posted
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 ?

Posted
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

Posted

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! :D

Posted (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! :D

Edited by Capuche
  • Like 1
Posted

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*

post-11036-0-18972200-1362566746_thumb.jpg

Posted

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? :(

Posted

I don't have this kind of error

/hmm

 

What is your emulator (eA, rA, 3ceam, cronus...) ?

Did you made some modifications ?

You make a @reloadscript ?

Are you always stuck without close button ?

Posted


                      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

Posted (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 by Capuche
Posted (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 costumes
that you wanna get rid of?



=========================
(menu)
Yes
No


=========================
(If No)
Okay have a nice day.

[close]
=========================
(if Yes but no costumes in the inventory)
Hmm I don't see any costumes on your
inventory. Please check your inventory.

                                    [close]
=========================
(If Yes and have costumes in inventory)
Okay, here's a list of the costumes
in your inventory.


=========================
(menu)
Costume1
Costume2
Costume3
etc etc
                            [select][cancel]
=========================
(if a costume is selected)
Sell this for 10 Poring Coins?


=========================
(menu)
Yes
No

=========================
(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 by orochimakoto
Posted

-	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

Posted

I get this error:

[Error]:  Loading NPC file: npc/custom/gachabuyer.txt
script 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 capac
ity 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 ) {

Posted

-	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 :P

 

*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>);

Posted

Ahh.. it looks like I have the old version  /pif

---------------------------------------

*checkweight(<item id>,<amount>)
*checkweight("<item name>",<amount>)

This function will compute and return 1 if the total weight of a specified.....
Posted

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 :D

Posted

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*

post-11036-0-93206200-1363822299_thumb.jpg

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...