Problems with "Rock Knife" Quest
Posted: 19 Oct 2009, 17:31
I'm working on this Rock Knife quest to experiment with scripting. I've ran into some basic problems though. I manipulated "Alan" and "Jack" for "ngus" (soon to be "Angus") and a "Chest". The problem is when the character says "No way! Snakes are dangerous!" the Chest still recognizes that I have talked to ngus, thus responds as if the character has received the key, but the character hasn't. Returning to ngus, he responds as if the character had been sent to find the chest, but hasn't found it yet. This locks the character out from completing the quest. What am I doing wrong? Note: "ngus" is also taking part in the "noh mask" quest, so those parts have been kept, I think, though I haven't tested it to see if it works. Also not sure if I have hanging scripts that shouldn't be there.
Also the coordinates I've entered are for the sake of testing the quest without warping around on my private server.
ngus
chest
Also the coordinates I've entered are for the sake of testing the quest without warping around on my private server.
ngus
Code: Select all
//#################################################################################
//# #
//# This script file contains the npc scripts for the quest to obtain a RockKnife #
//# #
//# Needed: Iron Ore, 200,000gp, some chatting and running. #
//# #
//# Reward: Rock Knife #
//#################################################################################
// Rock Knife Maker
009-2.gat,102,71,0 script ngus 147, {
set @Q_MASK, NIBBLE_0_MASK;
set @Q_SHIFT, NIBBLE_0_SHIFT;
set @Q_status, ((QUEST_RockKnife_state) & @Q_MASK) >> @Q_SHIFT;
if (@Q_status == 1) goto L_State_1;
if (@Q_status == 2) goto L_State_2;
if (@Q_status == 3) goto L_State_3;
if (@Q_status == 4) goto L_State_4;
if (@Q_status == 5) goto L_State_5;
mes "[ngus]";
mes "\"If you want to buy something then please speak to the Blacksmith. I am only doing special requests.\"";
next;
if (Inspector == 10)
menu
"OK, thanks", -,
"Can you make me a really good knife?", L_State_0_1,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"OK, thanks", -,
"Can you make me a really good knife?", L_State_0_1;
close;
L_State_0_1:
mes "[ngus]";
mes "\"You mean like the legendary Rock Knife?\"";
next;
menu
"Yes, that would be nice.", -;
mes "[ngus]";
mes "\"Sorry, I don't make those anymore.\"";
next;
menu
"Oh, too bad.", -,
"Why's that?", L_State_0_2;
close;
L_State_0_2:
mes "[ngus]";
mes "\"The problem is that I don't have the materials nor the right equipment. My knives aren't made from common scrap metal.";
mes "They are made of the strongest ore one can find. Only the best iron ore is good enough to make them.";
mes "I also need my magic hammer, but I left it in a dangerous snake filled cave southeast of Tulimshar years ago.\"";
set @Q_status, 1;
callsub S_Update_Var;
next;
menu
"No way! Snakes are dangerous!", -,
"Bring 'em on! I'll help!", L_State_0_3;
close;
L_State_0_3:
mes "[ngus]";
mes "\"Excellent! Take this key. In the deepest part of the cave is a treasure chest where I put the magic hammer for safe keeping.\"";
next;
menu
"Take the key from ngus.", -;
close;
L_State_1:
mes "[ngus]";
mes "\"Did you get my hammer?\"";
next;
if (Inspector == 10)
menu
"No, I haven't had the time yet", -,
"No, I didn't find it yet.", L_State_1_1,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"No, I haven't had the time yet", -,
"No, I didn't find it yet.", L_State_1_1;
close;
L_State_1_1:
mes "[ngus]";
mes "\"When you leave, just go to Hatmakers cave. It is southeast of Tulimshar in the Snake desert, you can't miss it.\"";
close;
L_State_2:
mes "[ngus]";
mes "\"Did you get my hammer?\"";
next;
if (Inspector == 10)
menu
"Yes, I did. It was exactly where you said it would be. Here you go.", -,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"Yes, I did. It was exactly where you said it would be. Here you go.", -;
mes "[ngus]";
mes "\"Thanks! I'll make that Rock Knife for you. Maybe you can go collect some ore for me then?";
mes "Yellow slimes purify the ore they consume. Bring me their ore I can take a look at them.";
mes "Maybe you will find a piece of ore that is strong enough to make a Rock Knife.\"";
set @Q_status, 3;
callsub S_Update_Var;
close;
L_State_3:
mes "[ngus]";
mes "\"How is the hunt going? Did you bring me any ore?\"";
if (countitem(640) < 1) close;
next;
if (Inspector == 10)
menu
"Here, take a look!", L_State_3_try,
"Yes, but I need it for something else.", -,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"Here, take a look!", L_State_3_try,
"Yes, but I need it for something else.", -;
close;
L_State_3_try:
mes "[ngus]";
mes "\"Hmmm... looks ok, but is it good enough?\"";
mes "ngus examines the ore.";
next;
delitem "IronOre", 1;
set @Temp1, rand(20);
if (@Temp1 == 0) goto L_State_3_success;
mes "He raises the hammer above his head and brings it down onto the ore with all his might, smashing it into dust.";
next;
mes "[ngus]";
mes "\"Sorry, that ore wasn't pure enough for one of my rock knives. Now it is garbage. Give me another.\"";
if (countitem(640) < 1) close;
next;
menu
"Sure, here you go.", L_State_3_try,
"Hey! Stop throwing away my stuff!", -;
close;
L_State_3_success:
mes "ngus examines it with the greatest of scrutiny.";
next;
mes "[ngus]";
mes "\"Aaah! Yes! That is a really fine piece of ore you bought me. It will make an excelent Rock Knife!\"";
next;
set @Q_status, 4;
callsub S_Update_Var;
L_State_4:
mes "[ngus]";
mes "\"I can make you a really nice Rock Knife out of this. I just need 200,000 GP for labor costs.\"";
next;
if (Inspector == 10)
menu
"200,000??? What a ripoff!", -,
"Sure, here you go!", L_State_4_pay,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"200,000??? What a ripoff!", -,
"Sure, here you go!", L_State_4_pay;
close;
L_State_4_pay:
if (zeny < 200000) goto L_State_4_nocash;
getinventorylist;
if (@inventorylist_count == 100) goto L_State_4_TooMany;
set zeny, zeny - 200000;
getitem "RockKnife", 1;
set @Q_status, 5;
callsub S_Update_Var;
mes "[ngus]";
mes "\"Here you go - have fun with it.\"";
close;
L_State_4_nocash:
mes "[ngus]";
mes "\"Seems like you are out of cash.\"";
close;
L_State_4_TooMany:
mes "[ngus]";
mes "\"Seems like you don't have room for this knife. Come back later.\"";
close;
L_State_5:
mes "[ngus]";
mes "\"I hope you are statisfied with your Rock Knife. It is one of my best works.\"";
next;
if (Inspector == 10)
menu
"I am!", -,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
if (Inspector != 10)
menu
"I am!", -;
close;
L_NohMask_Answer:
mes "[ngus]";
mes "\"I'm sorry, friend, I truly am, but I stay in the town. One of the miners might have heard something.\"";
close;
S_Update_Var:
set QUEST_RockKnife_state,
(QUEST_RockKnife_state & ~(@Q_MASK)
| (@Q_status << @Q_SHIFT));
return;
}
Code: Select all
//#################################################################################
//# This script file contains the npc scripts for one quest: #
//# Quest1: Obtaining a Rock Knife #
//# Needed: About 20 Iron Ore, 200,000gp, some chatting and running #
//# Reward: Rock Knife #
//# Variables used: @QUEST_RockKnife_state, nibbles 0 and 1 #
//#################################################################################
// Hammer Chest
009-2.gat,109,70,0 script Chest 111,{
set @Q_RockKnife_MASK, NIBBLE_0_MASK;
set @Q_RockKnife_SHIFT, NIBBLE_0_SHIFT;
set @Q_RockKnife, ((QUEST_RockKnife_state & @Q_RockKnife_MASK) >> @Q_RockKnife_SHIFT);
if (@Q_RockKnife > 1) goto L_RockKnife_state_2;
mes "[Chest]";
mes "\"This Chest appears locked.\"";
if (@Q_RockKnife < 1) close;
menu
"Open the treasure chest with ngus's key", -;
mes "[Chest]";
mes "\"Find the magic hammer.\"";
next;
menu
"Grab magic hammer for ngus.", -;
set @Q_RockKnife, 2;
close;
set QUEST_RockKnife_state,
(QUEST_RockKnife_state & ~(@Q_RockKnife_MASK))
| (@Q_RockKnife << @Q_RockKnife_SHIFT);
return;
}