Advertisement
Guest User

Untitled

a guest
Jan 8th, 2021
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.75 KB | None | 0 0
  1. //===== Hercules Script ======================================
  2. //= Wheel of Fortune
  3. //===== By ===================================================
  4. //= Habilis
  5. //= Edited by Myriad
  6. //===== Version ==============================================
  7. //= 1.02 - June 15, 2018
  8. // - Made the script work with zeny, to be more accesibly to everyone.
  9. //= 1.01 - June 14, 2018
  10. // - Added @wheel_of_fortune GM command (level 98+).
  11. // - Merged S_Pay and S_Loop subs into main line of text.
  12. // - S_Gamble is now S_Spin and it will 'return' instead of
  13. // calling back to the initial sub.
  14. //= 1.00 - June 13, 2018
  15. // - Initial script edit for Habilis.
  16. //===== Description ==========================================
  17. //= Wheel of fortune something.
  18. //============================================================
  19.  
  20.  
  21. prontera,170,174,1 script Wheel of Fortune#Main 2_SLOT_MACHINE,{
  22.  
  23. OnTalk:
  24.  
  25. if (!countitem(31908) && #freewheelfortunespin < 10) {
  26. mes("[^0055FFLucky Spin^000000]", .EventName$);
  27. mes("You are out of Event Ticket");
  28. mes("and have no more");
  29. mes("free spins. Come back");
  30. mes("next time for more!");
  31. close();
  32. }
  33.  
  34. .@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
  35. addtimer(1, sprintf("%s::OnEnd", strnpcinfo(NPC_NAME)));
  36. mes("[^0055FFLucky Spin^000000]", .EventName$);
  37. mes("Do you want to spin the wheel?");
  38. mes("It costs ^FF000010 Event Ticket^000000 to play", .@mes$);
  39. next();
  40.  
  41. while (true) {
  42. if (!countitem(31908) && #freewheelfortunespin < 10)
  43. callsub(S_End);
  44. switch (select(
  45. (#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
  46. (countitem(31908)) ? "Yes!. (costs 10 Event Ticket)" : "",
  47. "No (Leave)"
  48. )) {
  49. // pay with free spin
  50. case 1:
  51. if (#freewheelfortunespin > 0) {
  52. if ((#freewheelfortunespin -= 1) < 0)
  53. #freewheelfortunespin = 0;
  54. callsub(S_Spin);
  55. } else
  56. callsub(S_End);
  57. break;
  58.  
  59. // Pay with zeny
  60. case 2:
  61. if (countitem(31908)) {
  62. delitem 31908,10;
  63. callsub(S_Spin);
  64. } else {
  65. cutin("aca_salim02", 2);
  66. mes("[^0055FFLucky Spin^000000]", .EventName$);
  67. mes("Awww, you don't have enough to gamble...");
  68. mes(" ");
  69. mes("Have you ever heard?");
  70. mes("'Money isn't all that matters' Got it?");
  71. mes("Byeeeeeeeeeeeeee ;)");
  72. callsub(S_End);
  73. }
  74. break;
  75.  
  76. default:
  77. callsub(S_End);
  78. }
  79. }
  80.  
  81. // Wheel spin animation
  82. S_Spin:
  83. .@Sector = rand(.Sector_Range[0], .Sector_Range[1]);
  84. .@Display = .@Sector * 2 - 1;
  85. .@Speed = .Spin_Speed;
  86.  
  87. for (.@i = 0; .@i < .nbTurns; .@i++) {
  88. .@b = .Cutin_Range[0];
  89. while (.@b <= .Cutin_Range[1]) {
  90. cutin(sprintf("%s%d", .Cutin$, .@b), 4);
  91. sleep2(.@Speed);
  92. .@b++;
  93. .@Speed += 1; // not ++, because you may want to adjust the stopping +1 +2 +3
  94. }
  95. }
  96.  
  97. .@b = .Cutin_Range[0];
  98. while (.@b < .@Display) {
  99. cutin(sprintf("%s%d", .Cutin$, .@b), 4);
  100. sleep2(.@Speed);
  101. .@b++;
  102. }
  103.  
  104. cutin(sprintf("%s%d", .Cutin$, .@b), 4);
  105.  
  106. if (.Prize_ID[.@Sector] == -1) {
  107. // Free spin
  108. if (.Sound_Effects)
  109. soundeffect("wheel_jackpot.wav", 0);
  110. announce(sprintf("[%s] : Wow, %dx more Free spins!!!", .EventName$, .Prize_Qty[.@Sector]), bc_blue | bc_self);
  111. #freewheelfortunespin = #freewheelfortunespin == 0 ? .Prize_Qty[.@Sector] : #freewheelfortunespin + .Prize_Qty[.@Sector];
  112. } else if (.Prize_ID[.@Sector] == 0) {
  113. // Nothing
  114. if (.Sound_Effects)
  115. soundeffect("wheel_lost.wav", 0);
  116. announce(sprintf("[%s] : Awwww, no luck in your gamble, more luck in love...", .EventName$), bc_blue | bc_self);
  117. } else {
  118. // Item
  119. if (.Sound_Effects)
  120. soundeffect("wheel_won.wav", 0);
  121. announce(sprintf("[%s] : %dx %s - enjoy your prize!", .EventName$, .Prize_Qty[.@Sector], getitemname(.Prize_ID[.@Sector])), bc_blue | bc_self);
  122. getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
  123. }
  124.  
  125. sleep2(1000);
  126. if (!countitem(31908) && #freewheelfortunespin < 10) {
  127. mes("[^0055FFLucky Spin^000000]", .EventName$);
  128. mes("You are out of Event Ticket");
  129. mes("and have no more");
  130. mes("free spins. Come back");
  131. mes("next time for more!");
  132. close();
  133. }
  134. return;
  135.  
  136. S_End:
  137. close2();
  138. OnEnd:
  139. cutin("", 255);
  140. end;
  141.  
  142. OnInit:
  143. .EventName$ = "Wheel Of Fortune";
  144. bindatcmd("wheel_of_fortune", "Wheel_of_Fortune::OnCommand", 98,false);
  145. .Spin_Speed = 50; // What is the base spin speed? (ms)
  146. .nbTurns = 2; // How many times the arrow makes a complete turn, before entering the stopping routine
  147. .Sound_Effects = true; // Enable sound effects? (true/false)
  148.  
  149. // You must have a total of 10 prizes. DO NOT remove 0 or -1 from the array and do not
  150. // change their order.
  151. setarray(.Prize_ID[1], -1, 31909, 14519, 14517, 14518, 14520, 12260, 12221, 0, 12210);
  152. setarray(.Prize_Qty[1], 2, 1, 5, 5, 5, 5, 5, 5, 0, 5);
  153.  
  154. // Don't touch below
  155. .Cutin$ = "WheelOfFortune_";
  156. setarray(.Sector_Range, 1, 10); // Sector range
  157. setarray(.Cutin_Range, 0, 19); // Cutin range
  158. end;
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement