Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //===== Hercules Script ======================================
- //= Wheel of Fortune
- //===== By ===================================================
- //= Habilis
- //= Edited by Myriad
- //===== Version ==============================================
- //= 1.02 - June 15, 2018
- // - Made the script work with zeny, to be more accesibly to everyone.
- //= 1.01 - June 14, 2018
- // - Added @wheel_of_fortune GM command (level 98+).
- // - Merged S_Pay and S_Loop subs into main line of text.
- // - S_Gamble is now S_Spin and it will 'return' instead of
- // calling back to the initial sub.
- //= 1.00 - June 13, 2018
- // - Initial script edit for Habilis.
- //===== Description ==========================================
- //= Wheel of fortune something.
- //============================================================
- prontera,170,174,1 script Wheel of Fortune#Main 2_SLOT_MACHINE,{
- OnTalk:
- if (!countitem(31908) && #freewheelfortunespin < 10) {
- mes("[^0055FFLucky Spin^000000]", .EventName$);
- mes("You are out of Event Ticket");
- mes("and have no more");
- mes("free spins. Come back");
- mes("next time for more!");
- close();
- }
- .@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
- addtimer(1, sprintf("%s::OnEnd", strnpcinfo(NPC_NAME)));
- mes("[^0055FFLucky Spin^000000]", .EventName$);
- mes("Do you want to spin the wheel?");
- mes("It costs ^FF000010 Event Ticket^000000 to play", .@mes$);
- next();
- while (true) {
- if (!countitem(31908) && #freewheelfortunespin < 10)
- callsub(S_End);
- switch (select(
- (#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
- (countitem(31908)) ? "Yes!. (costs 10 Event Ticket)" : "",
- "No (Leave)"
- )) {
- // pay with free spin
- case 1:
- if (#freewheelfortunespin > 0) {
- if ((#freewheelfortunespin -= 1) < 0)
- #freewheelfortunespin = 0;
- callsub(S_Spin);
- } else
- callsub(S_End);
- break;
- // Pay with zeny
- case 2:
- if (countitem(31908)) {
- delitem 31908,10;
- callsub(S_Spin);
- } else {
- cutin("aca_salim02", 2);
- mes("[^0055FFLucky Spin^000000]", .EventName$);
- mes("Awww, you don't have enough to gamble...");
- mes(" ");
- mes("Have you ever heard?");
- mes("'Money isn't all that matters' Got it?");
- mes("Byeeeeeeeeeeeeee ;)");
- callsub(S_End);
- }
- break;
- default:
- callsub(S_End);
- }
- }
- // Wheel spin animation
- S_Spin:
- .@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
- .@Display = .@Sector * 2 - 1;
- .@Speed = .Spin_Speed;
- for (.@i = 0; .@i < .nbTurns; .@i++) {
- .@b = .Cutin_Range[0];
- while (.@b <= .Cutin_Range[1]) {
- cutin(sprintf("%s%d", .Cutin$, .@b), 4);
- sleep2(.@Speed);
- .@b++;
- .@Speed += 1; // not ++, because you may want to adjust the stopping +1 +2 +3
- }
- }
- .@b = .Cutin_Range[0];
- while (.@b < .@Display) {
- cutin(sprintf("%s%d", .Cutin$, .@b), 4);
- sleep2(.@Speed);
- .@b++;
- }
- cutin(sprintf("%s%d", .Cutin$, .@b), 4);
- if (.Prize_ID[.@Sector] == -1) {
- // Free spin
- if (.Sound_Effects)
- soundeffect("wheel_jackpot.wav", 0);
- announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .EventName$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
- #freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
- } else if (.Prize_ID[.@Sector] == 0) {
- // Nothing
- if (.Sound_Effects)
- soundeffect("wheel_lost.wav", 0);
- announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .EventName$), bc_blue | bc_self);
- } else {
- // Item
- if (.Sound_Effects)
- soundeffect("wheel_won.wav", 0);
- announce(sprintf("[%s] : %dx %s - enjoy your prize!", .EventName$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
- getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
- }
- sleep2(1000);
- if (!countitem(31908) && #freewheelfortunespin < 10) {
- mes("[^0055FFLucky Spin^000000]", .EventName$);
- mes("You are out of Event Ticket");
- mes("and have no more");
- mes("free spins. Come back");
- mes("next time for more!");
- close();
- }
- return;
- S_End:
- close2();
- OnEnd:
- cutin("", 255);
- end;
- OnInit:
- .EventName$ = "Wheel Of Fortune";
- bindatcmd("wheel_of_fortune", "Wheel_of_Fortune::OnCommand", 98,false);
- .Spin_Speed = 50; // What is the base spin speed? (ms)
- .nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
- .Sound_Effects = true; // Enable sound effects? (true/false)
- // You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
- // change their order.
- setarray(.Prize_ID[1], -1, 31909, 14519, 14517, 14518, 14520, 12260, 12221, 0, 12210);
- setarray(.Prize_Qty[1], 2, 1, 5, 5, 5, 5, 5, 5, 0, 5);
- // Don't touch below
- .Cutin$ = "WheelOfFortune_";
- setarray(.Sector_Range, 1, 10); // Sector range
- setarray(.Cutin_Range, 0, 19); // Cutin range
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement