Emistry icon

[RO] Exchanger - Item to Item - Rand

Emistry | PRO | 01/07/17 12:39:34 PM UTC | 0 ⭐ | 576 👁️ | Never ⏰ | []
text |

780 B

|

None

|

0 👍

/

0 👎

prontera,155,181,5	script	Sample#item_rand_item	757,{
 	mes "Pay "+.amount+"x "+getitemname( .itemid )+" and get random items.";
 	while ( countitem( .itemid ) >= .amount ) {
		if ( select( "Pay","Cancel" ) == 2 ) break;
		delitem .itemid,.amount;
		do {
			.@index = rand( .item_size );
		} while( rand( .total_rate ) > .rate[.@index] );
		getitem .item[.@index],1;
		announce "<Random Item> '"+strcharinfo(0)+"' gained "+getitemname( .item[.@index] )+" at "+.rate[.@index]+"%. Gratz.",bc_all;
	}
	close;
 	OnInit:
		.itemid = 512;
		.amount = 100;
 		setarray .item,501,502,503,504,505,506,507;
		setarray .rate, 10, 10, 20, 30, 30, 40, 50;
 		.item_size = getarraysize( .item );
		for ( .@i = 0; .@i < .item_size; .@i++ )
			.total_rate += .rate[.@i];
		end;
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