GmOcean 92 Posted September 14, 2014 File Name: Slot Machine File Submitter: GmOcean File Submitted: 14 Sep 2014 File Category: Events & Games This script will allow users to spend zeny &/or an item for a chance to win a prize from the slot machine. Currently there are 2 versions. First is a Single Slot Machine, where only 1 slot is rolled. Second is the Triple Slot machine, where 3 slots are rolled. For either version, SUCCESS must be the only thing displayed in order to win. To add the cutins, just place them in: data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/illust /* ============================================================= /* NOTE - If using soundeffects you must add the ".wav" files /* provided in the ".rar" file to your: data/wav folder located /* in either your: ( Ragnarok folder ) OR ( .grf file ) /* ============================================================= I've included the PSD file, so you can edit it as you like. Click here to download this file 6 Begin, evilpuncker, THPO and 3 others reacted to this Quote Share this post Link to post Share on other sites
THPO 7 Posted September 14, 2014 This will be nice Thank you for sharing your work. Quote Share this post Link to post Share on other sites
GmOcean 92 Posted September 16, 2014 Updated to v0.2 Quote Share this post Link to post Share on other sites
Reins 3 Posted October 3, 2014 Updated to v0.2 Hi thanks for this it works for me smoothly but how will i change the currency to be used on this? instead zeny it will use a certain item let say Poring Coin(Item ID# 7539) Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 3, 2014 (edited) This is untested as my work station is down atm. But this should do what you want. Just follow the annotations under OnInit label to make it work with items instead of zeny. When my work station is up and running i'll post an update to allow for a more hybrid version and written in better code ( right now it's all smushed together, and is unnessecarily complicated ). /* =============================================================/* Slot Machine - Triple Slot Machine/* =============================================================/* Version: v0.2a/* v0.1 - Original Script Created./* v0.2 - Added Option for Triple Slot Machine with animations./* v0.2a - Added option for item price instead of zeny.Untested./* =============================================================/* Description/* =============================================================/* This script will allow users to spend zeny for a chance to/* win a prize from the slot machine. Currently there are 2/* versions. First is a Single Slot Machine, where only 1 slot/* is rolled. Second is the Triple Slot machine, where 3 slots/* are rolled. For either version, SUCCESS must be the only/* thing displayed in order to win./* =============================================================/* Created By: GmOcean/* ===========================================================*/prontera,152,176,4 script SlotMachine 563,{switch( .mode ){ case 0: // Single Slot machine mode. mes "Do you want to play a game?","It costs: "+ .price[1] +" "+ (.price[2]?"zeny":""+getitemname(.price[0])+"") +" to play."; if( select("YES:NO") == 2 || Zeny < .price[0] && !.price[2] || ( countitem( .price[0] ) < .price[1] ) && .price[2] ){ close; } while( @menu == 1 ){ if( !.price[2] ){ Zeny -= .price[0]; } else { delitem .price[0],.price[1]; } .@a = rand(1,100); if( .@a < atoi(.1animate$[0]) ){ .@a = 1; } else { .@a = 2; } .@b = 1; while( .@b < atoi(.1animate$[.@a]) ) { cutin .1animate$[3] + .@b,4; sleep2 ( ( atoi(.1animate$[4]) * 1000 ) / atoi(.1animate$[.@a]) ); .@b++; } if( .@a == 1 ){ cutin .1animate$[3] + atoi(.1animate$[.@a]),4; dispbottom "Failed"; } else { cutin .1animate$[3] + atoi(.1animate$[.@a]),4; getitem .1prize[0], .1prize[1]; } if( select("Another Round:I'm done") == 2 || Zeny < .price[0] && !.price[2] || ( countitem( .price[0] ) < .price[1] ) && .price[2] ){ cutin "",255; close; } } end; case 1: // Triple Slot machine mode. mes "Do you want to play a game?","It costs: "+ .price[1] +" "+ (.price[2]?"zeny":""+getitemname(.price[0])+"") +" to play."; if( select("YES:NO") == 2 || Zeny < .price[0] && !.price[2] || countitem( .price[0] ) < .price[1] && .price[2] ){ close; } while( @menu == 1 ){ if( !.price[2] ){ Zeny -= .price[0]; } else { delitem .price[0],.price[1]; } // Slot 1 = 100% Chance for success. (Because I didn't make a fail animation for it. .@2 = rand(1,100); //Rolls dice for Slot 2 .@3 = rand(1,100); //Rolls dice for Slot 3 if( .@2 <= atoi(.3animate$[0]) && .@3 <= atoi(.3animate$[1]) ){ .@a = 8; } else if( .@2 <= atoi(.3animate$[0]) && .@3 > atoi(.3animate$[1]) ){ .@a = 6; } else if( .@2 > atoi(.3animate$[0]) && .@3 <= atoi(.3animate$[1]) ){ .@a = 4; } else { .@a = 2; } .@b = 1; while( .@b < atoi(.3animate$[.@a+1]) ) { cutin .3animate$[.@a] + .@b,4; sleep2 ( ( atoi(.3animate$[10]) * 1000 ) / atoi(.3animate$[.@a+1]) ); .@b++; } cutin .3animate$[.@a] + atoi(.3animate$[.@a+1]),4; if( .@a == 2 ){ getitem .3prize[0], .3prize[1]; } else { dispbottom "Failed"; } if( select("Another Round:I'm done") == 2 || Zeny < .price[1] ){ cutin "",255; close; } } end; }OnInit://[ 0 = Single Slot Machine Mode ]_[ 1 = Triple Slot Machine Mode ].mode = 1;//[0] = Fail Rate//[1] = Fail (Do not change)//[2] = Success (Do not change)//[3] = File Name (Do not change)//[4] = Animation Time (Do not change, for best results )setarray .1animate$[0],"30","29","33","slot_","3";//[0] = Fail Rate "Slot 2"//[1] = Fail Rate "Slot 3"//[2] = SSS (Do not change)//[3] = SSS_Count (Do not change)//[4] = SSF (Do not change)//[5] = SSF_Count (Do not change)//[6] = SFS (Do not change)//[7] = SFS_Count (Do not change)//[8] = SFF (Do not change)//[9] = SFF_Count (Do not change)//[10] = Animation Time (Do not change, for best results )setarray .3animate$[0],"30","30","SSS_","41","SSF_","37","SFS_","41","SFF_","45","3";setarray .1prize[0],501,10;setarray .3prize[0],501,30;// [ 0 = SSM Zeny / Item Req ] | [ 1 = TSM Zeny / Item Amt ] | [ 2 = Enable/Disable Item Requirements ( 0 = Disable, 1 = Enable ).// e.g of zeny mode: setarray .price[0], 100, 300, 0; <--- SSM costs 100z, TSM costs 300z to play.// e.g of item mode: setarray .price[0], 501, 10, 1; <---- SSM & TSM costs 10 RedPotions to play.setarray .price[0],100,300,0;end;} Edited October 3, 2014 by GmOcean Quote Share this post Link to post Share on other sites
Reins 3 Posted October 3, 2014 Thanks i've using it now it throws an error after @reloadscript Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 3, 2014 Oh sorry lol. I put the parenthesis in the wrong spot... I always do that when using variable? I don't know why, it just looks better that way. I updated my previous post. Should work, but again, untested. Work station still broken T.T Quote Share this post Link to post Share on other sites
Reins 3 Posted October 4, 2014 (edited) Oh sorry lol. I put the parenthesis in the wrong spot... I always do that when using variable? I don't know why, it just looks better that way. I updated my previous post. Should work, but again, untested. Work station still broken T.T The errors are now gone but when i tried this stuff setarray .price[0],7539,3,1; //requirement is 3 zennies & consume 3 zenies? setarray .price[0],7539,3,0; //requirement is 3 Poring Coin to play but it doesn't consume the 3 Poring Coins and able to Play Edited October 4, 2014 by wiideliva Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 4, 2014 (edited) Edit: Okay, I see your problem. I'm sorry, but ATM i'm not able to properly test these things.... You'll just have to continue to use the zeny mode until I can get a working client system setup at my computer at work. Or until I fix my personal comp (work station). Sorry :/ Edited October 4, 2014 by GmOcean Quote Share this post Link to post Share on other sites
Garr 117 Posted October 4, 2014 Try this one, I think it'll work right: /* =============================================================/* Slot Machine - Triple Slot Machine/* =============================================================/* Version: v0.2a/* v0.1 - Original Script Created./* v0.2 - Added Option for Triple Slot Machine with animations./* v0.2a - Added option for item price instead of zeny.Untested./* =============================================================/* Description/* =============================================================/* This script will allow users to spend zeny for a chance to/* win a prize from the slot machine. Currently there are 2/* versions. First is a Single Slot Machine, where only 1 slot/* is rolled. Second is the Triple Slot machine, where 3 slots/* are rolled. For either version, SUCCESS must be the only/* thing displayed in order to win./* =============================================================/* Created By: GmOcean/* ===========================================================*/prontera,152,176,4 script SlotMachine 563,{switch( .mode ){ case 0: // Single Slot machine mode. mes "Do you want to play a game?","It costs: " + ( .price[2]?(.price[1] + " " + getitemname(.price[0])).price[0] + " zeny") ) + " to play."; if( select("YES:NO") == 2 || (Zeny < .price[0] && !.price[2]) || ( countitem( .price[0] ) < .price[1] && .price[2]) ){ close; } while( @menu == 1 ){ if( !.price[2] ){ Zeny -= .price[0]; } else { delitem .price[0],.price[1]; } .@a = rand(1,100); if( .@a < atoi(.1animate$[0]) ){ .@a = 1; } else { .@a = 2; } .@b = 1; while( .@b < atoi(.1animate$[.@a]) ) { cutin .1animate$[3] + .@b,4; sleep2 ( ( atoi(.1animate$[4]) * 1000 ) / atoi(.1animate$[.@a]) ); .@b++; } if( .@a == 1 ){ cutin .1animate$[3] + atoi(.1animate$[.@a]),4; dispbottom "Failed"; } else { cutin .1animate$[3] + atoi(.1animate$[.@a]),4; getitem .1prize[0], .1prize[1]; } if( select("Another Round:I'm done") == 2 || Zeny < .price[0] && !.price[2] || ( countitem( .price[0] ) < .price[1] ) && .price[2] ){ cutin "",255; close; } } end; case 1: // Triple Slot machine mode. mes "Do you want to play a game?","It costs: "+ .price[1] +" "+ (.price[2]?""+getitemname(.price[0])+"":"zeny") +" to play."; if( select("YES:NO") == 2 || (Zeny < .price[0] && !.price[2]) || (countitem( .price[0] ) < .price[1] && .price[2]) ){ close; } while( @menu == 1 ){ if( !.price[2] ){ Zeny -= .price[0]; } else { delitem .price[0],.price[1]; } // Slot 1 = 100% Chance for success. (Because I didn't make a fail animation for it. .@2 = rand(1,100); //Rolls dice for Slot 2 .@3 = rand(1,100); //Rolls dice for Slot 3 if( .@2 <= atoi(.3animate$[0]) && .@3 <= atoi(.3animate$[1]) ){ .@a = 8; } else if( .@2 <= atoi(.3animate$[0]) && .@3 > atoi(.3animate$[1]) ){ .@a = 6; } else if( .@2 > atoi(.3animate$[0]) && .@3 <= atoi(.3animate$[1]) ){ .@a = 4; } else { .@a = 2; } .@b = 1; while( .@b < atoi(.3animate$[.@a+1]) ) { cutin .3animate$[.@a] + .@b,4; sleep2 ( ( atoi(.3animate$[10]) * 1000 ) / atoi(.3animate$[.@a+1]) ); .@b++; } cutin .3animate$[.@a] + atoi(.3animate$[.@a+1]),4; if( .@a == 2 ){ getitem .3prize[0], .3prize[1]; } else { dispbottom "Failed"; } if( select("Another Round:I'm done") == 2 || Zeny < .price[1] ){ cutin "",255; close; } } end; }OnInit://[ 0 = Single Slot Machine Mode ]_[ 1 = Triple Slot Machine Mode ].mode = 1;//[0] = Fail Rate//[1] = Fail (Do not change)//[2] = Success (Do not change)//[3] = File Name (Do not change)//[4] = Animation Time (Do not change, for best results )setarray .1animate$[0],"30","29","33","slot_","3";//[0] = Fail Rate "Slot 2"//[1] = Fail Rate "Slot 3"//[2] = SSS (Do not change)//[3] = SSS_Count (Do not change)//[4] = SSF (Do not change)//[5] = SSF_Count (Do not change)//[6] = SFS (Do not change)//[7] = SFS_Count (Do not change)//[8] = SFF (Do not change)//[9] = SFF_Count (Do not change)//[10] = Animation Time (Do not change, for best results )setarray .3animate$[0],"30","30","SSS_","41","SSF_","37","SFS_","41","SFF_","45","3";setarray .1prize[0],501,10;setarray .3prize[0],501,30;// [ 0 = SSM Zeny / Item Req ] | [ 1 = TSM Zeny / Item Amt ] | [ 2 = Enable/Disable Item Requirements ( 0 = Disable, 1 = Enable ).// e.g of zeny mode: setarray .price[0], 100, 300, 0; <--- SSM costs 100z, TSM costs 300z to play.// e.g of item mode: setarray .price[0], 501, 10, 1; <---- SSM & TSM costs 10 RedPotions to play.setarray .price[0],7539,3,1;end;} @GmOcean When you use "?" first option after that will go if the condition suceeds, 2nd on failure. Yours were the other way around, and that confused, as it said it should take 3 Poring coins, but was set to take 3 zeny. Also fixed logic for SSM (should've been .price[0] instead of .price[1]). Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 4, 2014 Lol, that makes sense. As for the price[0] i was copy pasting to do it fast since, I didn't wanna get caught at work xD thanks for that. Quote Share this post Link to post Share on other sites
Reins 3 Posted October 5, 2014 Hi there, where i can change the value of success / fail rates? Quote Share this post Link to post Share on other sites
jaBote 438 Posted October 5, 2014 Hi there, where i can change the value of success / fail rates? You've got it nicely documented at the endo of the script. Quote Share this post Link to post Share on other sites
Reins 3 Posted October 5, 2014 Hi there, where i can change the value of success / fail rates? You've got it nicely documented at the endo of the script. sorry i didn't notice lol thanks Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 6, 2014 I updated the files to v0.7 which as a number of changes and additions. It will be available as soon as the upload gets approved by someone with POWER lol. Quote Share this post Link to post Share on other sites
Mhalicot 392 Posted October 6, 2014 Hello GmOcean, Your file has been approved in this Link. However, please manage to update your files in one link. you can Click the 'Upload New Version' at the bottom of the page to update your files. as of now please let me know which files you want to remove. Thanks. Int'l Moderator, Mhalicot Quote Share this post Link to post Share on other sites
GmOcean 92 Posted October 6, 2014 OH LOL, i hadn't realized I clicked upload file... was blindly clicking, while just thinking upload new file lmao. My appologies, I'll keep THIS one. Sorry about that @.@; Quote Share this post Link to post Share on other sites
Mhalicot 392 Posted October 6, 2014 Thanks for your info. Please manage to update your files again so that we can close your duplicate copy. Int'l Moderator, Mhalicot Quote Share this post Link to post Share on other sites
iCORE 33 Posted November 28, 2014 exe will stop working when it triger the winning sound how to fix? Quote Share this post Link to post Share on other sites
Nova 4 Posted December 16, 2014 A great script. Really appreciate the work! There was a few minor errors but once you take care of them you'll be fine. You have to either rename the sound files or how they're referenced in the script. I also set a random array of items on different chances for the win condition for my server. Quote Share this post Link to post Share on other sites
Neneka 2 Posted January 3, 2015 Excuse me. I got an error,How can I fix this ? Btw, I really new to this, Do I have to put Cutins,sound effects,3slot_machine,Slot_Machine into GRF file too ? Quote Share this post Link to post Share on other sites
jaBote 438 Posted January 3, 2015 It seems you haven't properly indicated your emulator the correct path to the slot machine script file. Quote Share this post Link to post Share on other sites
Neneka 2 Posted January 4, 2015 It seems you haven't properly indicated your emulator the correct path to the slot machine script file. Thank you this problem is fixed now XD my path to the script.txt is wrong Btw thanks Quote Share this post Link to post Share on other sites
keough 36 Posted January 13, 2015 I got an idea for this slot machine, make it a daily slot machine it's like on the recent gameplay on facebook games. like you have a daily spinning wheel with random prize. make it daily basis and had a random prize like OBB. i hope there will be an option like this. Quote Share this post Link to post Share on other sites
Easycore 31 Posted February 4, 2015 How to configure for put random rewards? Quote Share this post Link to post Share on other sites