prontera,176,177,4 script Gacha Machine 563,{
.@name$ = strcharinfo(0);
.@rand = rand(.chances);
.@i = 0;
if( countitem(.itm_p) < .itm_a ){
mes .n$;
mes "You don't have any";
mes "^FF0000"+getitemname(.itm_p)+" x "+.itm_a+"^000000";
mes "in your inventory.";
mes " ";
mes "Please come back to me if you have it already.";
close;
}
mes .n$;
mes rand(2) ? ""+callfunc("F_Hi")+" ^0000FFGacha Machine^000000."
: ""+callfunc("F_Hi")+" ^0000FFI'm Gacha Machine^000000";
mes "Required Item: ^CC00FF"+getitemname(.itm_p)+" x1 ^000000";
mes " ";
next;
mes .n$;
mes "Prizes are:";
mes "^CC00FF-^000000 Red Potion";
mes "^CC00FF-^000000 Yggdrasil Berry";
mes "^CC00FF-^000000 Yggdrasil Seed";
next;
mes "Would you risk to play this game?";
next;
if( select("- Play Game","- Cancel") == 2 ) {
mes .n$;
mes "Alright! "+ strcharinfo(0) +" come back anytime you want.";
close;
}
while (( .@rand -= .item_Rate[.@i] ) >= 0 ) .@i++;
progressbar "0x11CC99",.loading; specialeffect2 EF_REMOVETRAP;
if (.item_Rate[.@i] <= 10) {
announce "[ Gacha Machine ]: Player "+ .@name$ +" obtained "+.item_Amt[.@i]+"x "+ getitemname(.item_ID[.@i]) +"",0;
getitem .item_ID[.@i], .item_Amt[.@i];
delitem .itm_p, .itm_a;
mes .n$;
mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000";
close;
}else{
getitem .item_ID[.@i], .item_Amt[.@i];
delitem .itm_p, .itm_a;
mes .n$;
mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000";
close;
}
OnInit:
.n$ = "[ Gacha Machine ]";
.loading = 1; // 0 = No Delay
.itm_p = 33017;608;607; // Required Item
.itm_a = 1;1;1; // Required Amount
setarray .item_ID, 12074,12075,12089,12090,12084,12085,12079,12080,12094,12095,12099,12100,6286,6293,12214,38802,12429,12430,12431,12432,12433,12434,14601,14601,6292,6291,33017,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501; // Item ID List
setarray .item_Amt, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1; // Item ID List
setarray .item_Rate, 99,99,99,99,99,99,99,99,99,99,99,99,60,60,50,50,40,40,40,40,40,40,35,35,30,30,30; // Item ID Chances
.@i = 0;
while ( .item_ID[.@i] ) {
.chances += .item_Rate[.@i];
.@i++;
}
end;
}
Question
BlindRO
prontera,176,177,4 script Gacha Machine 563,{ .@name$ = strcharinfo(0); .@rand = rand(.chances); .@i = 0; if( countitem(.itm_p) < .itm_a ){ mes .n$; mes "You don't have any"; mes "^FF0000"+getitemname(.itm_p)+" x "+.itm_a+"^000000"; mes "in your inventory."; mes " "; mes "Please come back to me if you have it already."; close; } mes .n$; mes rand(2) ? ""+callfunc("F_Hi")+" ^0000FFGacha Machine^000000." : ""+callfunc("F_Hi")+" ^0000FFI'm Gacha Machine^000000"; mes "Required Item: ^CC00FF"+getitemname(.itm_p)+" x1 ^000000"; mes " "; next; mes .n$; mes "Prizes are:"; mes "^CC00FF-^000000 Red Potion"; mes "^CC00FF-^000000 Yggdrasil Berry"; mes "^CC00FF-^000000 Yggdrasil Seed"; next; mes "Would you risk to play this game?"; next; if( select("- Play Game","- Cancel") == 2 ) { mes .n$; mes "Alright! "+ strcharinfo(0) +" come back anytime you want."; close; } while (( .@rand -= .item_Rate[.@i] ) >= 0 ) .@i++; progressbar "0x11CC99",.loading; specialeffect2 EF_REMOVETRAP; if (.item_Rate[.@i] <= 10) { announce "[ Gacha Machine ]: Player "+ .@name$ +" obtained "+.item_Amt[.@i]+"x "+ getitemname(.item_ID[.@i]) +"",0; getitem .item_ID[.@i], .item_Amt[.@i]; delitem .itm_p, .itm_a; mes .n$; mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000"; close; }else{ getitem .item_ID[.@i], .item_Amt[.@i]; delitem .itm_p, .itm_a; mes .n$; mes "You have obtained "+.item_Amt[.@i]+"x ^FF3000"+ getitemname(.item_ID[.@i]) +"^000000"; close; } OnInit: .n$ = "[ Gacha Machine ]"; .loading = 1; // 0 = No Delay .itm_p = 33017;608;607; // Required Item .itm_a = 1;1;1; // Required Amount setarray .item_ID, 12074,12075,12089,12090,12084,12085,12079,12080,12094,12095,12099,12100,6286,6293,12214,38802,12429,12430,12431,12432,12433,12434,14601,14601,6292,6291,33017,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501,501; // Item ID List setarray .item_Amt, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1; // Item ID List setarray .item_Rate, 99,99,99,99,99,99,99,99,99,99,99,99,60,60,50,50,40,40,40,40,40,40,35,35,30,30,30; // Item ID Chances .@i = 0; while ( .item_ID[.@i] ) { .chances += .item_Rate[.@i]; .@i++; } end; }
codebox
Link to comment
Share on other sites
3 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.