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

[REQUEST] "Killing in the name of..." quest

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,019
Solutions
1
Reaction score
1,029
Location
United States
I'm looking for a quest that is similar to the "Killing in the name of..." quest. It's a quest where you get missions where you have to kill a certain number of monsters to get prizes.

For example:
-You talk to the NPC and he gives you a mission to kill 400 rats.
-Then the quest would appear in the quest log saying "You have killed 0/400 rats." Then every rat you kill, that count goes up by one, so if you killed 57 rats after you were given the mission, it would show "You have killed 57/400 rats.".
-Then after you kill 400 rats, you will go back to the NPC and he will give you a prize.
-Then you ask him for another mission and this time its a different monster or different kill count, so on so forth.

Here's the real Tibia version of it: Killing in the Name of... Quest/Spoiler - TibiaWiki - Quests, Items, Spells, and more

If anyone makes this, you will be flooded with rep++ since a lot of people are looking for this. Don't tell me to use Ispiro's script, it doesn't work and it doesn't even show in the quest log.

Thanks,
Lostboy
 
josejunior23, did you even read my post at all?
You are definitely not getting any rep+
 
Eddited monsters counter made by Slawkens yeah?
here is the link to original
http://otland.net/f82/killed-monsters-counter-27195/


put this in creaturescripts as kill script
Code:
local monsters = {
	--name = storage
	["elf"] = 35001,
	["elf scout"] = 35001,
	["elf arcanist"] = 35001,
	["dwarf"] = 35002,
	["dwarf soldier"] = 35002,
	["dwarf guard"] = 35002,
	}

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 == "dwarf" or name == "dwarf soldier" or name == "dwarf guard") and getPlayerStorageValue(cid, 66669) == 2) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " of 100 dwarf's.")
				setPlayerStorageValue(cid, monster, killedMonsters + 1)
				if getPlayerStorageValue(cid, 35002)>=100 then 
					setPlayerStorageValue(cid, 66669, 4)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed enought dwarf's.")
				end
			elseif((name == "elf" or name == "elf scout" or name == "elf arcanist") and getPlayerStorageValue(cid, 66669) == 3) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " of 100 elves.")
				setPlayerStorageValue(cid, monster, killedMonsters + 1)
				if getPlayerStorageValue(cid, 35001)>=100 then 
					setPlayerStorageValue(cid, 66669, 4)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed enought elves's.")
				end
			end			
		end
	end
	return TRUE
end


npc lua code
Code:
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 = 66669
	if msgcontains(msg, 'quest') then
		selfSay("Ok, you have to kill some monsters. Do you preffer killing dwarfs or elves?", cid)
		talkState[talkUser] = 2
	elseif(getPlayerStorageValue(cid, quest) == 2) then
		selfSay("You have some more dwarfs to kill", cid)
	elseif(getPlayerStorageValue(cid, quest) == 3) then
		selfSay("You have some more elves to kill", cid)
	elseif(getPlayerStorageValue(cid, 66669) == 4) then
		selfSay("You did it ; o.", cid)
		-- here do anything you want , just give some money or sth as reward
	elseif(getPlayerStorageValue(cid, 66669) == 5) then
		selfSay("You have already done my quest.", cid)
	elseif msgcontains(msg, 'dwarfs') and talkState[talkUser] == 2 then
		selfSay("So you wanna kill 100 dwarfs yeah?", cid)
		talkState[talkUser]= 3
	elseif msgcontains(msg, 'elves') then
		selfSay("So you wanna kill 100 elves yeah?", cid)
		talkState[talkUser]= 4
	elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
		selfSay("Ok, now go and kill dwarfs. And after that go back and report!", cid)
		setPlayerStorageValue(cid, 66669, 2)
	elseif msgcontains(msg, 'yes') and talkState[talkUser] == 4 then
		selfSay("Ok, now go and kill elves. And after that go back and report!", cid)
		setPlayerStorageValue(cid, 66669, 3)
	end

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

I edited my script, it was working but not tested edited version.

If it helped you first rep+ slawkens, I only edited his great script, and I did cuz I needed to do it.

And of course you can change or add monsters, change numbers to kill and used storage values.
It is just easy example.
 
Last edited:
I will test this, and if it works, I will rep+ him and definitely rep+ you for the edits and NPCs.
 
There's an error with the NPC.

