kalabasa Posted February 1, 2022 Group: Members Topic Count: 123 Topics Per Day: 0.05 Content Count: 478 Reputation: 14 Joined: 11/30/17 Last Seen: January 23 Share Posted February 1, 2022 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; } 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, 2022 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted February 1, 2022 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, 2022 Group: Members Topic Count: 123 Topics Per Day: 0.05 Content Count: 478 Reputation: 14 Joined: 11/30/17 Last Seen: January 23 Author Share Posted February 2, 2022 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...
Question
kalabasa
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
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.