Quest done already?

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
User avatar
chaslinux
Novice
Novice
Posts: 109
Joined: 08 Aug 2009, 01:57
Location: Kitchener, Ontario

Quest done already?

Post by chaslinux »

So I've created a simple eAthena NPC script. What I'm unclear about is setting the correct kind of variable to track whether the player has completed the quest yet or not. Here's the script:

Code: Select all

//

001-1.gat,53,74,0       script Blackbeard 138,{
        mes "[Captain Blackbeard]";
        mes "\"Me first mate tells me\"";
        mes "\"the crew has contracted scurvy.\"";
        next;
        mes "\"Bring hither 5 Oranges, \"";
        mes "\"10 Red Apples and 5 Cactus \"";
        mes "\"Potions\"";
        menu "Aye, aye, Captain",-,"Forget it",L_forgetit; 
        if (countitem ("CactusPotion") < 5 && countitem ("RedApple") < 10 && countitem ("Orange") < 5) goto L_getmore;
        mes "[Captain Blackbeard]";
        mes "\"Oh, I see these old eyes \"";
        mes "\"are failing me again, you \"";
        mes "\"have the cure for scurvy! \"";
        delitem "CactusPotion", 5;
        delitem "RedApple", 10;
        delitem "Orange", 5;
        set zeny,zeny+5000;
        getexp 3000, 1;
        close;

L_getmore:
        mes "[Captain Blackbeard]";
        mes "\"Good, now get the gone.\"";
close;

L_forgetit:
        mes "[Captain Blackbeard]";
        mes "\"May the dead curse yer soul\"";
        next;
                warp "027-1.gat",81,56;
close;
}
alastrim
Novice
Novice
Posts: 139
Joined: 02 Jun 2009, 12:19
Location: Brasil

Re: Quest done already?

Post by alastrim »

You can create a permanent variable, like "Quest_Blackbeard", when the player brings all the items, using

Code: Select all

set Quest_Blackbeard, 1;
In this way you can be sure when a player did not do the quest (Quest_Blackbeard = 0). It works, but is not the best way to do this, because there is a limit of 96 permanent variables a character can store.

Using bitmask or keeping the same variable to multiple quests seems to be better. In this topic Acegi posted an example script on bitmask, maybe it can be useful:
http://forums.themanaworld.org/viewtopi ... 13&t=11369

Maybe you should use "||"(or), instead of "&&"(and) in this line in your script:

Code: Select all

 if (countitem ("CactusPotion") < 5 && countitem ("RedApple") < 10 && countitem ("Orange") < 5) goto L_getmore;
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: 25 Aug 2005, 16:08
Location: Germany

Re: Quest done already?

Post by Crush »

The scope of variables in eAthena depends on the prefix:

varname: A character variable
@varname: A non-persistent character variable (does not survive a server restart but doesn't waste the 96 variables limit either)
#varname: An account variable (is the same for all characters of an account)
$varname: A global variable (is the same for every character on the server)

More information about variables can be found here:
http://eathena.ws/wiki/index.php/Variables
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
Freeyorp101
Archivist Prime
Archivist Prime
Posts: 765
Joined: 04 Nov 2008, 09:17
Location: New Zealand

Re: Quest done already?

Post by Freeyorp101 »

I wonder if people would set their save point in Tulimshar and simply use it as means to quickly get to the graveyard when you have such a warp for turning down the quest.

Also note that the version of eAthena our tmwAthena was based on differs from mainline eAthena in a number of places regarding variable notation. For instance, there are no npc scoped variables, there is no postfix required for arrays.

---Freeyorp
(09:58:17) < tux9th> Freeyorp: your sig on the forums is kind of outdated
User avatar
chaslinux
Novice
Novice
Posts: 109
Joined: 08 Aug 2009, 01:57
Location: Kitchener, Ontario

Re: Quest done already?

Post by chaslinux »

Freeyorp101 wrote:I wonder if people would set their save point in Tulimshar and simply use it as means to quickly get to the graveyard when you have such a warp for turning down the quest.
Which is why the counter gets added so it can only happen once.
User avatar
chaslinux
Novice
Novice
Posts: 109
Joined: 08 Aug 2009, 01:57
Location: Kitchener, Ontario

Re: Quest done already?

Post by chaslinux »

Thanks everyone this is all helpful.
User avatar
Kage
Manasource
Manasource
Posts: 929
Joined: 02 May 2009, 18:12

Re: Quest done already?

Post by Kage »

Crush wrote:The scope of variables in eAthena depends on the prefix:

varname: A character variable
@varname: A non-persistent character variable (does not survive a server restart but doesn't waste the 96 variables limit either)
#varname: An account variable (is the same for all characters of an account)
$varname: A global variable (is the same for every character on the server)

More information about variables can be found here:
http://eathena.ws/wiki/index.php/Variables
You also have

$@varname: A non-persistent global variable.
<Kage_Jittai> ... are you saying I am elite :D
<thorbjorn> Yes. :P
Post Reply