• 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 [CreatureEvent/Npc] Killing in the name of... [Now player can choose the task]

Not working on 0.4 :\
It doesn't count any killed monsters
(even changing doCreatureSetStorage to doPlayerSetStorageValue as Oskar1121 said)
 
i dont get error but, dont appear how many killed i did... i kill and nothing.. ;x how to do?

Cuz you are donator, i suppose that you're using TFS 0.4 si i can't help you because i didn't tested the script on that distro

In that case that you're using TFS < 4.0 then be sure that you did everything well.
 
i fixed that bug, but i have another.

Ok i sayd, tasks 1 2 and 3.. yes Ok.. i started these tasks

But eg my progess:

150/150 carniphi
2/2000 minotaur
etc...

i say to NPC.. Report... ( tofinish carniphila)
23:04 Bruno [500]: report
23:04 Grizzly Adams: Current 4 Minotaurs killed, you need to kill 2000.
23:04 Bruno [500]: report 1
23:04 Grizzly Adams: Current 4 Minotaurs killed, you need to kill 2000.
23:04 Bruno [500]: report carniphila
23:04 Grizzly Adams: Current 4 Minotaurs killed, you need to kill 2000.
23:04 Bruno [500]: 1 report
23:04 Grizzly Adams: Current 4 Minotaurs killed, you need to kill 2000.
 
i fixed that bug, but i have another.

Ok i sayd, tasks 1 2 and 3.. yes Ok.. i started these tasks

But eg my progess:

150/150 carniphi
2/2000 minotaur
etc...

i say to NPC.. Report... ( tofinish carniphila)

After:
Lua:
		if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
			selfSay("You need level " .. tasks[msg].level .. " or higher to make this task.", cid)
			talkState[talkUser] = 0
			return true
		end

Add this
Lua:
		for k, v in pairs(tasks) do
			if getCreatureStorage(cid, v.questStarted) == 1 and tasks[msg] ~= k then
				selfSay("You are already making a task.", cid)
				talkState[talkUser] = 0
				return true
			end
		end

And you won't be able to stark 2 or more tasks at same time.

PD: Script updated
 
i did the task, talked with npc, he said i have completed the task.. but i didnt get any reward... look at task exemple


[1] = {questStarted = 1510, questStorage = 65000, killsRequired = 150, raceName = "Carniphilas", rewards = {first = {enable = true, type = "exp", values = 50000}, second = {enable = true, type = "money", values = 100000}, third = {enable = true, type = "storage", values = {16693, 1}}}},


i didnt get money/exp
 
I use TFS 0.4 and when I kill the monsters not appear to count how many monsters are missing and when I say I'm gonna report 0 monsters being killed, I killed about 20.
 
Above
["Demon"] = {questStarted = 1516, questStorage = 65006, creatureStorage = 15015, killsRequired = 6666, raceName = "Demons"}
}

Clear all and put this
local msgType = MESSAGE_STATUS_CONSOLE_ORANGE

function onKill(cid, target, lastHit)

local creature = questCreatures[getCreatureName(target)]

if creature then
if(isPlayer(target) == true) then
return true
end

if getPlayerStorageValue(cid, creature.questStarted) > 0 then
if getPlayerStorageValue(cid, creature.questStorage) < creature.killsRequired then
if getPlayerStorageValue(cid, creature.questStorage) < 0 then
doPlayerSetStorageValue(cid, creature.questStorage, 0)
end

