Crush wrote:I think what chaslinux means is not a constant variable but a persistent variable (one which is saved in the database), because he mentioned the variable name being "Pirate_quest", which has no prefix, which means that it is a persistent character-bound variable.
Thanks Crush, as you guys can see I'm not much of a programmer. Here's the code from both:
npc/001-1_Tulimshar/easton.txt
Code: Select all
//
001-1.gat,53,74,0 script Easton 138,{
// set Pirate_quest,0;
if (Pirate_quest >=4) goto L_doneit;
if (Pirate_quest ==3) goto L_quest4;
if (Pirate_quest ==2) goto L_quest3;
if (Pirate_quest ==1) goto L_quest2;
if (Pirate_quest <1) goto L_start;
// If this happens something is wrong
mes "Easton looks confused.";
close;
L_start:
set Pirate_quest, 0;
mes "[Captain Easton]";
mes "The crew need a good leave";
mes "prove yer salt and bring ";
mes "hither 1 coin purse and 500";
mes "casino coins";
menu "I have them Captain",-,"Not the now Captain",L_forgetit;
if (countitem ("CoinBag") < 1 || countitem ("CasinoCoins") < 500) goto L_getmore;
mes "Thank thee mate";
set Pirate_quest, 1;
delitem "CoinBag",1;
delitem "CasinoCoins",500;
getexp 1000, 1;
close;
L_quest2:
mes "[Captain Easton]";
mes "Me first mate tells me";
mes "the crew has contracted scurvy.";
next;
mes "Bring hither 50 Oranges, ";
mes "100 Red Apples and 50 Cactus";
mes "Potions";
menu "Aye, aye, Captain",-,"Not the now Captain",L_forgetit;
if (countitem ("CactusPotion") < 50 || countitem ("RedApple") < 100 || countitem ("Orange") < 50) goto L_getmore;
mes "[Captain Easton]";
mes "Oh, I see these old eyes";
mes "are failing me again, you";
mes "have the cure for scurvy!";
set Pirate_quest, 2;
delitem "CactusPotion", 50;
delitem "RedApple", 100;
delitem "Orange", 50;
set zeny,zeny+5000;
getexp 3000, 1;
close;
L_quest3:
mes "[Captain Easton]";
mes "The figure-head and bowspirit";
mes "of one of the fleet is no more";
next;
mes "Will ye fetch 100 logs and 2";
mes "iron ingots for repairs?";
menu "Yea Captain",-,"Not the now Captain",L_forgetit;
if (countitem("RawLog") < 100 || countitem ("IngotIron")< 2) goto L_getmore;
getinventorylist;
if (@inventorylist_count==100) goto L_nospace;
mes "Bless you, you have the";
mes "repair materials!";
set Pirate_quest, 3;
delitem "RawLog", 100;
delitem "IngotIron", 2;
set zeny, zeny+10000;
getexp 7000, 1;
getitem 622, 1;
mes "[Captain Easton]";
mes "Take this mate's bandana as";
mes "reward for all yer work";
close;
L_quest4:
mes "[Cpatian Easton";
mes "Ye have been a big help";
mes "mate. There is one more ";
mes "task ye may want to take.";
next;
mes "I'll warn ye now, most don't";
mes "return.";
next;
mes "Ye will need to wear the";
mes "bandana I gave ye and bear";
mes "the mark of the Easton clain.";
next;
mes "We have an agent far west of ";
mes "these lands. That agent is ";
mes "inactive to those who don't";
mes "wear crew gear and bear the";
mes "mark of the Easton clan.";
next;
mes "If ye choose to be marked, the";
mes "agent will be active for thee.";
next;
mes "The agent carries the key to";
mes "tremendous treasure, but also";
mes "bears the weight of a great";
mes "curse!";
next;
mes "Decide now if ye want to be";
mes "marked with the Easton mark?";
menu "Yea",-,"Nea",L_forgetit;
mes "bandana I gave ye and bear";
mes "the mark of the Easton clain.";
next;
mes "We have an agent far west of ";
mes "these lands. That agent is ";
mes "inactive to those who don't";
mes "wear crew gear and bear the";
mes "mark of the Easton clan.";
next;
mes "If ye choose to be marked, the";
mes "agent will be active for thee.";
next;
mes "The agent carries the key to";
mes "tremendous treasure, but also";
mes "bears the weight of a great";
mes "curse!";
next;
mes "Decide now if ye want to be";
mes "marked with the Easton mark?";
menu "Yea",-,"Nea",L_forgetit;
set Pirate_quest, 4;
mes "Mate, welcome to the clan!";
mes "Ye've been marked as one of";
mes "our own. Seek out our agent.";
mes "This experience should';
mes "help thee.";
next;
getexp rand(50000)+1, 1;
close;
L_nospace:
mes "[Captain Easton]";
mes "Ye need to free some space";
mes "in yer inventory before ye";
mes "get yer reward.";
close;
L_getmore:
mes "[Captain Easton]";
mes "Ya need more lad,";
mes "now get thee gone.";
close;
L_forgetit:
mes "[Captain Easton]";
mes "Come back when yer ready.";
close;
L_doneit:
mes "Thanks fer yer help. Our";
mes "business here is done.";
close;
}
The above worked okay until I introduced the next script:
npc/028-1/khent.txt
Code: Select all
//
028-1.gat,50,44,0 script Khent 138,{
if (Pirate_quest ==4) goto L_marked;
set @TEMP, rand(12);
if (@TEMP ==0) goto L_1;
if (@TEMP ==1) goto L_2;
if (@TEMP ==2) goto L_3;
if (@TEMP ==3) goto L_4;
if (@TEMP ==4) goto L_5;
if (@TEMP ==5) goto L_6;
if (@TEMP ==6) goto L_7;
if (@TEMP ==7) goto L_8;
if (@TEMP ==8) goto L_9;
if (@TEMP ==9) goto L_10;
if (@TEMP ==10) goto L_11;
if (@TEMP ==11) goto L_12;
mes "Something is wrong.";
close;
L_1:
mes "[Khent]";
mes "Just hanging loose with ";
mes "these ghastly monsters.";
close;
L_2:
mes "[Khent]";
mes "I'm investigating the ";
mes "hunting patterns of the";
mes "Fallen.";
close;
L_3:
mes "[Khent]";
mes "For Wizardry you really";
mes "should see Auldsbel.";
close;
L_4:
mes "[Khent]";
mes "I was once a young man,";
mes "but I crossed the wrong";
mes "people.";
close;
L_5:
mes "[Khent]";
mes "Did you know that ";
mes "stalactites are full";
mes "of minerals";
close;
L_6:
mes "[Khent]";
mes "Elanore is much more than";
mes "she appears to be at first.";
close;
L_7:
mes "[Khent]";
mes "Even the dumbest novice";
mes "can brew a 100 hp tiny";
mes "potion.";
close;
L_8:
mes "[Khent]";
mes "I wish they opened Nivalis again";
close;
L_9:
mes "[Khent]";
mes "These parts are full of";
mes "facinating creatures. Of ";
mes "special interest are the";
mes "spectres.";
close;
L_10:
mes "[Khent]";
mes "You didn't hear this from";
mes "me, but I heard something";
mes "about a legend sword.";
close;
L_11:
mes "[Khent]";
mes "Sea slimes are distant";
mes "cousins to red slimes";
close;
L_marked:
mes "[Khent]";
mes "Fantastic! You're one";
mes "of the Easton clan!";
next;
mes "I have a favour, but I";
mes "hesitate to ask...";
next;
mes "We travelled far, Captain";
mes "Easton and I. In fact I";
mes "was once his young first mate";
mes "but we stole treasure from";
mes "a terrible undead sorceress.";
next;
L_10:
mes "[Khent]";
mes "You didn't hear this from";
mes "me, but I heard something";
mes "about a legend sword.";
close;
L_11:
mes "[Khent]";
mes "Sea slimes are distant";
mes "cousins to red slimes";
close;
L_marked:
mes "[Khent]";
mes "Fantastic! You're one";
mes "of the Easton clan!";
next;
mes "I have a favour, but I";
mes "hesitate to ask...";
next;
mes "We travelled far, Captain";
mes "Easton and I. In fact I";
mes "was once his young first mate";
mes "but we stole treasure from";
mes "a terrible undead sorceress.";
next;
mes "That woman cursed me with";
mes "a terrible curse. Within me";
mes "dwells the most terrifying";
mes "monster...";
next;
mes "Death lives within me!";
mes "The monster has cut down";
mes "groups of adventurers";
mes "before. Consider my request";
mes "very closely -- your life";
mes "depends on it";
next;
mes "Will you take on the";
mes "deadly beast within me?";
menu "Bring it on",-,"In the future",L_future;
mes "Okay here goes...";
next;
// monster "this",0,0,"Reaper",1111,1;
close;
L_future:
mes "[Khent]";
mes "Sorry to hear that."
close;
}
The second script is unfinished. I disabled spawning the monster. When I introduced the second script the server crashed and would not come up even when I disabled the second script. I had to disable both this and the first script for he server to come back. So I was wondering if the persistent variable took up all my variable space or the problem was caused by the fact that I didn't define them in that db/const.txt file? Shouldn't be since it's a constant correct?
So if this is the case then would it be better to reuse the same persistent variable used in many of the Tulimshar quests? TMW_Quest I think it was.