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

CreatureEvent Killing in the name of...quest!!!

Set missions to kill 12 pirates, where it continues to kill does not work, simply "Raymond Striker: Come back here when you finish your mission." Maybe something wrong with my login.lua and onKill.lua?
TFS 0.3.4pl2

login.lua- I know that this is a big mess; s
PHP:
function onLogin(cid)
registerCreatureEvent(cid, "inquisitionPortals")
registerCreatureEvent(cid, "WarAttack")
registerCreatureEvent(cid, "WarKill")
registerCreatureEvent(cid, "KillingInTheNameOf")    

    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena 

	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		for i = PLAYERLOSS_EXPERIENCE, PLAYERLOSS_ITEMS do
			doPlayerSetLossPercent(cid, i, loss)
		end
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "PlayerKill")
	registerCreatureEvent(cid, "Pacccheck")  
	return TRUE
end

function onLogin(cid)
    if(InitHistory == 0) then
        local historyPage = addEvent(historyPage, 60000, {})
        InitHistory = historyPage
    end
    registerCreatureEvent(cid, "PlayerDeath")
    return TRUE
end

function historyPage(parameters)
    local historyPage = addEvent(historyPage, 60000, {})
    if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
        setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
        db.executeQuery("UPDATE `players` SET `onlinetime7`=players.onlinetime6, `onlinetime6`=players.onlinetime5, `onlinetime5`=players.onlinetime4, `onlinetime4`=players.onlinetime3, `onlinetime3`=players.onlinetime2, `onlinetime2`=players.onlinetime1, `onlinetime1`=players.onlinetimetoday, `onlinetimetoday`=0;")
        db.executeQuery("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
    end
    db.executeQuery("UPDATE `players` SET `onlinetimetoday`=players.onlinetimetoday+60, `onlinetimeall`=players.onlinetimeall+60 WHERE `online` = 1;")
end
onKill.lua
PHP:
function onKill(cid, target)
registerCreatureEvent(cid, "KillingInTheNameOf")  
return TRUE
end
Someone help me with this?

EDIT
Also You can add magic effect and "+ xxx EXP" at ending quest ;p
There is nothing wrong in your onkill.lua and login.lua!
Replace it into your npc file, i fixed one bug.
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 say(param)
            npcHandler:say(param.text,param.cid)
         end
    function delayedSay(text, delay, cid)
    if(not npcHandler:isFocused(cid)) then
                return FALSE
     else
         local param = {cid = cid, text = text}
            local delay = delay or 0
            local cid = cid or 0
            local nid = getNpcCid()
            addEvent(say, delay, param)


        end
    end

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 86669
local reward = 90000
local TALKDELAY_ONTHINK = 1
if msgcontains(msg, 'task') then
    delayedSay("The pirates on Nargor are becoming more and more of a threat to us each day. I wish someone could get rid of them once and for all, but unfortunately they just keep coming! ...", 100, cid) 
    delayedSay("Only a dead pirate is a good pirate. I think killing a large number of them would definitely help us to make Sabrehaven a safer place. ...", 12000, cid)
    delayedSay("It doesn't matter how long it takes, but... would you be willing to kill 1200 pirates for us?", 23000, cid)
    talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
    delayedSay("Come back here when you finish your mission.", 10, cid)
    
    elseif(getPlayerStorageValue(cid, quest) == 3) then --pirates
    delayedSay("Hey, great. You've done well! As a small reward I give you some coins from our treasure box. Also, let me tell you an interesting piece of information. ...", 100, cid)
    delayedSay("One our of spies told us about a secret hideout somewhere on Nargor. Supposedly, one of the four pirate leaders can be found there sometimes. If you dare go there, you might be able to face him or her in one on one combat. ...", 12000, cid)
    delayedSay("Beware though - prepare yourself well and only flee if you must. This might be your only chance to get into there, so be careful and don't die!", 23000, cid)
        doPlayerAddExp(cid, 300000)
        setPlayerStorageValue(cid, quest, 4)
        setPlayerStorageValue(cid, 696969, 1) ---questdoor storage---    
    
elseif(getPlayerStorageValue(cid, quest) == 4) or (getPlayerStorageValue(cid, 696969) == 2) then
    delayedSay("Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!", 100, cid)

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
    delayedSay("Perfect. I know it sounds like a lot, but really, take your time. You won't do it for nothing, I promise, {ok}?.", 100, cid)
    talkState[talkUser]= 3
    elseif msgcontains(msg, 'ok') and talkState[talkUser] == 3 then
    delayedSay("Okay, now go and kill pirates. And after that go back and report!", 100, cid)
    setPlayerStorageValue(cid, quest, 2)

end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Post here if don't work.
 
Oh, you couldn't put it in 1 NPC?

That's fine.
 
npc:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 say(param)
            npcHandler:say(param.text,param.cid)
         end
	function delayedSay(text, delay, cid)
	if(not npcHandler:isFocused(cid)) then
      	      return FALSE
	 else
         local param = {cid = cid, text = text}
			local delay = delay or 0
			local cid = cid or 0
			local nid = getNpcCid()
			addEvent(say, delay, param)


		end
	end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
	return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 26669
local reward = 91000
if msgcontains(msg, 'mission') then
	delayedSay("I am so angry I could spit grit! That damn Horned Fox and his attacks! Let's show those bull-heads that they have messed with the wrong people. ...", 100, cid) 
	delayedSay("I want you to kill 5000 minotaurs - no matter where - for me and all the dwarfs of Kazordoon! Are you willing to do that?", 12000, cid)
	talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
	delayedSay("Come back here when you finish your mission.", 100, cid)
	
	elseif(getPlayerStorageValue(cid, quest) == 3) then --pirates
	delayedSay("Hey, you done it! Take your reward!", 100, cid)
        doPlayerAddExp(cid, 300000)
        setPlayerStorageValue(cid, quest, 4)
        setPlayerStorageValue(cid, 797979, 1) ---questdoor storage---	
	
elseif(getPlayerStorageValue(cid, quest) == 4) or (getPlayerStorageValue(cid, 797979) == 2) then
	delayedSay("Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!", 100, cid)

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
	delayedSay("Hussah! Let's bring war to those hoof-legged, dirt-necked, bull-headed minotaurs!! Come back to me when you are done with your mission, {ok}?", 100, cid)
	talkState[talkUser]= 3
	elseif msgcontains(msg, 'ok') and talkState[talkUser] == 3 then
	delayedSay("Okay, now go and kill minotaurs. And after that go back and report!", 100, cid)
    setPlayerStorageValue(cid, quest, 2)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

script:
PHP:
local monsters = {
    --name = storage
    ["minotaur"] = 646564,
    ["minotaur archer"] = 646564,
    ["minotaur guard"] = 646564,
    ["minotaur mage"] = 646564
    }

function onKill(cid, target)
    if(isPlayer(target) ~= TRUE) then
        local name = getCreatureName(target)
        local monster = monsters[string.lower(name)]
        if(monster) then
            local killedMonsters = getPlayerStorageValue(cid, monster)
            if(killedMonsters == -1) then
                killedMonsters = 1
            end
            if(name == "minotaur" or name == "minotaur archer" or name == "minotaur guard" or name == "minotaur mage" and getPlayerStorageValue(cid, 26669) == 2 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 5000 minotaur's.")
                setPlayerStorageValue(cid, monster, killedMonsters + 1)
                if getPlayerStorageValue(cid, 646564)>=5000 then 
                    setPlayerStorageValue(cid, 26669, 3)
                    
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enought minotaur's.")
                end

        end
    end
    return TRUE
end
end

:D
 
Still does not work with this login.lua, but this works and it's not what i need :s
PHP:
function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		for i = PLAYERLOSS_EXPERIENCE, PLAYERLOSS_ITEMS do
			doPlayerSetLossPercent(cid, i, loss)
		end
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")
	registerCreatureEvent(cid, "PlayerDeath")
	registerCreatureEvent(cid, "KillingInTheNameOf") 
	return TRUE
end
 
Last edited:
npc:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 say(param)
            npcHandler:say(param.text,param.cid)
         end
	function delayedSay(text, delay, cid)
	if(not npcHandler:isFocused(cid)) then
      	      return FALSE
	 else
         local param = {cid = cid, text = text}
			local delay = delay or 0
			local cid = cid or 0
			local nid = getNpcCid()
			addEvent(say, delay, param)


		end
	end

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
	return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 26669
local reward = 91000
if msgcontains(msg, 'mission') then
	delayedSay("I am so angry I could spit grit! That damn Horned Fox and his attacks! Let's show those bull-heads that they have messed with the wrong people. ...", 100, cid) 
	delayedSay("I want you to kill 5000 minotaurs - no matter where - for me and all the dwarfs of Kazordoon! Are you willing to do that?", 12000, cid)
	talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
	delayedSay("Come back here when you finish your mission.", 100, cid)
	
	elseif(getPlayerStorageValue(cid, quest) == 3) then --pirates
	delayedSay("Hey, you done it! Take your reward!", 100, cid)
        doPlayerAddExp(cid, 300000)
        setPlayerStorageValue(cid, quest, 4)
        setPlayerStorageValue(cid, 797979, 1) ---questdoor storage---	
	
elseif(getPlayerStorageValue(cid, quest) == 4) or (getPlayerStorageValue(cid, 797979) == 2) then
	delayedSay("Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!", 100, cid)

elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
	delayedSay("Hussah! Let's bring war to those hoof-legged, dirt-necked, bull-headed minotaurs!! Come back to me when you are done with your mission, {ok}?", 100, cid)
	talkState[talkUser]= 3
	elseif msgcontains(msg, 'ok') and talkState[talkUser] == 3 then
	delayedSay("Okay, now go and kill minotaurs. And after that go back and report!", 100, cid)
    setPlayerStorageValue(cid, quest, 2)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

script:
PHP:
local monsters = {
    --name = storage
    ["minotaur"] = 646564,
    ["minotaur archer"] = 646564,
    ["minotaur guard"] = 646564,
    ["minotaur mage"] = 646564
    }

function onKill(cid, target)
    if(isPlayer(target) ~= TRUE) then
        local name = getCreatureName(target)
        local monster = monsters[string.lower(name)]
        if(monster) then
            local killedMonsters = getPlayerStorageValue(cid, monster)
            if(killedMonsters == -1) then
                killedMonsters = 1
            end
            if(name == "minotaur" or name == "minotaur archer" or name == "minotaur guard" or name == "minotaur mage" and getPlayerStorageValue(cid, 26669) == 2 then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 5000 minotaur's.")
                setPlayerStorageValue(cid, monster, killedMonsters + 1)
                if getPlayerStorageValue(cid, 646564)>=5000 then 
                    setPlayerStorageValue(cid, 26669, 3)
                    
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enought minotaur's.")
                end

        end
    end
    return TRUE
end
end

:D

I meant pirates and minotaurs in the same NPC, but if not, that's not a problem.
 
Ahh, im sorry :p

NPC:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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)
	if(not npcHandler:isFocused(cid)) then
	return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local quest = 65465
local reward = 80000
if msgcontains(msg, 'quest') then
	selfSay("Ok, you have to kill some monsters. Do you preffer killing {minotaurs} or {dragons}?", cid)
	talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
	selfSay("You have some more dragons to kill.", cid)
elseif(getPlayerStorageValue(cid, quest) == 3) then
	selfSay("You have some more minotaurs to kill.", cid)
	
	
	elseif(getPlayerStorageValue(cid, quest) == 4) then --dragon
	selfSay("Wow, you did it! Take your reward", cid)
	-- here do anything you want , just give some money or sth as reward
	container = doPlayerAddItem(cid, 1987, 1)

	doPlayerAddExp(cid, 250000)
setPlayerStorageValue(cid, quest, 8)
	
elseif(getPlayerStorageValue(cid, quest) == 5) then --mino
	selfSay("Wow, you did it! Take your reward", cid)
	-- here do anything you want , just give some money or sth as reward

	doPlayerAddExp(cid, 250000)
setPlayerStorageValue(cid, quest, 10)
	
	
elseif(getPlayerStorageValue(cid, quest) == 8) then
	selfSay("You have already done my quest.", cid)
elseif(getPlayerStorageValue(cid, quest) == 10) then
	selfSay("You have already done my quest.", cid)
elseif msgcontains(msg, 'dragons') and talkState[talkUser] == 2 then
	selfSay("So you wanna kill 1000 dragons yeah?", cid)
	talkState[talkUser]= 3
elseif msgcontains(msg, 'minotaurs') then
	selfSay("So you wanna kill 1000 minotaurs yeah?", cid)
	talkState[talkUser]= 4
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
	selfSay("Ok, now go and kill dragons. And after that go back and report!", cid)
	setPlayerStorageValue(cid, quest, 2)
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
	selfSay("Ok, now go and kill minotaurs. And after that go back and report!", cid)
	setPlayerStorageValue(cid, quest, 3)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

script:
PHP:
local monsters = {
	--name = storage
	["minotaur"] = 25004,
	["minotaur guard"] = 25004,
	["minotaur mage"] = 25004,
	["minotaur archer"] = 25004,
	["dragon"] = 25005,
	["dragon lord"] = 25005,
	["frost dragon"] = 25005
	}

function onKill(cid, target)
	if(isPlayer(target) ~= TRUE) then
		local name = getCreatureName(target)
		local monster = monsters[string.lower(name)]
		if(monster) then
			local killedMonsters = getPlayerStorageValue(cid, monster)
			if(killedMonsters == -1) then
				killedMonsters = 1
			end
			if((name == "dragon" or name == "dragon lord" or name == "frost dragon") and getPlayerStorageValue(cid, 65465) == 2) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 1000 dragon's.")
				setPlayerStorageValue(cid, monster, killedMonsters + 1)
				if getPlayerStorageValue(cid, 25005)>=1000 then 
					setPlayerStorageValue(cid, 65465, 4)
					
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enought dragon's.")
				end
			elseif((name == "minotaur" or name == "minotaur guard" or name == "minotaur mage" or name == "minotaur archer") and getPlayerStorageValue(cid, 65465) == 3) then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 1000 minotaur's.")
				setPlayerStorageValue(cid, monster, killedMonsters + 1)
				if getPlayerStorageValue(cid, 25004)>=1000 then 
					setPlayerStorageValue(cid, 65465, 5)
					
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enought minotaur's.")
				end
			end			
		end
	end
	return TRUE
end
Scripts by Slawkens ;)
 
I have a really, really odd bug.

Check it out:

14:42 GM Iceman Il [30]: hi
14:42 Grizzly Adams: Hello GM Iceman Il! Do you want to do a task?
14:42 GM Iceman Il [30]: task
14:42 Grizzly Adams: It doesn't matter how long it takes, but... would you be willing to kill 200 pirates for us?
14:42 GM Iceman Il [30]: yes
14:42 Eryn: Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!

Do you see it? How does my rune seller NPC, Eryn, get involved?
 
Another problem:

After you complete the mission and ask for another mission, it wouldn't let me:

15:29 GM Iceman Il [30]: task
15:30 Grizzly Adams: It doesn't matter how long it takes, but... would you be willing to kill 200 pirates for us?
15:30 GM Iceman Il [30]: yes
15:30 Grizzly Adams: Hm... you already helped me a lot, do not need more of you here, thanks! You expect more missions!
 
I have a really, really odd bug.

Check it out:

Do you see it? How does my rune seller NPC, Eryn, get involved?

I do not know how the NPC Eryn interfere ...

Another problem:

After you complete the mission and ask for another mission, it wouldn't let me:

Yes, you can do only one task, to do both, you must change the storagevalues.
 
Very nice script! :D Gonna test it
Btw will this work with 0.3.5pl1?
 
Last edited:
I've tested in crying damson and it works, but i don't have time to update the script now ;p
 
Back
Top