if getPlayerStorageValue(cid, creature.creatureStorage) < 0 then
doPlayerSetStorageValue(cid, creature.creatureStorage, 0)
end
doPlayerSetStorageValue(cid, creature.questStorage, getPlayerStorageValue(cid, creature.questStorage) + 1)
doPlayerSetStorageValue(cid, creature.creatureStorage, getPlayerStorageValue(cid, creature.creatureStorage) + 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "" .. getPlayerStorageValue(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getPlayerStorageValue(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
end
end
end
return true
end

and above this
local rankStorage = 32150
local choose = {}

clear all and put this
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
if msgcontains(msg, "task") then
selfSay("There you can see the following tasks, please tell me the number of the task that you want to do.", cid)
local text = "Number - Name"
for i = 1, table.maxn(tasks) do
text = text .. "\n" .. i .. " - " .. tasks.raceName .. (getCreatureStorage(cid, tasks.questStarted) == 2 and " [Done]" or "")
end
doShowTextDialog(cid, 5956, text)

elseif tasks[tonumber(msg)] then
msg = tonumber(msg)
local can = true
if getCreatureStorage(cid, tasks[msg].questStarted) == 1 then
selfSay("You are already making this task.", cid)
talkState[talkUser] = 0
can = false
end
if getCreatureStorage(cid, tasks[msg].questStarted) == 2 then
selfSay("You already finished this task.", cid)
talkState[talkUser] = 0
can = false
end
if tasks[msg].level and getPlayerLevel(cid) < tasks[msg].level then
selfSay("You need level " .. tasks[msg].level .. " or higher to make this task.", cid)
talkState[talkUser] = 0
end
for k, v in pairs(tasks) do
if getCreatureStorage(cid, v.questStarted) == 1 and tasks[msg] ~= k then
selfSay("You are already making a task.", cid)
talkState[talkUser] = 0
return true
end
end
if can then
selfSay("Are you sure that do you want to start the task number " .. msg .. "?. In this task you will need to defeat " .. tasks[msg].killsRequired .. " " .. tasks[msg].raceName .. ".", cid)
choose[cid] = msg
talkState[talkUser] = 1
end
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
doCreatureSetStorage(cid, tasks[choose[cid]].questStarted, 1)
selfSay("You have started the task number " .. choose[cid] .. ", remember... in this task you will need to defeat " .. tasks[choose[cid]].killsRequired .. " " .. tasks[choose[cid]].raceName .. ". Good luck!", cid)
talkState[talkUser] = 0

elseif msgcontains(msg, "report") then
for k, v in pairs(tasks) do
if getCreatureStorage(cid, v.questStarted) == 1 then
if getCreatureStorage(cid, v.questStorage) >= v.killsRequired then
for i = 1, table.maxn(v.rewards) do
if(v.rewards.enable) then
if isInArray({"boss", "teleport", 1}, v.rewards.type) then
doTeleportThing(cid, v.rewards.values)
elseif isInArray({"exp", "experience", 2}, v.rewards.type) then
doPlayerAddExperience(cid, v.rewards.values)
elseif isInArray({"item", 3}, v.rewards.type) then
doPlayerAddItem(cid, v.rewards.values[1], v.rewards.values[2])
elseif isInArray({"money", 4}, v.rewards.type) then
doPlayerAddMoney(cid, v.rewards.values)
elseif isInArray({"storage", "stor", 5}, v.rewards.type) then
doCreatureSetStorage(cid, v.rewards.values[1], v.rewards.values[2])
elseif isInArray({"points", "rank", 2}, v.rewards.type) then
doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + v.rewards.values)
else
print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. v.rewards.type .. ", reward could not be loaded.")
end
end
end
local rank = getCreatureStorage(cid, rankStorage)
selfSay("Great!... you have finished the task number " .. k .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid)
doCreatureSetStorage(cid, v.questStarted, 2)
break
else
if getCreatureStorage(cid, v.questStorage) < 0 then
doCreatureSetStorage(cid, v.questStorage, 0)
end
selfSay("Current " .. getCreatureStorage(cid, v.questStorage) .. " " .. v.raceName .. " killed, you need to kill " .. v.killsRequired .. ".", cid)
break
end
end
end
end
return true
end

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


shoould work to 0.4

repp me
 
I'll test and edit this post, but just a tip braykan, do not "Quote" lua codes, just use the right parameter to send codes, [*lua] [*/lua] (without the *).
Example:

instead of:
[*quote] ... [*/quote]
getTestlBlABLABLBALablbal...
getPlayerStorageValue(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
end
end
end
return true
end


use:
[*lua]...[*/lua]
Lua:
getTestlBlABLABLBALablbal...
getPlayerStorageValue(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
end
end
end
return true
end
 
braykan
i didn't find
["Demon"] = {questStarted = 1516, questStorage = 65006, creatureStorage = 15015, killsRequired = 6666, raceName = "Demons"}
}
in darkhaos script, could you post your script (or just repost in lua parameters, it maybe work)?
it's still not working for 0.4 here.

18:52 GOD Dreamy [420]: report
18:52 Grizzly Adams: Current 0 Trolls killed, you need to kill 100.
 
Back
Top