Jump to content
  • 0

Gatcha Item Use Gold coin and TCG !


Question

11 answers to this question

Recommended Posts

  • 1
Posted

prontera,155,180,5	script	Random	98,{

	mes .npc_name$;
	mes "Hello, do you want to play ?";
	next;
	if( select( "Play !", "More Informations", "Leave" ) == 3 ) {
		mes .npc_name$;
		mes "Bye!~";
		close;
	}
	else if( @menu == 2 ) {
		while( getd(".p"+ .@j ) ) {
			mes .npc_name$;
			mes "Item required: ^FFCC00"+ getitemname( getd(".p"+ .@j ) ) +"^000000";
			mes "Chance to gain something: ^CC0000"+ getd(".p"+ .@j +"[1]" ) +"%^000000";
			mes "Possible gains:";
			for( .@i = 3; .@i < getarraysize( getd(".p"+ .@j ) ); .@i +=  3 )
				mes "^0000FFx"+ getd(".p"+ .@j +"["+ .@i +"]" ) +"^000000 "+ getitemname( getd(".p"+ .@j +"["+ (.@i -1) +"]" ) ) +" (^CC0000"+ getd(".p"+ .@j +"["+ (.@i +1) +"]" ) +"%^000000)";
			.@j++;
			next;
		}
	}
	mes .npc_name$;
	mes "Which item do you want to use ?";
	next;
	for( .@j = 0; getd(".p"+ .@j ); .@j++ )
		if( countitem( getd(".p"+ .@j ) ) ) {
			.@size = getarraysize( .@menu$ );
			.@menu$[ .@size ] = getitemname( getd(".p"+ .@j ) );
			.@sel[ .@size ] = .@j;
		}
	.@s = .@sel[ select( implode( .@menu$, ":" ) ) -1 ];
	mes .npc_name$;
	while (1) {
		mes "Here we go...";
		delitem getd(".p"+ .@s ), 1;
		if( rand(100) > getd(".p"+ .@s +"[1]" ) )// lose
			mes "You got nothing";
		else {
			.@rand = rand( getd(".totalchance"+ .@s ) );
			.@r = 1;
			while ( ( .@rand = .@rand - getd( ".p"+ .@s +"["+ (1+ 3 * .@r) +"]" ) ) >= 0 ) .@r++;
			getitem getd( ".p"+ .@s +"["+ (1+ 3*.@r -2) +"]" ), getd( ".p"+ .@s +"["+( 1+3*.@r -1 )+"]" );
			mes "You got ^FF00CC"+ getd( ".p"+ .@s +"["+( 1+3*.@r -1 )+"]" ) +" "+ getitemname( getd( ".p"+ .@s +"["+ (1+ 3*.@r -2) +"]" ) ) +"^000000";
		}
		mes " ";
		mes "wanna try again ?";
		next;

		if ( select( "Yes", "No" ) == 2 ) close;
		mes .npc_name$;
		if ( countitem( getd(".p"+ .@s ) ) < 1 ) {
			mes "it seems you have ran out of "+ getitemname( getd(".p"+ .@s ) );
			close;
		}
	}
	close;

OnInit:
// (item ID need) (chance), (reward 1) (number of reward 1) (chance to gain), (reward 2) (number of reward 2) (chance to gain)...
	setarray .p0, 671,50,	2462,1,20,	1161,1,30,	5394,1,50;					// gold coin 
	setarray .p1, 7227,20,	2462,1,10,	2541,1,10,	1161,1,10,	13517,1,70;

	while ( getd(".p"+ .@j ) ) {
		for( .@i = 4; .@i < getarraysize( getd(".p"+ .@j ) ); .@i += 3 )
			setd ".totalchance"+ .@j, getd(".totalchance"+ .@j ) + getd(".p"+ .@j +"["+ .@i +"]" );
		.@j++;
	}
	
	.npc_name$ = "[ "+ strnpcinfo(1) +"]";
	end;
}

gold coin(50% to gain an item)          Possible rewards: Sleipnir(20%), Balmung(30%),bubblegum(50%)

tcg(20%to gain an item)                     Possible rewards: Sleipnir(10%), Asprika(10%), Balmung(10%),yggbox(70%)

This option is set here

// (item ID need) (chance), (reward 1) (number of reward 1) (chance to gain), (reward 2) (number of reward 2) (chance to gain)...
	setarray .p0, 671,50,	2462,1,20,	1161,1,30,	5394,1,50;					// gold coin 
	setarray .p1, 7227,20,	2462,1,10,	2541,1,10,	1161,1,10,	13517,1,70;

 

 

