Former Staff .InyaProduction 1124 Posted February 4, 2014 Former Staff Share Posted February 4, 2014 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 end 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 end end Now we can start adding events.Possible actions (+ description): kill -gets triggered everytime you kill a monster or another player. party_kill -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) leave -at changing out of the state <mobvnum>.chat."<message>" -On clicking on the npc <mobvnum> and then choosing the <message> in the appearing questwindow <mobvnum>.click -On clicking on the npc <mobvnum> unmount -on unmounting your horse info or button(should be used together) -on clicking on a quest scroll login -on logging in logout or disconnect (should be used together) -on logging out take -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") end end end 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") end 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") end 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") end Below the last line of text there will be an automaticly generated "OK" buttonIf 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 pc.change_money(20) else pc.change_money(10) end end 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 14 Link to comment Share on other sites More sharing options...
Michel Daoud 0 Posted February 4, 2014 Share Posted February 4, 2014 Thank you It's a great tutorial Sent from my BANANA PHONE 3D X515m using Tapatalk Using Tapatalk Link to comment Share on other sites More sharing options...
Ivica 2 Posted February 5, 2014 Share Posted February 5, 2014 Hey Inya. Your tutorial is very easy to understand. I think the syntax of lua is easier to learn than other languages. In this case lua is even for beginners. Good job! kind regards Link to comment Share on other sites More sharing options...
Zara 3 Posted March 1, 2014 Share Posted March 1, 2014 How it look with working with mysql querry on quests? I want to read out the Boni from gear and add the Boni to other gear all with quest. Link to comment Share on other sites More sharing options...
loyein 18 Posted January 3, 2016 Share Posted January 3, 2016 Thx, good for starters. Link to comment Share on other sites More sharing options...
goodallman14 21 Posted July 30, 2019 Share Posted July 30, 2019 wow thx for this... really tought me something Are you going to do by any chance more of those tutorials? It would be sooo great. Link to comment Share on other sites More sharing options...
Recommended Posts