//= 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.
//============================================================
- script Wheel_of_Fortune FAKE_NPC ,{
OnInit:
disablenpc "Wheel of Fortune#Main";
disablenpc "Hussein#WOF";
.EventName$ = "[Wheel Of Fortune]";
end;
OnClock0800:
OnClock1200:
OnClock1600:
OnClock2000:
OnClock2200:
OnStart:
set .Start,1;
announce ""+.EventName$+" : The event will begin in 1 minute, near the center of Vip Room.",0;
initnpctimer;
end;
OnTimer60000: // 1 min
enablenpc "Wheel of Fortune#Main";
enablenpc "Hussein#WOF";
announce ""+.EventName$+" : Come to Vip Room and test your luck.",0;
end;
OnTimer1800000: // 30 mins
announce ""+.EventName$+" : One more minute, do your last spin!.",0;
end;
OnTimer1860000: // 31 mins
OnStop:
set .Start,0;
stopnpctimer;
disablenpc "Wheel of Fortune#Main";
disablenpc "Hussein#WOF";
end;
OnCommand:
if (.@atcmd_numparameters != 1) {
dispbottom "Usage: .@atcmd_command$ <start/end>";
//dispbottom "%s failed.", .@atcmd_command$), 0x00FF00);
end;
}
if (.@atcmd_parameters$[0] == "start") {
if (!.Start)
donpcevent "Wheel_of_Fortune::OnStart";
else {
dispbottom "The Wheel of Fortune has already started.";
//dispbottom(sprintf "%s failed.", .@atcmd_command$), 0x00FF00);
}
} else if (.@atcmd_parameters$[0] == "end") {
if (.Start)
donpcevent "Wheel of Fortune::OnStop";
else {
dispbottom "The Wheel of Fortune is not active.";
//dispbottom "%s failed.", .@atcmd_command$), 0x00FF00);
}
} else {
dispbottom "Usage: .@atcmd_command$ <start/end>";
//dispbottom "%s failed.", .@atcmd_command$), 0x00FF00);
}
end;
}
itemmall,184,83,7 script Wheel of Fortune#Main 2_SLOT_MACHINE,{
OnTalk:
if ( (zeny < .Zeny_Cost) && (#freewheelfortunespin < 0)) {
mes .EventName$;
mes "You are out of Zeny";
mes "and have no more";
mes "free spins. Come back";
mes "next time for more!";
close;
}
//.@mes$ = (#freewheelfortunespin > 0) ? ", but you, my friend, have #freewheelfortunespin free spin!";
cutin "aca_salim02",2;
addtimer 1,"Wheel of Fortune#Main::OnEnd";
mes .EventName$;
mes "Do you want to spin the wheel?";
mes "It costs ^FF0000"+.Zeny_Cost+" Zeny^000000";
next;
//callsub S_Spin;
while (true) {
if ( (zeny < .Zeny_Cost) && (#freewheelfortunespin < 0))
callsub S_End;
switch (select(
(#freewheelfortunespin > 0)?"Yes! Use free spin! ("+#freewheelfortunespin+" left)":
(Zeny >= .Zeny_Cost)?"Yes! Use Zeny. (costs "+.Zeny_Cost+"z)":
"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 (zeny >= .Zeny_Cost) {
set zeny,zeny-.Zeny_Cost;
callsub S_Spin;
} else {
cutin "aca_salim02",2;
mes .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 ""+.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 ""+.Cutin$+""+.@b+"",4;
sleep2 .@Speed;
.@b++;
}
cutin ""+.Cutin$+".@b",4;
if (.Prize_ID[.@Sector] == -1) {
// Free spin
if (.Sound_Effects)
soundeffect "wheel_jackpot.wav", 0;
announce ""+.EventName$+": Wow, %dx more Free spins!!!",0;
#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 ""+.EventName$+" : Awwww, no luck in your gamble, more luck in love...",0;
} else {
// Item
if (.Sound_Effects)
soundeffect "wheel_won.wav", 0;
announce ""+.EventName$+" : "+.Prize_Qty[.@Sector]+" "+getitemname(.Prize_ID[.@Sector])+" - enjoy your prize!",0;
getitem(.Prize_ID[.@Sector], .Prize_Qty[.@Sector]);
}
sleep2 1000;
if ((Zeny < .Zeny_Cost) && (#freewheelfortunespin < 0)) {
mes .EventName$;
mes "You are out of Zeny";
mes "and have no more";
mes "free spins. Come back";
mes "next time for more!";
close;
}
//return;
callsub S_Spin;
S_End:
close2;
OnEnd:
cutin "",255;
end;
OnInit:
.EventName$ = "[Hussein]";
bindatcmd "wheeloffortune", "Wheel_of_Fortune::OnStart", 98,98;
set .Spin_Speed,50; // What is the base spin speed? (ms)
set .nbTurns,2; // How many times the arrow makes a complete turn, before entering the stopping routine
set .Zeny_Cost,10000; // How much zeny does it cost for a spin?
set .Sound_Effects,1; // 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, 12103, 13277, 12187, 617, 607, 12186, 604, 0, 7040;
setarray .Prize_Qty[1], 2, 1, 1, 1, 3, 3, 1, 3, 0, 3;
// Don't touch below
.Cutin$ = "WheelOfFortune_";
setarray .Sector_Range, 1, 10; // Sector range
setarray .Cutin_Range, 0, 19; // Cutin range
end;
}
itemmall,181,84,7 script Hussein#WOF 1_M_MERCHANT,{
.@name$ = "[Hussein]";
cutin "aca_salim02",2;
mes .@name$;
mes "I command you to spin";
mes "the Wheel of Fortune!";
next;
getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC, "Wheel of Fortune#Main");
warp .@map$, .@x - 1, .@y - 2;
doevent "Wheel of Fortune#Main::OnTalk";
end;
}
but still not completely fix it,
coz i stuck in
Quote
//callsub S_Spin; ///you can remove it comment if you wanna try it, but its spin is infinity rolling, lol)
while (true) {
if ( (zeny < .Zeny_Cost) && (#freewheelfortunespin < 0))
callsub S_End;
switch (select(
(#freewheelfortunespin > 0)?"Yes! Use free spin! ("+#freewheelfortunespin+" left)":
(Zeny >= .Zeny_Cost)?"Yes! Use Zeny. (costs "+.Zeny_Cost+"z)":
"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 (zeny >= .Zeny_Cost) {
set zeny,zeny-.Zeny_Cost;
callsub S_Spin;
} else {
cutin "aca_salim02",2;
mes .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;
Question
max65
Hi , rathena. Special thx at @t3quila
Can you help him with that plz? ^^
thx for repply.
Link to comment
Share on other sites
0 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.