Quest done already?

Content and general development discussion, including maps, quests, and server code from the development team.
Post Reply
User avatar
chaslinux
Novice
Novice
Posts: 109
Joined: Sat Aug 08, 2009 2:57 am
Location: Kitchener, Ontario

Quest done already?

Post by chaslinux » Fri Nov 26, 2010 9:51 pm

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: 137
Joined: Tue Jun 02, 2009 1:19 pm
Location: Brasil

Re: Quest done already?

Post by alastrim » Sat Nov 27, 2010 12:23 am

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: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: Quest done already?

Post by Crush » Sat Nov 27, 2010 12:52 am

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
Administrator
Administrator
Posts: 704
Joined: Tue Nov 04, 2008 10:17 am
Location: New Zealand

Re: Quest done already?

Post by Freeyorp101 » Sat Nov 27, 2010 2:18 am

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: Sat Aug 08, 2009 2:57 am
Location: Kitchener, Ontario

Re: Quest done already?

Post by chaslinux » Sat Nov 27, 2010 12:27 pm

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: Sat Aug 08, 2009 2:57 am
Location: Kitchener, Ontario

Re: Quest done already?

Post by chaslinux » Sat Nov 27, 2010 12:38 pm

Thanks everyone this is all helpful.
User avatar
Kage
Warrior
Warrior
Posts: 927
Joined: Sat May 02, 2009 7:12 pm

Re: Quest done already?

Post by Kage » Sat Nov 27, 2010 7:47 pm

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