Jump to content

How To Questing for Beginners #1


Recommended Posts

  • Former Staff

Hey :)

as requested in the discussions section im gonna make a little beginners quest tutorial.

If you see something wrong just correct me by posting below. Also you can extend my tutorial. I hope at last we get a little "book" of tutorials from different users.

Lets begin.

Im gonna mark every user editable variable like this: <variable>

The first statement that has to be in every quest is following (lua works with "end" so we have to close almost everything with "end" like below)

quest <questname> begin

Now for the beginning lets add the first state. A state is something like a chapter. The first state is always the state start. Like quest end it with an "end"

quest <questname> begin
    state start begin

Now we can start adding events.

Possible actions (+ description):

-gets triggered everytime you kill a monster or another player.

-gets triggered everytime you or a party member kills a monster or another player.

enter (you can use "letter" here aswell)
-at changing into the state (explanation later)

-at changing out of the state

-On clicking on the npc <mobvnum> and then choosing the <message> in the appearing questwindow

-On clicking on the npc <mobvnum>

-on unmounting your horse

info or button(should be used together)
-on clicking on a quest scroll

-on logging in

logout or disconnect (should be used together)
-on logging out

-on pulling an item on a npc
Lets do the first example with a loginmessage. The event has following syntax:

quest loginquest begin
    state start begin
        when login begin
            chat("You logged in")
So in this case the "when login begin" gets triggered when the user logs in.

The "chat()" is a basic quest command in will show the user a white line in the public chat at the bottom of his game like if somebody writes something to the chat.


Now you know the basic quest syntax.


To limit then when actions there is another helper. The "with" tag. Lets say you want to get the message only if youre above level 25

when login with pc.get_level() > 25 begin
    chat("You logged in with level above 25")
I just didnt write that whole "quest" and "state" stuff now i think you know how i should look like now.


In this case the "with pc.get_level() > 25" checks if you login with your level over 25. The load of function like pc.get_level() and chat() that you got is just remembering and looking for them. There are some public lists of it. Most of them are self explaining by their name. pc allways (except some really special cases you shouldnt get unless you try advanced questing) means your own character



Now lets say you got a boss mob at mobvnum 90001 and you want all players to be noticed that a heroic player killed this one.

You know the kill trigger but you dont know how to limit it to one mob only. But you also know the "with" tag now. So lets go ahead.

The command you need here is npc.get_race(). the "npc" always means the mob you killed, clicked or used an item with right now. The get_race gives you his vnum

when kill with npc.get_race() == 90001 begin
    notice(pc.get_name().." was a heroic player and killed the boss")
I think you should all know what pc.get_name() returns right now :) but whats the two dots there?

It does link functions with strings. So lets say you called "Quester"

then the quest sees this:

notice(pc.get_name().." was a heroic player and killed the boss")

as this:

notice("Quester was a heroic player and killed the boss")


For the next im gonna show you how to make this little grey popup with text in it like the most quests have.

Lets say you want to have a little smalltalk with the old woman (9006). You go to her and ask her about her real name.

9006.chat."What's your real name?" will automaticly generate the option when you click at her.

when 9006.chat."What's your real name?" begin
    say_title("Old woman:")
    say("Oh hey "..pc.get_name())
    say("You want to know my real name")
    say("Its Dave and apperently I'm an old man")
    say("But i have something for you")
    pc.give_item2(72702, 1)
    say_reward("You got speed shoes")
Below the last line of text there will be an automaticly generated "OK" button

If you want the text to be on more than one page add a "wait()" where you want to begin the next page. But then you have to make a new say_title() aswell.

As you see im teaching you the basic commands while showing you the syntax. In this case its pc.give_item2(<itemvnum>, <itemcount>) (pc.give_item() is deprecated)


So as last lection for this thread the if statements. Lets say you get 10 yang if youre under lvl 20 and 20 yang if youre above or equal


when 9006.chat."Money?" begin
    if pc.get_level() >= 20 then
the if structure is pretty easy and should be understood by you. If not let me know.


Ok enough for the first part. I would be happy to see other people continue with a second part :)


Greets Inya

  • Love 12
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...
  • 3 years later...

  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.