• 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!

[NPC] Mission with monster counter

Satho

τnє đєv
Joined
Aug 19, 2007
Messages
175
Reaction score
1
Hello! Before you start hating, I am fully aware of all the threads about "Killing in the name of" "Taskquest" and so on,
but none of them fit my need and my skills in scripting are almost equal to zero so I do not know how to edit them for my need, therefore I ask for anyones help here.

So, what I would like is simply a npc, who gives you a mission, and counts the progress.
Example:
Code:
Richard: Hello, would you like to complete my {mission} for a small reward?
Me: mission
Richard: Okay, your mission is to kill 30 demons. Come back when your done to receive your reward.

"You have killed 29/30 Demons"
"You have killed 30/30 Demons, Return to Richard for your reward."

Richard: Have you completed my task?
Me: yes
Richard: Great, here is your reward, you are more than welcome to repeat this mission.

So basically a task that you can repeat over and over again with a monster counter is what I want.
I would deeply appreciate any help I can get, or maybe someone who can help me a step on the way so I can figure it out myself.

Sincerely, Sathure
 
Great idea, but I'm not any good scripter either, so I can't help you. But if someone else can I'm also interested in this script! :)

Do you have any specific rewards, I was thinking of money and/or exp.
 
Great idea, but I'm not any good scripter either, so I can't help you. But if someone else can I'm also interested in this script! :)

Do you have any specific rewards, I was thinking of money and/or exp.

Yea well not that tough to come up with the idea, anyway I was thinking exp, so you can kind of farm this mission :)
 
Well, that's correct, however a good scripter can't do whatever he want to do, since they need ideas as well.
I'm thinking of having this as a starterquest on my server, with monsters that dont give exp so you need to do this quest once to became lvl 8. :)

Another free BUHP
 
I want something like this too, but then without asking the npc for a mission. Your monsters will just be counted and when you killed x minotaurs for example you will after 100 get 10 minotaur leathers, after 250 a minotaur backpack and after 500 access to a teleportal to the horned fox (one time) for example.
 
You could start with something like this then build further on it.

SQL:
ALTER TABLE players ADD COLUMN demontask INT(11) ;

you have to fetch the result before adding +1 to player's table. Do this when he kills a creature ( in this case, a demon ).
SQL:
db.executeQuery("UPDATE players SET demontask = demontask + 1 WHERE id = "..getPlayerGUID(cid)..";")

Fetch the result, output it, update it ( This after a demon was killed )
Lua:
local result = db.getResult("SELECT demontask FROM players WHERE id = "..getPlayerGUID(cid)..";")
local row = tostring(result["demontask"])
local printdk = row + 1
doCreatureSay(cid,"You've killed "..printdk.." Demons.",19)
-- you can put the UPDATE table here

All you need now is a code ^_^

Then make a talkaction command or NPC, allow him to use it and get his reward when he's on 500 kills.

Lua:
local result = db.getResult("SELECT demontask FROM players WHERE id = "..getPlayerGUID(cid)..";")
local demontask = tonumber(result["demontask"])
if demontask >= 500 then
---------- code ---------

Dont forget to free the results!
 
Last edited:
I was thinking of trying to do a mod out of this. But you gave me the start of it, in mySQL, and it looks great. Thanks! :)
 
No problems I guess :p Even though the codes I posted was a complete mess.

Updated my first post.

You can use something like this and 50% of the mission is completed.

Lua:
local result = db.getResult("SELECT demontask FROM players WHERE id = "..getPlayerGUID(cid)..";")
local row = (result["demontask"])
local printdk = row + 1
db.executeQuery("UPDATE players SET demontask = demontask + 1 WHERE id = "..getPlayerGUID(cid)..";")

However I dont know how to fix the error on line 3.

attempt to perform arithmetic on local 'row' (a nil value)

So need someone else to take over from there.
 
Last edited:
Back
Top