Jump to content
  • 0
sotf

Costume(Headgear) GACHA NPC

Question

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

  • 0
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 😥

Link to comment
Share on other sites

prontera,180,160,5	script	yuio	88,{
	if( countitem( .rare_ticket ) ) {
		mes "A Rare ticket !";
		[email protected] = 500; // chance
	}
	else if( countitem( .normal_ticket ) ) {
		mes "A Normal ticket !";
		[email protected] = 100; // chance
	}
	else {
		mes "Hmmm.. what?";
		close;
	}

	if( select( "Use it", "Cancel" ) -1 ) close;
	if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket
		mes "You got a rare costum.";
		close;
	}
	else {
		mes "You got a normal costum.";
		close;
	}
	
OnInit:
	.normal_ticket = 501;
	.rare_ticket = 502;
	end;
}

 

Hi

And also if it could have 2 different kinds of ticket, a premium one(via donate) and a regular one which can be acquired in-game.

 

If I give the npc the premium ticket, I would have a greater chance to get rare costume.

And if I give it the regular one, I would have a lesser chance to get rare costume.

What is the difference between rare and normal costum ?

Each one have his own band of ID ( 20000-22000 and 22001-23000 for example) ?

One have some characteristics and not the others ? something like that

Link to comment
Share on other sites

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

Link to comment
Share on other sites

prontera,155,177,5    script    yuio    88,{
function Getcostume;
    if( countitem( .rare_ticket ) ) {
        mes "A Rare ticket !";
        [email protected] = .rate_chance_rare; // chance
        [email protected] = .rare_ticket ;
    }
    else if( countitem( .normal_ticket ) ) {
        mes "A Normal ticket !";
        [email protected] = .rate_chance_normal; // chance
        [email protected] = .normal_ticket;
    }
    else {
        mes "Hmmm.. what?";
        close;
    }

    if( select( "Use it", "Cancel" ) -1 ) close;
    delitem [email protected], 1;
    if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket
        mes "You got a rare costum.";
        getitem Getcostume( "rare" ), 1;
        close;
    }
    else {
        mes "You got a normal costum.";
        getitem Getcostume( "normal" ), 1;
        close;
    }
    
OnInit:
    .normal_ticket = 501;
    .rare_ticket = 502;
    .rate_chance_rare = 500; // chance to get a rare costume with rare ticket
    .rate_chance_normal = 100; // chance to get a rare costume with normal ticket
    
// rare costume ID
// size array must be < 128
// use the synthaxe .rare_IDX for adding news array
// ------------------------------------------------
    setarray .rare_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID8,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID9,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID10,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;

// normal costume ID
// size array must be < 128
// use the synthaxe .normal_IDX for adding news array
// ------------------------------------------------
    setarray .normal_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;

// Don't touch
// -----------
    callsub L_size, "rare";
    callsub L_size, "normal";
    end;
L_size:
    while( getd( "."+ getarg(0) +"_ID"+ [email protected] +"[0]" ) ) {
        setd ".size_"+ getarg(0) +""+ [email protected], getarraysize( getd( "."+ getarg(0) +"_ID"+ [email protected] ) );
        setd ".size_tot_"+ getarg(0), getd( ".size_tot_"+ getarg(0) ) + getarraysize( getd( "."+ getarg(0) +"_ID"+ [email protected] ) );
        [email protected]++;
    }
    return;

function Getcostume {
    [email protected] = rand( 1, getd( ".size_tot_"+ getarg(0) ) );
    [email protected] = -1;
    while( [email protected] > [email protected] ) [email protected] = [email protected] + getd( ".size_"+ getarg(0) + [email protected]++ );
    [email protected] = [email protected] - ( [email protected] - getd( ".size_"+ getarg(0) + [email protected] ) ) -1;
    return getd( "."+ getarg(0) +"_ID"+ [email protected] +"[ "+ [email protected] +" ]" );
}
}

EDIT

Ah thanks! Uh no not really, the IDs are mixed.

