• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Question about missions "" script""

Chaos ruler

New Member
Joined
Dec 1, 2008
Messages
73
Reaction score
0
Location
The Netherlands
Well i am Djille i am trying to make a otserver .. and i really do my best on it. First i played the server rizzoria and i saw that they work with missions. for example You say hi to an npc you say mission and the npc ask you to get him 30 ape furs and you get ur addon. Or he wants you to kill something for you. That kind of quests. I really wanne know how i can make them so my server will improove a lot. Please give me an example or atleast help me a little. Thx :)

Yours,
Djille

Ps. Maby i post this on the wrong part of the forum sorry for that i dunno were to post this stuff.
 
This would require you to have atleast a minor knowledge of LUA. There are several tutorials on these forums (atleast I believe so), which I'd recommend you to read. What you should always keep in mind is that LUA (and lots of other scripting/programming languages) is basically pure and basic English.

Let me demonstrate, this script
PHP:
if getCreatureLevel(cid) >= 20 then
     doPlayerSendTextMessage(cid, 25, "Hey!")
end
is pretty much equal to this script (this won't work, but it 'translates' the script into English.
PHP:
if the player has a level equal to or higher than 20 then
     send a text message to the player saying "hey!", with the type 25 (green text)
end
Other then that I'd recommend you to study other peoples script (incl. the ones which you get from downloading e.g. The Forgotten Server). This is something you won't learn in a day, but hey - when you get there, you'll know it was worth the effort put into it.

Few abbreviations you should keep in mind are (there are obviously more, but can't really think of any more at the moment as it's rather late):

  • cid = creature id
  • uid = unique id


Good luck.
 
This would require you to have atleast a minor knowledge of LUA. There are several tutorials on these forums (atleast I believe so), which I'd recommend you to read. What you should always keep in mind is that LUA (and lots of other scripting/programming languages) is basically pure and basic English.

Let me demonstrate, this script
PHP:
if getCreatureLevel(cid) >= 20 then
     doPlayerSendTextMessage(cid, 25, "Hey!")
end
is pretty much equal to this script (this won't work, but it 'translates' the script into English.
PHP:
if the player has a level equal to or higher than 20 then
     send a text message to the player saying "hey!", with the type 25 (green text)
end
Other then that I'd recommend you to study other peoples script (incl. the ones which you get from downloading e.g. The Forgotten Server). This is something you won't learn in a day, but hey - when you get there, you'll know it was worth the effort put into it.

Few abbreviations you should keep in mind are (there are obviously more, but can't really think of any more at the moment as it's rather late):

  • cid = creature id
  • uid = unique id


Good luck.

Im not in this part of this forum so much, but i have never seen anything like this before. Nice to see someone helping other ppls that are new to something by makeing an easy "tutorial" (i did know the most of the things you demonstrate, but for new ppls its good. Keep stuffs like this up!)
 
Really thx makr0mango for ur help :) but i am not new at scripting :P it's just i dunno how to make that npc thing. it's to advanced for me i think. But do you think that when i readed all the stuff on forums, i will be able to make the npc quests?
 
Im not in this part of this forum so much, but i have never seen anything like this before. Nice to see someone helping other ppls that are new to something by makeing an easy "tutorial" (i did know the most of the things you demonstrate, but for new ppls its good. Keep stuffs like this up!)
Thank you I suppose, I'm just glad I can help. : )

Really thx makr0mango for ur help :) but i am not new at scripting :P it's just i dunno how to make that npc thing. it's to advanced for me i think. But do you think that when i readed all the stuff on forums, i will be able to make the npc quests?
Hehe, alright. Yes of course you will be able to do missions and things with NPCs later on, it is just a matter of time.

What I would like you to study the most (when it comes to NPCs), is the talkState/talkUser variable which you may find in various NPC LUA files, that is a way to make sure the NPC speaks to you in the correct way.

PHP:
if msgcontains(msg, 'mission') then
     selfSay("I do have a mission for you, do you wish to help me with it?", cid)
     talkState[talkUser] = 1
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
      selfSay("Thank you! Bring me a few bear paws please.", cid)
      setPlayerStorageValue(cid, YOUR_STORAGE, 1)
end
What that does is basically checks if you write 'mission' to the NPC, and if so he will reply with a text such as the first selfSay contains. It also sets the talkState to 1, so you can have several 'missions' (like making talkState 2 the next time). Then it checks if your message contains a 'yes' and that talkState is connected with the first 'mission' (once again, talkState variable). It spills out another text and it also adds a storage to the player (to let him know he started the quest) with a value of 1.

EDIT: Oh and not to mention, The Forgotten Server (not certain about other servers) has a LUA Functions list, make sure you have a look at it. ; )
 
Last edited:
Back
Top