You can add more reward or add an other list following the typo I wrote

  • Upvote 1
  • Love 1
  • 0
Posted
On 4/4/2013 at 7:33 AM, Capuche said:

 


prontera,155,180,5	script	Random	98,{

	mes .npc_name$;
	mes "Hello, do you want to play ?";
	next;
	if( select( "Play !", "More Informations", "Leave" ) == 3 ) {
		mes .npc_name$;
		mes "Bye!~";
		close;
	}
	else if( @menu == 2 ) {
		while( getd(".p"+ .@j ) ) {
			mes .npc_name$;
			mes "Item required: ^FFCC00"+ getitemname( getd(".p"+ .@j ) ) +"^000000";
			mes "Chance to gain something: ^CC0000"+ getd(".p"+ .@j +"[1]" ) +"%^000000";
			mes "Possible gains:";
			for( .@i = 3; .@i < getarraysize( getd(".p"+ .@j ) ); .@i +=  3 )
				mes "^0000FFx"+ getd(".p"+ .@j +"["+ .@i +"]" ) +"^000000 "+ getitemname( getd(".p"+ .@j +"["+ (.@i -1) +"]" ) ) +" (^CC0000"+ getd(".p"+ .@j +"["+ (.@i +1) +"]" ) +"%^000000)";
			.@j++;
			next;
		}
	}
	mes .npc_name$;
	mes "Which item do you want to use ?";
	next;
	for( .@j = 0; getd(".p"+ .@j ); .@j++ )
		if( countitem( getd(".p"+ .@j ) ) ) {
			.@size = getarraysize( .@menu$ );
			.@menu$[ .@size ] = getitemname( getd(".p"+ .@j ) );
			.@sel[ .@size ] = .@j;
		}
	.@s = .@sel[ select( implode( .@menu$, ":" ) ) -1 ];
	mes .npc_name$;
	while (1) {
		mes "Here we go...";
		delitem getd(".p"+ .@s ), 1;
		if( rand(100) > getd(".p"+ .@s +"[1]" ) )// lose
			mes "You got nothing";
		else {
			.@rand = rand( getd(".totalchance"+ .@s ) );
			.@r = 1;
			while ( ( .@rand = .@rand - getd( ".p"+ .@s +"["+ (1+ 3 * .@r) +"]" ) ) >= 0 ) .@r++;
			getitem getd( ".p"+ .@s +"["+ (1+ 3*.@r -2) +"]" ), getd( ".p"+ .@s +"["+( 1+3*.@r -1 )+"]" );
			mes "You got ^FF00CC"+ getd( ".p"+ .@s +"["+( 1+3*.@r -1 )+"]" ) +" "+ getitemname( getd( ".p"+ .@s +"["+ (1+ 3*.@r -2) +"]" ) ) +"^000000";
		}
		mes " ";
		mes "wanna try again ?";
		next;

		if ( select( "Yes", "No" ) == 2 ) close;
		mes .npc_name$;
		if ( countitem( getd(".p"+ .@s ) ) < 1 ) {
			mes "it seems you have ran out of "+ getitemname( getd(".p"+ .@s ) );
			close;
		}
	}
	close;

OnInit:
// (item ID need) (chance), (reward 1) (number of reward 1) (chance to gain), (reward 2) (number of reward 2) (chance to gain)...
	setarray .p0, 671,50,	2462,1,20,	1161,1,30,	5394,1,50;					// gold coin 
	setarray .p1, 7227,20,	2462,1,10,	2541,1,10,	1161,1,10,	13517,1,70;

	while ( getd(".p"+ .@j ) ) {
		for( .@i = 4; .@i < getarraysize( getd(".p"+ .@j ) ); .@i += 3 )
			setd ".totalchance"+ .@j, getd(".totalchance"+ .@j ) + getd(".p"+ .@j +"["+ .@i +"]" );
		.@j++;
	}
	
	.npc_name$ = "[ "+ strnpcinfo(1) +"]";
	end;
}

This option is set here


// (item ID need) (chance), (reward 1) (number of reward 1) (chance to gain), (reward 2) (number of reward 2) (chance to gain)...
	setarray .p0, 671,50,	2462,1,20,	1161,1,30,	5394,1,50;					// gold coin 
	setarray .p1, 7227,20,	2462,1,10,	2541,1,10,	1161,1,10,	13517,1,70;

 

 

You can add more reward or add an other list following the typo I wrote

@Capuche got error with this script hope you can help ?

1.png.2df97c3dc89f50218e7be116315bc7a6.png

 