Is it possible to have a NPC script like that where I can just edit to input the IDs of those normal and rare costumes? Because the IDs are really really really mixed haha!

 

Anyways, thank you for the respond! :D

Edited by Capuche
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites


                      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

Link to comment
Share on other sites

Try this one

prontera,155,177,5    script    yuio    88,{
function Getcostume;
    if( countitem( .rare_ticket ) ) {
        mes "A Rare ticket !";
        set [email protected], .rate_chance_rare; // chance
        set [email protected], .rare_ticket ;
    }
    else if( countitem( .normal_ticket ) ) {
        mes "A Normal ticket !";
        set [email protected], .rate_chance_normal; // chance
        set [email protected], .normal_ticket;
    }
    else {
        mes "Hmmm.. what?";
        close;
    }

    if( select( "Use it", "Cancel" ) -1 ) close;
    delitem [email protected], 1;
    if( [email protected] > rand( 1, 1000 ) ) { // chance 50% for rare ticket
        mes "You got a rare costum.";
        getitem Getcostume( "rare" ), 1;
        close;
    }
    else {
        mes "You got a normal costum.";
        getitem Getcostume( "normal" ), 1;
        close;
    }
    
OnInit:
    set .normal_ticket, 501;
    set .rare_ticket, 502;
    set .rate_chance_rare, 500; // chance to get a rare costume with rare ticket
    set .rate_chance_normal, 100; // chance to get a rare costume with normal ticket
    
// rare costume ID
// size array must be < 128
// use the synthaxe .rare_IDX for adding news array
// ------------------------------------------------
    setarray .rare_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID8,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID9,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .rare_ID10,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;

// normal costume ID
// size array must be < 128
// use the synthaxe .normal_IDX for adding news array
// ------------------------------------------------
    setarray .normal_ID0,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID1,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID2,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID3,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID4,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID5,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID6,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;
    setarray .normal_ID7,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600;

// Don't touch
// -----------
    while( getd( ".rare_ID"+ [email protected] +"[0]" ) ) {
        setd ".size_rare"+ [email protected], getarraysize( getd( ".rare_ID"+ [email protected] ) );
        set .size_tot_rare, .size_tot_rare + getarraysize( getd( ".rare_ID"+ [email protected] ) );
        set [email protected], [email protected] +1;
    }
    set [email protected], 0;
    while( getd( ".normal_ID"+ [email protected] +"[0]" ) ) {
        setd ".size_normal"+ [email protected], getarraysize( getd( ".normal_ID"+ [email protected] ) );
        set .size_tot_normal, .size_tot_normal + getarraysize( getd( ".normal_ID"+ [email protected] ) );
        set [email protected], [email protected] +1;
    }
    end;

function Getcostume {
    if( getarg(0) == "normal" ) {
        set [email protected], rand( 1, .size_tot_normal );
        while( [email protected] > [email protected] ) {
            set [email protected], [email protected] + getd( ".size_normal"+ [email protected] );
            set [email protected], [email protected] +1;
        }
        set [email protected], [email protected] - ( [email protected] - getd( ".size_normal"+ [email protected] ) ) -1;
        return getd( ".normal_ID"+ [email protected] +"[ "+ [email protected] +" ]" );
    }
    else {
        set [email protected], rand( 1,.size_tot_rare );
        while( [email protected] > [email protected] ) {
            set [email protected], [email protected] + getd( ".size_rare" + [email protected] );
            set [email protected], [email protected] +1;
        }
        set [email protected], [email protected] - ( [email protected] - getd( ".size_rare" + [email protected] ) ) -1;
        return getd( ".rare_ID"+ [email protected] +"[ "+ [email protected] +" ]" );
    }
}
}
Edited by Capuche
Link to comment
Share on other sites

^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
Link to comment
Share on other sites

-	shop	costume_shop	-1,501:-1

