viewing paste get random item + announce | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// item_db.txt
// ..... { callfunc( "item_announce",<amount> ); },{},{}
 
-   script  item_announce   {
    set .@amount,getarg(0);
    if( .@amount ){
        setarray .@itemlist,501,502,503,504;
        setarray .@amount,1,2,3,4;
        setarray .@rate,10,20,40,50;
        set .@itemlist_size,getarraysize( .@itemlist );
        do{
            set .@random_rate,rand( 100 );
            set .@random,rand( .@itemlist_size );
        }while( .@random_rate > .@rate[.@random] );
        getitem .@itemlist[.@random],.@amount[.@random];
        announce strcharinfo(0)+" gained "+.@amount[.@random]+"x "+getitemname( .@itemlist[.@random] )+" - ( "+.@rate[.@random]+"%)",bc_all;
    }
    return;
}
Viewed 1474 times, submitted by Emistry.