// TMW2 Script
// Author:
// Povo
// Description:
// Will craft green dye for the player but not without having some fun first
014-3,204,110,0 script Rauk NPC_PLAYER,{
function check_items {
if (countitem(BottleOfWoodlandWater) < 1 ||
countitem(MaggotSlime) < 1 ||
countitem(ArtichokeHerb) < 1 ||
Zeny < 100) {
mesq l("Sorry, you don't have everything needed to play.");
next;
goto L_Quit;
}
}
speech S_LAST_NEXT,
l("Huh? Can't you see that I am busy?");
l("What do you want?");
L_Menu:
.@q = getq(HurnscaldQuest_Rauk);
select
l("What are you doing?"),
l("Umm...nevermind.");
mes "";
switch (@menu)
{
case 1:
goto L_LevelCheck;
case 2:
goto L_Quit;
}
L_LevelCheck:
mesn;
mesq l("I am practicing a form of advanced alchemy using some items found by killing monsters in the forest and caves nearby.");
mesq l("I could always use more supplies.");
next;
if (BaseLevel < 30) {
mesn;
mesq l("I would hire you if your level was higher. Low level adventurers usually take too long.");
mesq l("Maybe you should come back later.");
next;
goto L_Quit;
} else {
mesn;
mesq l("You want to help?");
next;
mesn;
mesq l("Heh, I don't know, I usually deal with stronger adventurers...");
mesq l("Look, I know it is not easy out there when you are trying to make something of yourself.");
next;
mesn;
mesq l("Instead of bringing me a large number of items, I will play a game to give you a chance to win a %s for a low price.", getitemlink(GreenDye));
mesq l("To start the game, first give me %d %s. After that, each entry costs %d %s, %d %s, and %d GP.",
1, getitemlink(BottleOfWoodlandWater), 5, getitemlink(MaggotSlime), 3, getitemlink(ArtichokeHerb), 100);
mesq l("You can play as many entries as you want but if you run out of items or give up, there are no refunds");
mesq l("What do you say?");
if (.@q < 1)
setq(HurnscaldQuest_Rauk, 1);
next;
goto L_GameMenu;
}
L_GameMenu:
select
l("Yeah, I will play!"),
l("No thanks.");
mes "";
switch (@menu)
{
case 1:
goto L_GameStart;
case 2:
goto L_Quit;
}
L_GameStart:
.@n = rand(1000);
mesn;
mesq l("I have picked a number between 0 and 1000.");
mesq l("The number will not change, and you can keep guessing until you either give up or get it right.");
mesn;
check_items();
mesq l("Alright, let's play!");
next;
delitem BottleOfWoodlandWater, 1;
inventoryplace EmptyBottle, 1;
getitem(EmptyBottle, 1);
mesn;
L_TryAgain:
mesq l("You have %d %s, %d %s, and %s GP.", countitem(ArtichokeHerb), getitemlink(ArtichokeHerb),
countitem(MaggotSlime), getitemlink(MaggotSlime), fnum(Zeny));
mesq l("Each guess costs %d %s, %d %s, and %d GP.", 1, getitemlink(ArtichokeHerb), 1, getitemlink(MaggotSlime), 100);
check_items();
mesq l("Take a guess?");
next;
select
l("Yes."),
l("No. I will come back later.");
mes "";
switch (@menu)
{
case 1:
delitem ArtichokeHerb, 3;
delitem MaggotSlime, 5;
Zeny = Zeny - 100;
mesn;
mesq l("Pick a number between 0 and 1000.");
input .@amount;
if (.@amount == .@n) {
mesq l("You Win!");
inventoryplace GreenDye, 1;
if (.@q < 2) {
setq(HurnscaldQuest_Rauk, 2);
getexp 800, 0;
}
getitem(GreenDye, 1);
mesq l("That was fun! Enjoy the prize and come back anytime if you want to play again.");
next;
goto L_Quit;
}
if (.@amount < .@n) {
mesn;
mesq l("Wrong! My number is higher.");
next;
goto L_TryAgain;
}
if (.@amount > .@n) {
mesn;
mesq l("Wrong! My number is lower.");
next;
goto L_TryAgain;
}
case 2:
goto L_Quit;
}
L_Quit:
closedialog;
goodbye;
close;
OnInit:
.@npcId = getnpcid(.name$);
.sex = G_MALE;
.distance = 4;
end;
}