prontera,150,180,5	script	bghjkl	58,{

	mes "Hi Good Day! Do you have spare costumes !";
	mes "that you wanna get rid of?";
	next;

	set [email protected], select( "No ! Goood bye.", "Trade", "More informations" );
	if( [email protected] == 1 )
		mes "Okay have a nice day.";
	else if( [email protected] == 3 ) {
		mes "blabla more informations.";
	}
	else if( !callsub( L_CheckInventory,0 ) )
		mes "Hmm I don't see any costumes on your inventory. Please check your inventory.";
	else {
		mes "Okay, here's a list of the costumes in your inventory.";
		next;
		npcshopitem "costume_shop",501,-1;
		callsub L_CheckInventory;
		npcshopdelitem "costume_shop",501;
		callshop "costume_shop", 1;
		npcshopattach "costume_shop";
	}
	close;
L_CheckInventory:
	getinventorylist;
	for( set [email protected], 0; [email protected] < @inventorylist_count; set [email protected], [email protected] + 1 )
		if( [email protected]_expire[[email protected]] ) {
			while( getd( ".costume_id"+ [email protected] +"[0]" ) ) {
				while( [email protected] < getd( ".size_costume"+ [email protected] ) && @inventorylist_id[[email protected]] != getd( ".costume_id"+ [email protected] +"["+ [email protected] +"]" ) ) set [email protected], [email protected] + 1;
				if( [email protected] != getd( ".size_costume"+ [email protected] ) ) {
					for( set [email protected], 0; [email protected] < @inventorylist_amount[[email protected]]; set [email protected], [email protected] + 1 ) {
						if( getarg(0,1) )
							npcshopadditem "costume_shop",@inventorylist_id[[email protected]],0;
						set [email protected]_shop, [email protected]_shop + 1;
					}
					break;
				}
				set [email protected], 0;
				set [email protected], [email protected] + 1;
			}
			set [email protected], 0;
			
		}
	return [email protected]_shop;
	
OnBuyItem:
	if( !checkweight2( .item_exchangeID,.item_count ) ) {
		message strcharinfo(0),"You need additional weight capacity to complete this trade.";
		close;
	}
	set [email protected], getarraysize( @bought_nameid );
	for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) {
		set [email protected], .item_count[[email protected]] * [email protected];
		if( [email protected] > 30000) {
			message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[[email protected]] ) +".";
			end;
		}
		set [email protected]$, [email protected]$ + ( getstrlen( [email protected]$ ) ? ", " : "" ) + [email protected] +" "+ getitemname( .item_exchangeID[[email protected]] );
	}
	mes "Sell the costume for "+ [email protected]$ +"?";
	next;
	if( select( "Yes, I sell", "No" ) -1 ) close;
	for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 )
		delitem @bought_nameid[[email protected]], @bought_quantity[[email protected]];
	for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 )
		getitem .item_exchangeID[[email protected]], .item_count[[email protected]] * [email protected];
	mes "good bye.";
	close;
OnInit:
// Item gained
// -----------
	setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,...
	setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID )
	set .size_count, getarraysize( .item_count );

// Costume trade ID
// size array must be < 128
// use the synthaxe .costume_idX for adding news array
// ------------------------------------------------
	setarray .costume_id0, 20000, 20001;
	setarray .costume_id1, 20002, 20003;
	
    while( getd( ".costume_id"+ [email protected] +"[0]" ) ) {
        setd ".size_costume"+ [email protected], getarraysize( getd( ".costume_id"+ [email protected] ) );
        set [email protected], [email protected] +1;
    }
	end;
}

 

 

	setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,...
	setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID )

Item gained

 

 

	setarray .costume_id0, 20000, 20001;
	setarray .costume_id1, 20002, 20003;

Costumes ID to exchange

