kalabasa Posted February 1 Share Posted February 1 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"+ [email protected] ) ) { mes .npc_name$; mes "Item required: ^FFCC00"+ getitemname( getd(".p"+ [email protected] ) ) +"^000000"; mes "Chance to gain something: ^CC0000"+ getd(".p"+ [email protected] +"[1]" ) +"%^000000"; mes "Possible gains:"; for( [email protected] = 3; [email protected] < getarraysize( getd(".p"+ [email protected] ) ); [email protected] += 3 ) mes "^0000FFx"+ getd(".p"+ [email protected] +"["+ [email protected] +"]" ) +"^000000 "+ getitemname( getd(".p"+ [email protected] +"["+ ([email protected] -1) +"]" ) ) +" (^CC0000"+ getd(".p"+ [email protected] +"["+ ([email protected] +1) +"]" ) +"%^000000)"; [email protected]++; next; } } mes .npc_name$; mes "Which item do you want to use ?"; next; for( [email protected] = 0; getd(".p"+ [email protected] ); [email protected]++ ) if( countitem( getd(".p"+ [email protected] ) ) ) { [email protected] = getarraysize( [email protected]$ ); [email protected]$[ [email protected] ] = getitemname( getd(".p"+ [email protected] ) ); [email protected][ [email protected] ] = [email protected]; } [email protected] = [email protected][ select( implode( [email protected]$, ":" ) ) -1 ]; mes .npc_name$; while (1) { mes "Here we go..."; delitem getd(".p"+ [email protected] ), 1; if( rand(100) > getd(".p"+ [email protected] +"[1]" ) )// lose mes "You got nothing"; else { [email protected] = rand( getd(".totalchance"+ [email protected] ) ); [email protected] = 1; while ( ( [email protected] = [email protected] - getd( ".p"+ [email protected] +"["+ (1+ 3 * [email protected]) +"]" ) ) >= 0 ) [email protected]++; getitem getd( ".p"+ [email protected] +"["+ (1+ 3*[email protected] -2) +"]" ), getd( ".p"+ [email protected] +"["+( 1+3*[email protected] -1 )+"]" ); mes "You got ^FF00CC"+ getd( ".p"+ [email protected] +"["+( 1+3*[email protected] -1 )+"]" ) +" "+ getitemname( getd( ".p"+ [email protected] +"["+ (1+ 3*[email protected] -2) +"]" ) ) +"^000000"; } mes " "; mes "wanna try again ?"; next; if ( select( "Yes", "No" ) == 2 ) close; mes .npc_name$; if ( countitem( getd(".p"+ [email protected] ) ) < 1 ) { mes "it seems you have ran out of "+ getitemname( getd(".p"+ [email protected] ) ); 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"+ [email protected] ) ) { for( [email protected] = 4; [email protected] < getarraysize( getd(".p"+ [email protected] ) ); [email protected] += 3 ) setd ".totalchance"+ [email protected], getd(".totalchance"+ [email protected] ) + getd(".p"+ [email protected] +"["+ [email protected] +"]" ); [email protected]++; } .npc_name$ = "[ "+ strnpcinfo(1) +"]"; end; } Required Items are Gold Coin (671) and tcg (7227) if none of this on the user inventory gives error [Warning]:script:implode: array length = 0 [Error]: buildin_delitem: failed to delete 1 items(AID=20000000) item_id=671 Quote Link to comment Share on other sites More sharing options...
1 Capuche Posted February 1 Share Posted February 1 Try the updated script https://github.com/Atemo/scripts_customs/blob/master/olds_scripts/gatcha.txt 1 Quote Link to comment Share on other sites More sharing options...
0 kalabasa Posted February 2 Author Share Posted February 2 13 hours ago, Capuche said: Try the updated script https://github.com/Atemo/scripts_customs/blob/master/olds_scripts/gatcha.txt thank you!!!! Quote Link to comment Share on other sites More sharing options...
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"+ [email protected] ) ) { mes .npc_name$; mes "Item required: ^FFCC00"+ getitemname( getd(".p"+ [email protected] ) ) +"^000000"; mes "Chance to gain something: ^CC0000"+ getd(".p"+ [email protected] +"[1]" ) +"%^000000"; mes "Possible gains:"; for( [email protected] = 3; [email protected] < getarraysize( getd(".p"+ [email protected] ) ); [email protected] += 3 ) mes "^0000FFx"+ getd(".p"+ [email protected] +"["+ [email protected] +"]" ) +"^000000 "+ getitemname( getd(".p"+ [email protected] +"["+ ([email protected] -1) +"]" ) ) +" (^CC0000"+ getd(".p"+ [email protected] +"["+ ([email protected] +1) +"]" ) +"%^000000)"; [email protected]++; next; } } mes .npc_name$; mes "Which item do you want to use ?"; next; for( [email protected] = 0; getd(".p"+ [email protected] ); [email protected]++ ) if( countitem( getd(".p"+ [email protected] ) ) ) { [email protected] = getarraysize( [email protected]$ ); [email protected]$[ [email protected] ] = getitemname( getd(".p"+ [email protected] ) ); [email protected][ [email protected] ] = [email protected]; } [email protected] = [email protected][ select( implode( [email protected]$, ":" ) ) -1 ]; mes .npc_name$; while (1) { mes "Here we go..."; delitem getd(".p"+ [email protected] ), 1; if( rand(100) > getd(".p"+ [email protected] +"[1]" ) )// lose mes "You got nothing"; else { [email protected] = rand( getd(".totalchance"+ [email protected] ) ); [email protected] = 1; while ( ( [email protected] = [email protected] - getd( ".p"+ [email protected] +"["+ (1+ 3 * [email protected]) +"]" ) ) >= 0 ) [email protected]++; getitem getd( ".p"+ [email protected] +"["+ (1+ 3*[email protected] -2) +"]" ), getd( ".p"+ [email protected] +"["+( 1+3*[email protected] -1 )+"]" ); mes "You got ^FF00CC"+ getd( ".p"+ [email protected] +"["+( 1+3*[email protected] -1 )+"]" ) +" "+ getitemname( getd( ".p"+ [email protected] +"["+ (1+ 3*[email protected] -2) +"]" ) ) +"^000000"; } mes " "; mes "wanna try again ?"; next; if ( select( "Yes", "No" ) == 2 ) close; mes .npc_name$; if ( countitem( getd(".p"+ [email protected] ) ) < 1 ) { mes "it seems you have ran out of "+ getitemname( getd(".p"+ [email protected] ) ); 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"+ [email protected] ) ) { for( [email protected] = 4; [email protected] < getarraysize( getd(".p"+ [email protected] ) ); [email protected] += 3 ) setd ".totalchance"+ [email protected], getd(".totalchance"+ [email protected] ) + getd(".p"+ [email protected] +"["+ [email protected] +"]" ); [email protected]++; } .npc_name$ = "[ "+ strnpcinfo(1) +"]"; end; }Required Items are Gold Coin (671) and tcg (7227)
if none of this on the user inventory gives error
[Warning]:script:implode: array length = 0
[Error]: buildin_delitem: failed to delete 1 items(AID=20000000) item_id=671
Link to comment
Share on other sites