2.png.1adc32c2961b97f876c96f8024a661ac.png

  • 0
Posted
On 3/20/2013 at 11:05 AM, Capuche said:
prontera,150,184,5	script	blop	56,{

	mes "hello ! a little gamble ?";
	mes "you will need "+ .item_num +" "+ getitemname( .item_req ) +" or "+ .item_num[1] +" "+ getitemname( .item_req[1] ) +" to play";
	next;
	set .@req_1, countitem( .item_req ) - .item_num;
	set .@req_2, countitem( .item_req[1] ) - .item_num[1];
	set .@s, select( ( .@req_1 >= 0 ? "Play with "+ getitemname( .item_req ) +"!" : "" ), ( .@req_2 >= 0 ? "Play with "+ getitemname( .item_req[1] ) +"!" : "" ),"Leave" ) -1;
	if( .@s == 2 ) {
		mes "good bye !";
		close;
	}
	mes "let's see...";
	sleep2 1000;
	mes ".";
	sleep2 1000;
	mes "..";
	sleep2 1000;
	mes "...";
	if( .percent_gain[.@s] < rand( 1,100 ) ) {
		mes "Sorry you lose !";
		close;
	}
	set .@r, rand( .size_gain );
	getitem .item_gainID[.@r], 1;
	delitem .item_req[.@s], .item_num[.@s];
	mes "you got a "+ getitemname( .item_gainID[.@r] ) +" !";
	close;

OnInit:
	setarray .item_req, 671, 7227;
	setarray .item_num, 1, 1; // number of items req for each column
	setarray .percent_gain, 50,20; // % (independent) to gain something for each column

// equiprobable gains
	setarray .item_gainID, 501,502,503; // Put ID YGG,bubble gum , token and else.

	set .size_gain, getarraysize( .item_gainID );
	end;
}

try this

it seems if you lose you don't lose the items also? so unlimited try until they win?

Posted (edited)

Same the Request script http://rathena.org/board/topic/79595-costumeheadgear-gacha-npc/

 

but i have a diffrent like him.

i want 671 Gold Coin have a 50% drop chance

and 7227 TCG have 20% drop chance

 

the drop is like YGG,bubble gum , token and else....

the script can work also to eathena :)

 

thanks master,

This request was about giving a normal/rare costume in exchange for a ticket, it was not about drop.

 

Maybe you mean to give a gold coin (50% chance) or tgc (20% chance) etc..  in exchange to something ?

Edited by Capuche
  • Upvote 1
Posted
prontera,150,184,5	script	blop	56,{

	mes "hello ! a little gamble ?";
	mes "you will need "+ .item_num +" "+ getitemname( .item_req ) +" or "+ .item_num[1] +" "+ getitemname( .item_req[1] ) +" to play";
	next;
	set .@req_1, countitem( .item_req ) - .item_num;
	set .@req_2, countitem( .item_req[1] ) - .item_num[1];
	set .@s, select( ( .@req_1 >= 0 ? "Play with "+ getitemname( .item_req ) +"!" : "" ), ( .@req_2 >= 0 ? "Play with "+ getitemname( .item_req[1] ) +"!" : "" ),"Leave" ) -1;
	if( .@s == 2 ) {
		mes "good bye !";
		close;
	}
	mes "let's see...";
	sleep2 1000;
	mes ".";
	sleep2 1000;
	mes "..";
	sleep2 1000;
	mes "...";
	if( .percent_gain[.@s] < rand( 1,100 ) ) {
		mes "Sorry you lose !";
		close;
	}
	set .@r, rand( .size_gain );
	getitem .item_gainID[.@r], 1;
	delitem .item_req[.@s], .item_num[.@s];
	mes "you got a "+ getitemname( .item_gainID[.@r] ) +" !";
	close;

OnInit:
	setarray .item_req, 671, 7227;
	setarray .item_num, 1, 1; // number of items req for each column
	setarray .percent_gain, 50,20; // % (independent) to gain something for each column

// equiprobable gains
	setarray .item_gainID, 501,502,503; // Put ID YGG,bubble gum , token and else.

	set .size_gain, getarraysize( .item_gainID );
	end;
}

try this

  • Upvote 1
Posted

@Capuche nyc script but I wanna ask for something a bit different

 

I want Gold Coin and TCG to have different sets of items with different percentages

ex.

gold coin(50% to gain an item)          Possible rewards: Sleipnir(20%), Balmung(30%),bubblegum(50%)

tcg(20%to gain an item)                     Possible rewards: Sleipnir(10%), Asprika(10%), Balmung(10%),yggbox(70%)

 

something like that pls....

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...