Link to comment
Share on other sites

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 [email protected]_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 [email protected], getarraysize( @bought_nameid );
    56 :        for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) {

Link to comment
Share on other sites

-	shop	costume_shop	-1,501:-1

prontera,150,180,5	script	bghjkl	58,{

	mes "Hi Good Day! Do you have spare costumes !";
	mes "that you wanna get rid of?";
	next;

	set [email protected], select( "No ! Goood bye.", "Trade", "More informations" );
	if( [email protected] == 1 )
		mes "Okay have a nice day.";
	else if( [email protected] == 3 ) {
		mes "blabla more informations.";
	}

	getinventorylist;
	for( set [email protected], 0; [email protected] < @inventorylist_count; set [email protected], [email protected] + 1 )
		if( [email protected]_expire[[email protected]] ) {
			while( getd( ".costume_id"+ [email protected] +"[0]" ) ) {
				while( [email protected] < getd( ".size_costume"+ [email protected] ) && @inventorylist_id[[email protected]] != getd( ".costume_id"+ [email protected] +"["+ [email protected] +"]" ) ) set [email protected], [email protected] + 1;
				if( [email protected] != getd( ".size_costume"+ [email protected] ) ) {
					for( set [email protected], 0; [email protected] < @inventorylist_amount[[email protected]]; set [email protected], [email protected] + 1 ) {
						set [email protected]_id[ [email protected]_shop ], @inventorylist_id[[email protected]];
						set [email protected]_shop, [email protected]_shop + 1;
					}
					break;
				}
				set [email protected], 0;
				set [email protected], [email protected] + 1;
			}
			set [email protected], 0;
			
		}

	if( [email protected]ize_shop )
		mes "Hmm I don't see any costumes on your inventory. Please check your inventory.";
	else {
		mes "Okay, here's a list of the costumes in your inventory.";
		next;
		npcshopitem "costume_shop",501,-1;
		for( set [email protected], 0; [email protected] < [email protected]_shop; set [email protected], [email protected] + 1 )
			npcshopadditem "costume_shop",[email protected]_id[[email protected]],0;
		npcshopdelitem "costume_shop",501;
		callshop "costume_shop", 1;
		npcshopattach "costume_shop";
	}
	close;
	
OnBuyItem:
	// if( !checkweight2( .item_exchangeID,.item_count ) ) {
		// message strcharinfo(0),"You need additional weight capacity to complete this trade.";
		// close;
	// }
	set [email protected], getarraysize( @bought_nameid );
	for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 ) {
		set [email protected], .item_count[[email protected]] * [email protected];
		if( [email protected] > 30000) {
			message strcharinfo(0),"You can't purchase that many "+ getitemname( .item_exchangeID[[email protected]] ) +".";
			end;
		}
		set [email protected]$, [email protected]$ + ( getstrlen( [email protected]$ ) ? ", " : "" ) + [email protected] +" "+ getitemname( .item_exchangeID[[email protected]] );
	}
	mes "Sell the costume for "+ [email protected]$ +"?";
	next;
	if( select( "Yes, I sell", "No" ) -1 ) close;
	for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 )
		delitem @bought_nameid[[email protected]], @bought_quantity[[email protected]];
	for( set [email protected], 0; [email protected] < .size_count; set [email protected], [email protected] + 1 )
		getitem .item_exchangeID[[email protected]], .item_count[[email protected]] * [email protected];
	mes "good bye.";
	close;
OnInit:
// Item gained
// -----------
	setarray .item_exchangeID, 7539; // item ID gained - you can add more ID <item ID>, <item ID>,...
	setarray .item_count, 10; // item count gained - ( count of the item /element of array of .item_exchangeID )
	set .size_count, getarraysize( .item_count );

// Costume trade ID
// size array must be < 128
// use the synthaxe .costume_idX for adding news array
// ------------------------------------------------
	setarray .costume_id0, 20000, 20001;
	setarray .costume_id1, 20002, 20003;
	
    while( getd( ".costume_id"+ [email protected] +"[0]" ) ) {
        setd ".size_costume"+ [email protected], getarraysize( getd( ".costume_id"+ [email protected] ) );
        set [email protected], [email protected] +1;
    }
	end;
}

I think it would be fine without checkweight's prevention.

 

 

 

 

 

checkweight2? I'm not sure if that command exists

I'm sure that command exist :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>);

Link to comment
Share on other sites

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.....
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.