Try this.
// PVP Gacha NPC with Multi-Roll Options and Custom Notifications
prontera,194,140,4 script PVP Gacha 100,{
// NPC Introduction
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Hello Adventurer! Want to try your luck?";
next;
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Exchange ^ff00005 PVP Tickets^000000 to roll for prizes!";
mes "You can get ^26A7DFPVP Tickets^000000 in our Grand Arena!";
next;
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Consumables:";
mes "<ITEM>^0000ff2x Light White Potion ^000000<INFO>11501</INFO></ITEM>";
mes "<ITEM>^0000ff2x Light Blue Potion ^000000<INFO>11502</INFO></ITEM>";
mes "<ITEM>^0000ff1x Ticket for Kafra Storage ^000000<INFO>7059</INFO></ITEM>";
mes "<ITEM>^0000ff1x Agility Scroll ^000000<INFO>12216</INFO></ITEM>";
mes "<ITEM>^0000ff1x Blessing Scroll ^000000<INFO>12215</INFO></ITEM>";
next;
mes "Grand Prize:[1%]";
mes "<ITEM>^00bfffC. PVP Ticket ^000000<INFO>61966</INFO></ITEM>";
next;
// Check if player has at least 5 PVP Tickets
if (countitem(7960) < 5) goto L_Sorry;
// Roll Options
switch (select("1 Roll (5 PVP Tickets):10 Rolls (50 PVP Tickets):20 Rolls (100 PVP Tickets):50 Rolls (250 PVP Tickets):No way...")) {
case 1: set .Rolls, 1; set .Cost, 5; break;
case 2: set .Rolls, 10; set .Cost, 50; break;
case 3: set .Rolls, 20; set .Cost, 100; break;
case 4: set .Rolls, 50; set .Cost, 250; break;
case 5: close;
}
// Check if player has enough tickets
if (countitem(7960) < .Cost) {
mes "[ ^FF7700PVP Girl^000000 ]";
mes "You don't have enough PVP Gacha Tickets!";
close;
}
// Ask player how they want their rewards displayed
switch(select("Show Every Roll:Just give me my rewards.")) {
case 1: set .ShowEachRoll, 1; break;
case 2: set .ShowEachRoll, 0; break;
}
// Remove PVP Tickets
delitem 7960, .Cost;
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Here we go... Rolling " + .Rolls + " times!";
next;
// Prize Arrays
set .@Total,9;
setarray .@P1[0],1,61966,1; // PVP Ticket (Grand Prize - 1%)
setarray .@P2[0],50,11501,5; // Light Whites
setarray .@P3[0],50,11502,5; // Light Blues
setarray .@P4[0],40,12216,5; // Agi scroll 5x
setarray .@P5[0],40,12215,5; // Blessing Scroll 5x
setarray .@P6[0],30,7059,1; // Kafra Storage
setarray .@P7[0],80,909,1; // Royal Jelly
setarray .@P8[0],100,909,1; // Royal Jelly
setarray .@P9[0],100,909,1; // Royal Jelly
// Rolling Multiple Times
set .@GrandPrizes, 0;
for (set .@count, 0; .@count < .Rolls; set .@count, .@count + 1) {
do {
set .@i, rand(1, .@Total);
} while (rand(1,100) > getd(".@P"+.@i+"[0]"));
// Get the prize item
set .@itemID, getd(".@P"+.@i+"[1]");
set .@itemAmount, getd(".@P"+.@i+"[2]");
// Give the item
getitem .@itemID, .@itemAmount;
// Show individual message per roll (if chosen)
if (.ShowEachRoll) {
mes "[ ^FF7700PVP Girl^000000 ]";
mes "You won " + .@itemAmount + "x " + getitemname(.@itemID) + "!";
next;
} else {
// Save rewards for summary later
setarray .@SummaryID[getarraysize(.@SummaryID)], .@itemID;
setarray .@SummaryAmount[getarraysize(.@SummaryAmount)], .@itemAmount;
}
// Announce ONLY if the player gets the grand prize
if (.@itemID == 61966) {
announce "Congratulations! " + strcharinfo(0) + " just received " + getitemname(.@itemID) + " x " + .@itemAmount + " from PVP Gacha NPC!", 0;
specialeffect2 248;
set .@GrandPrizes, .@GrandPrizes + 1;
}
}
// If the player chose to receive everything at once, show a summary
if (!.ShowEachRoll) {
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Here are all your rewards:";
for (set .@index, 0; .@index < getarraysize(.@SummaryID); set .@index, .@index + 1) {
mes "- " + .@SummaryAmount[.@index] + "x " + getitemname(.@SummaryID[.@index]);
}
next;
}
mes "[ ^FF7700PVP Girl^000000 ]";
mes "Thanks for playing! Come back again.";
close;
L_Sorry:
mes "[ ^FF7700PVP Girl^000000 ]";
mes "You don't have enough PVP Gacha Tickets, please get some!";
close;
OnTimer0050:
showscript "PVP Gacha", getnpcid(0);
initnpctimer;
end;
OnInit:
initnpctimer;
end;
}