Well, since I couldn't find any working quest where a npc gives you a mission to kill x ammount of monsters, I decided to make one myself, with a little help and support.
Since I got help, I decided to help others and share this
This quest requires you to kill 200 dragons or dragon lords.
CREATE /creaturescripts/scripts/monsterkilldragon.lua
IN /creaturescripts/scripts/login.lua
ADD:
IN /creaturescripts/creaturescripts.xml
ADD:
CREATE npc/Martin.xml
CREATE npc/scripts/dragon quest.lua
This npc will give you an outfit addon, 1mil exp and 300k. Just change it to whatever you want
Since I got help, I decided to help others and share this
This quest requires you to kill 200 dragons or dragon lords.
Creaturescript
CREATE /creaturescripts/scripts/monsterkilldragon.lua
Code:
local monsters = {
--name = storage
["dragon"] = 55004,
["dragon lord"] = 55004
}
function onKill(cid, target)
local monster = monsters[getCreatureName(target):lower()]
if(isPlayer(target) == FALSE and monster and getPlayerStorageValue(cid, 76669) == 2) then
if getPlayerStorageValue(cid, monster) < 200 then
local killedMonsters = getPlayerStorageValue(cid, monster)
if(killedMonsters == -1) then
killedMonsters = 1
end
setPlayerStorageValue(cid, monster, killedMonsters + 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 200 dragons.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enough dragons.")
setPlayerStorageValue(cid, 76669, 3)
end
end
return TRUE
end
IN /creaturescripts/scripts/login.lua
ADD:
Code:
registerCreatureEvent(cid, "monsterkill")
IN /creaturescripts/creaturescripts.xml
ADD:
Code:
<event type="kill" name="monsterkill" script="monsterkill.lua"/>
NPC
CREATE npc/Martin.xml
Code:
<?xml version="1.0"?>
<npc name="Martin" script="data/npc/scripts/dragon quest.lua" access="3" lookdir="2" walkinterval="2000">
<mana now="800" max="800"/>
<health now="132" max="200"/>
<look type="151" head="115" body="76" legs="35" feet="117" addons="1" corpse="6080"/>
<parameters>
<parameter key="message_greet" value="Hi, can you help me? ask me for a {mission}. "/>
</parameters>
</npc>
CREATE npc/scripts/dragon quest.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local quest = 76669
local reward = 70000
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
npcHandler:say("Great! I'll reward you greatly {ok}?.", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, "ok") and talkState[talkUser] == 2 then
npcHandler:say("Okay, Hurry up!", cid)
setPlayerStorageValue(cid, quest, 2)
talkState[talkUser] = 0
elseif msgcontains(msg, "mission") then
local str = getPlayerStorageValue(cid, quest)
if(str < 2) then
npcHandler:say("Great, an adventurer. I need you to slay 200 dragons for me. And then, we might be able to take out those dragon lords. Well, can you slay 200 dragons for me?", cid)
talkState[talkUser] = 1
return true
elseif(str == 2) then
npcHandler:say("Please come back for a reward.", cid)
elseif(str == 3) then
npcHandler:say("200 dragons, already? You're a true dragon slayer! As I promised, here's your reward.", cid)
doPlayerAddItem(cid, 2160, 30)
doPlayerAddExp(cid, 1000000)
doPlayerAddOutfit(cid, getPlayerSex(cid) == 0 and 142 or 134, 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been rewarded with the warrior addon!")
setPlayerStorageValue(cid, quest, 4)
elseif(str == 4) then
npcHandler:say("You have done enough for me, I will soon plan our attack!", cid)
end
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
This npc will give you an outfit addon, 1mil exp and 300k. Just change it to whatever you want
Last edited: