//#################################################################################
//# #
//# This script file contains the npc scripts for two quests: #
//# #
//# Quest1: Obtaining a Forest bow #
//# Needed: About 20 Raw logs, 5000gp, some chatting and running #
//# Reward: Forest bow #
//# #
//# Quest2: Obtaining a Wooden shield #
//# Needed: 40 Raw logs, 5000gp #
//# Reward: Wooden shield and 2500exp #
//# #
//# Variables used: @QUEST_Forestbow_state, nibbles 0 and 1 #
//#################################################################################
// Lumberjack
009-1.gat,40,45,0 script Jack 141, {
set @RAWLOGS_AMOUNT, 40;
set @SHIELD_COST, 5000;
set @QUEST_SHIELD_EXP, 2500;
set @Q_Forestbow_MASK, NIBBLE_0_MASK;
set @Q_Forestbow_SHIFT, NIBBLE_0_SHIFT;
set @Q_Woodenshield_MASK, NIBBLE_1_MASK;
set @Q_Woodenshield_SHIFT, NIBBLE_1_SHIFT;
set @Q_Forestbow, ((QUEST_Forestbow_state & @Q_Forestbow_MASK) >> @Q_Forestbow_SHIFT);
set @Q_Woodenshield, ((QUEST_Forestbow_state & @Q_Woodenshield_MASK) >> @Q_Woodenshield_SHIFT);
if (@Q_Woodenshield >= 3) goto L_Shield_state_3;
if (@Q_Woodenshield == 2) goto L_Shield_state_2;
if (@Q_Woodenshield == 1) goto L_Shield_state_1;
if (@Q_Forestbow > 1) goto L_Bow_state_2;
mes "[Jack Lumber]";
mes "\"Hello there, my name is Jack Lumber, the enemy of all trees. If you need some firewood just let me know.\"";
if (Inspector == 1) callsub S_NohMask_Ask;
next;
if (@Q_Forestbow < 1) close;
menu
"I heard you aren't delivering any more living wood. Why not?", -;
mes "[Jack Lumber]";
mes "\"Why not?! I value my life, that's why!.\"";
next;
menu
"What do you mean?", -;
mes "[Jack Lumber]";
mes "\"A week ago I was going to chop down one of those twigleaf trees in the forest to the southwest. These twigleafs are the trees that give me the living wood you speak of. I was just chopping away with my axe and what happened? One of its branches hit me! I thought it fell down or the wind blew it. It hurt! I shook it off and struck it again with my axe and another branch hit me! I got angry and started to chop off all the branches near the ground so this couldn't happen anymore. But I still can't believe what happened next.\"";
next;
menu
"What happened? ", -;
mes "[Jack Lumber]";
mes "\"You'll think I am insane when I tell you.\"";
next;
menu
"I won't. I promise.", -;
mes "[Jack Lumber]";
mes "\"OK. After I chopped off a few branches the whole tree started to move. Its roots tore out of the earth, all the branches started to wave around and a face appeared on the trunk. The whole tree CAME TO LIFE! It was mad!\"";
next;
menu
"Did you run away?", -,
"Did you fight it?", -;
mes "[Jack Lumber]";
mes "\"I fought, of course! I took my axe and attacked the beast! It hit me here *points at a bruise at his shoulder*, here *lifts his trouser leg to show another bruise* and here *lifts his shirt and reveals some even worse bruises*. But i didn't give up. I chopped away at it, branch after branch, and in the end I chopped off its roots and it fell to the ground motionless.\"";
next;
menu
"So you beat the monster? Then why are you so scared?", -;
mes "[Jack Lumber]";
mes "\"Well, I was exhausted and had to rest. A few minutes passed and suddenly I was surrounded by a dozen or more of these living trees!\"";
next;
menu
"Did you fight them, too? ", -;
mes "[Jack Lumber]";
mes "\"Are you crazy? I barely destroyed one of those beasts. I was in no shape to fight again. I ran away as fast as I could. Lucky for me the monsters aren't that fast on their tiny root legs. Ha!\"";
next;
menu
"So you aren't chopping down trees anymore?", -;
mes "[Jack Lumber]";
mes "\"I still do. It's my job. But I no longer chop those twigleafs, I'll tell you that. I know the bowyer master wants some wood from them, but I don't care. I won't risk my life for a few gold pieces. If you want to, just go to the southwest. But I won't go there ever again.\"";
next;
menu
"Southwest you say? OK, thank you.", -;
set @Q_Forestbow, 2;
callsub S_Update_Mask;
close;
L_Bow_state_2:
// Bow state 4: The player has found a perfect piece of wood.
if (@Q_Forestbow > 3) goto L_Bow_state_4;
mes "\"Good luck hunting those tree monsters - you will need it.\"";
if (Inspector == 1) callsub S_NohMask_Ask;
close;
L_Bow_state_4:
mes "[Jack Lumber]";
mes "\"You've finally found that perfect piece of living wood Alan needs to make a Forest bow, haven't you?\"";
next;
menu
"I couldn't afford the bow, though...", L_Shield_state_0,
"No, I'm still looking.", L_Bow_state_4_reaffirm,
"Yes, I've got the Forest bow now.", -,
"I'm a melee warrior, I don't need bows.", L_Shield_state_0;
// Check if the player tells the truth (continue on in any case)
if (@Q_Forestbow > 4) goto L_Shield_state_0;
mes "[Jack Lumber]";
mes "\"Hrmph. I'm someone who respects those speaking the truth.\"";
next;
goto L_Shield_state_0;
L_Bow_state_4_reaffirm:
mes "[Jack Lumber]";
mes "\"You should go talk to Alan again.\"";
close;
L_Shield_state_0:
set @Q_Woodenshield, 1;
callsub S_Update_Mask;
if (Sex == 0) set @child_of_jack$, "daughter";
if (Sex == 1) set @child_of_jack$, "son";
mes "[Jack Lumber]";
mes "\"You no doubt remember how I struggled with those beasts, fighting for my life. Scared me, those seven-branched little stumps did! Never since that day have I strayed near them. And here comes you, cutting them down one by one. I'm proud of you, to dare those trunks a fight. You're strong as if you were my own " + @child_of_jack$ + "!\"";
next;
goto L_Shield_state_1;
L_Shield_state_1:
mes "[Jack Lumber]";
mes "\"I have an idea. What would you say about a new shield?\"";
next;
if (Inspector == 1)
menu
"No thanks.", L_End,
"Yes, please!", -,
"Actually, I'd like to know if you've seen any strange happenings in town.", L_NohMask_Answer;
if (Inspector != 1)
menu
"No thanks.", L_End,
"Yes, please!", -;
mes "[Jack Lumber]";
mes "\"All I need is " + @RAWLOGS_AMOUNT + " raw logs. This needn't be highest-quality wood; pretty much any log you can find should work. Oh, and I'll also need " + @SHIELD_COST + " GP for other materials.\"";
next;
set @Q_Woodenshield, 2;
callsub S_Update_Mask;
close;
L_End:
close;
L_Shield_state_2:
mes "[Jack Lumber]";
mes "\"Let's see if you have enough of everything.\"";
next;
if (countitem("RawLog") < @RAWLOGS_AMOUNT) goto L_Not_enough_logs;
if (zeny < @SHIELD_COST) goto L_Not_enough_money;
getinventorylist;
if (@inventorylist_count == 100) goto L_TooMany;
delitem "RawLog", @RAWLOGS_AMOUNT;
set zeny, zeny - @SHIELD_COST;
getexp @QUEST_SHIELD_EXP, 0;
getitem "WoodenShield", 1;
set @Q_Woodenshield, 3;
callsub S_Update_Mask;
mes "[Jack Lumber]";
mes "\"Have a seat.\"";
mes "Jack saws the logs into pieces, then shaves them until they are smooth to the touch.";
mes "Applying some strong-smelling liquid, he tans them in darker hues.";
next;
mes "[Jack Lumber]";
mes "Grabbing one of two leftover pieces, he begins to carve it into a round shape, then repeats this with the second piece-- shield handles, from what you can tell.";
next;
mes "[Jack Lumber]";
mes "Meanwhile, the sun has dried the other pieces. Jack places them next to each other, adds a frame, and nails everything together.";
mes "The resulting shield looks usable already, but Jack applies another liquid to it and leaves it to dry for a few moments.";
next;
mes "[Jack Lumber]";
mes "Finally, he hands the shield to you.";
mes "\"Enjoy your new shield!\"";
mes "[" + @QUEST_SHIELD_EXP + " experience points]";
next;
goto L_End;
L_Not_enough_logs:
mes "[Jack Lumber]";
mes "\"You don't have enough wood for me to craft this shield; I need a total of " + @RAWLOGS_AMOUNT + " raw logs.\"";
close;
L_Not_enough_money:
mes "[Jack Lumber]";
mes "\"You don't have enough gold, I'm afraid. I need " + @SHIELD_COST + " GP to finish your shield.\"";
close;
L_TooMany:
mes "[Jack Lumber]";
mes "\"You don't have enough room for the shield. Come back when you do.\"";
close;
L_Shield_state_3:
mes "[Jack Lumber]";
mes "\"I hope that my shield will serve you well!\"";
next;
if (Inspector == 1)
menu
"Me too.", -,
"Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;
close;
S_NohMask_Ask:
next;
menu
"I'll keep that in mind.", -,
"Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;
return;
L_NohMask_Answer:
mes "[Jack Lumber]";
mes "\"Sorry, no.\"";
close;
S_Update_Mask:
set QUEST_Forestbow_state,
(QUEST_Forestbow_state & ~(@Q_Forestbow_MASK | @Q_Woodenshield_MASK))
| (@Q_Forestbow << @Q_Forestbow_SHIFT)
| (@Q_Woodenshield << @Q_Woodenshield_SHIFT);
return;
}