I would like to change the following script so that it can be used in a consumable item that calls the function to perform the spin without asking for anything in return, since the item that is consumed is the item in charge of performing the spin, the idea is that when using the item instantly start spinning the spin,
I would like to remove the npc conversations and not ask for gold or anything, only that when using the item I turn the spin and give the prize nothing more
function script spin_basico {
OnTalk:
if (!countitem(671) && #freewheelfortunespin < 0) {
mes("[^0055FFLucky Spin^000000]", .EventName$);
mes("You are out of Gold Coins");
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)));
while (true) {
if (!countitem(671) && #freewheelfortunespin < 0)
callsub(S_End);
switch (select(
(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
(countitem(671)) ? "Si!. ( 1 gold coin)" : "",
"Cancelar"
)) {
// 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(671)) {
delitem 671,1;
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;
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 hay suerte en tu apuesta, más suerte en el amor...", .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(671) && #freewheelfortunespin < 0) {
mes("[^0055FFLucky Spin^000000]", .EventName$);
mes("You are out of Gold Coins");
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 = 10; // What is the base spin speed? (ms)
.nbTurns = 3; // How many times the arrow makes a complete turn, before entering the stopping routine
.Sound_Effects = false; // 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], 0, 40147, 12103, 40182, 40300, 671, -1, 40183, 40100, 40180);
setarray(.Prize_Qty[1], 0, 1, 3, 3, 3, 1, 2, 1, 1, 1);
// Don't touch below
.Cutin$ = "WheelOfFortune_";
setarray(.Sector_Range, 0, 10); // Sector range
setarray(.Cutin_Range, 1, 19); // Cutin range
Question
Kawacito
I would like to change the following script so that it can be used in a consumable item that calls the function to perform the spin without asking for anything in return, since the item that is consumed is the item in charge of performing the spin, the idea is that when using the item instantly start spinning the spin,
I would like to remove the npc conversations and not ask for gold or anything, only that when using the item I turn the spin and give the prize nothing more
function script spin_basico {
OnTalk:
if (!countitem(671) && #freewheelfortunespin < 0) {
mes("[^0055FFLucky Spin^000000]", .EventName$);
mes("You are out of Gold Coins");
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)));
while (true) {
if (!countitem(671) && #freewheelfortunespin < 0)
callsub(S_End);
switch (select(
(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
(countitem(671)) ? "Si!. ( 1 gold coin)" : "",
"Cancelar"
)) {
// 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(671)) {
delitem 671,1;
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:
close;
}
}
// 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 hay suerte en tu apuesta, más suerte en el amor...", .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(671) && #freewheelfortunespin < 0) {
mes("[^0055FFLucky Spin^000000]", .EventName$);
mes("You are out of Gold Coins");
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 = 10; // What is the base spin speed? (ms)
.nbTurns = 3; // How many times the arrow makes a complete turn, before entering the stopping routine
.Sound_Effects = false; // 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], 0, 40147, 12103, 40182, 40300, 671, -1, 40183, 40100, 40180);
setarray(.Prize_Qty[1], 0, 1, 3, 3, 3, 1, 2, 1, 1, 1);
// Don't touch below
.Cutin$ = "WheelOfFortune_";
setarray(.Sector_Range, 0, 10); // Sector range
setarray(.Cutin_Range, 1, 19); // Cutin range
}
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.