data/npc/lib/npc.lua:8: attempt to index local 'message' (a nil value)
[Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/poachquest.lua
 
I'll check this, maybe I deleted too much from my npc. And I know it coul'd be shorten, but last time I tried to shorten script I had to rewrite it from begining. It is working so I'm happy xd edit: I am sure this part was working, and I havnt modified it. (maybe I missed sth when i was copyng, ill check this when ill be in home) maybe check ur npcsystem or sth, I have fixed jiddo(or sth like that). Anyway it should work.....


ok, i missed one edn, but it shouldn't make THIS error.
anyway here is fixed npc
Code:
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 = 66669
if msgcontains(msg, 'quest') then
	selfSay("Ok, you have to kill some monsters. Do you preffer killing dwarfs or elves?", cid)
	talkState[talkUser] = 2
elseif(getPlayerStorageValue(cid, quest) == 2) then
	selfSay("You have some more dwarfs to kill", cid)
elseif(getPlayerStorageValue(cid, quest) == 3) then
	selfSay("You have some more elves to kill", cid)
elseif(getPlayerStorageValue(cid, quest) == 4) then
	selfSay("You did it ; o.", cid)
	-- here do anything you want , just give some money or sth as reward
elseif(getPlayerStorageValue(cid, quest) == 5) then
	selfSay("You have already done my quest.", cid)
elseif msgcontains(msg, 'dwarfs') and talkState[talkUser] == 2 then
	selfSay("So you wanna kill 100 dwarfs yeah?", cid)
	talkState[talkUser]= 3
elseif msgcontains(msg, 'elves') then
	selfSay("So you wanna kill 100 elves yeah?", cid)
	talkState[talkUser]= 4
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
	selfSay("Ok, now go and kill dwarfs. 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 elves. And after that go back and report!", cid)
	setPlayerStorageValue(cid, quest, 3)
end
end

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

tested and works(tfs 0.3.4pl2 with fixed jiddo system)
 
Last edited:
I don't know what is going on, but I added that script and the NPC worked fine at the beginning, but when I chose to kill 100 dwarves, it tells me to go kill them but I killed about 300 or so and it still tells me that I have more to kill. Also, would it be too hard for you to make this in quest log or have a green message show up every 10th kill like in Slawkens script? People would lose count and stuff.
 
I think I can make it, but I need some time.
And about problem with dwarfs... This creaturescript(counter) is working?
Every killed dwarf should show orange text in console.
I'll check this too. Actually I tested only elves ;p

Edit
Script looks good, dwarfs work too, maybe you have monster names started with capital letter, slawkens put lowcase in it, but names have to be EXACT the same in both monster file and counter

And to show on green every 10 killed add
Code:
					if(killed % 10 == 0) then
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You killed " .. killedMonsters .. " of NEEDTOKILL MONSTERNAME.")
					end
under
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " of 100 dwarf's.")

for each monster group(hope you know what I mean)
Later Ill post it with screens showing how it should look


@down I tested it MAINLY with god, and it works for me
 
Last edited:
I guess it does work, just GM's can't do the quest for some reason.

10:25 You killed 1 of 100 dwarf's.

edit: you get rep++
 
Oh, I broken sth in counter... again monsters are not dying
aff

Ok, dont add this

Code:
					if(killed % 10 == 0) then
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You killed " .. killedMonsters .. " of NEEDTOKILL MONSTERNAME.")
					end
but it should be sth like that...
Now I havent much time to find how to make it, but its good idea to add this, and green comunicate that you killed enought instead of console one
 
Oh, I broken sth in counter... again monsters are not dying
aff

Ok, dont add this

Code:
					if(killed % 10 == 0) then
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You killed " .. killedMonsters .. " of NEEDTOKILL MONSTERNAME.")
					end
but it should be sth like that...
Now I havent much time to find how to make it, but its good idea to add this, and green comunicate that you killed enought instead of console one

Thank you very much! It works all 100%, my GM can do the quest too :) I already gave you rep++, won't let me give you another lol
 
I'm using TFS 0.3.2.

The NPC works great, but when I killed one monsters for example morgaroth.
Killed 1 of 1 Morgaroth, but I tried to turn in quests but it didnt work.

I tought it could be a problem with
if getPlayerStorageValue(cid, 35001)>=1 then
setPlayerStorageValue(cid, 66669, 4)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed morgaroth for once.")

This text never appears!
You killed morgaroth for once.

Like this I've put files.

onkill.lua
Code:
local monsters = {
	["morgaroth"] = 35001,
	}

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 == "morgaroth") and getPlayerStorageValue(cid, 66669) == 3) then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed " .. killedMonsters .. " of 1 morgaroth.")
				setPlayerStorageValue(cid, monster, killedMonsters + 1)
				if getPlayerStorageValue(cid, 35001)>=1 then 
					setPlayerStorageValue(cid, 66669, 4)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You killed morgaroth for once.")
				end		
		end
		end
	end
	return TRUE
end

creaturescripts.xml
Code:
	<event type="kill" name="KilledMonstersCounter" event="script" value="onkill.lua"/>

login.lua
registerCreatureEvent(cid, "KilledMonstersCounter")
 
Back
Top