Hello i have problem with Task System
If we take the task and kill the monster, it pops up in the console.
The monster does not die, but has 0 hp
Lua:
[5/12/2020 19:9:20] [Error - CreatureScript Interface]
[5/12/2020 19:9:20] data/creaturescripts/scripts/killinginthenameof3.lua:onKill
[5/12/2020 19:9:20] Description:
[5/12/2020 19:9:20] data/creaturescripts/scripts/killinginthenameof3.lua:36: attempt to compare string with number
[5/12/2020 19:9:20] stack traceback:
[5/12/2020 19:9:20] data/creaturescripts/scripts/killinginthenameof3.lua:36: in function <data/creaturescripts/scripts/killinginthenameof3.lua:23>
If we take the task and kill the monster, it pops up in the console.
The monster does not die, but has 0 hp
Code:
local questCreatures =
{
["demonic dragon"] = {questStarted = 1560, questStorage = 65050, creatureStorage = 15063, killsRequired = 1500, raceName = "Demonic Dragon"},
["minishabaal"] = {questStarted = 1561, questStorage = 65051, creatureStorage = 15064, killsRequired = 1500, raceName = "Minishabaal"},
["sea king"] = {questStarted = 1562, questStorage = 65052, creatureStorage = 15065, killsRequired = 1500, raceName = "Sea King"},
["ghastly dragon"] = {questStarted = 1563, questStorage = 65053, creatureStorage = 15066, killsRequired = 1500, raceName = "Ghastly Dragon"},
["azerus"] = {questStarted = 1564, questStorage = 65054, creatureStorage = 15067, killsRequired = 1500, raceName = "Azerus"},
["ots king"] = {questStarted = 1565, questStorage = 65055, creatureStorage = 15068, killsRequired = 1500, raceName = "OTS King"},
["evil demon"] = {questStarted = 1566, questStorage = 65056, creatureStorage = 15069, killsRequired = 1500, raceName = "Evil Demon"},
["sashami"] = {questStarted = 1567, questStorage = 65057, creatureStorage = 15070, killsRequired = 1500, raceName = "Sashami"}
}
local msgType = MESSAGE_STATUS_CONSOLE_ORANGE
function onKill(cid, target, lastHit)
local creature = questCreatures[getCreatureName(target):lower()]
if creature then
if isPlayer(target) or isSummon(target) then return true end
if getCreatureStorage(cid, creature.questStarted) > 0 then
if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then
if getCreatureStorage(cid, creature.questStorage) < 0 then
doCreatureSetStorage(cid, creature.questStorage, 0)
end
if getCreatureStorage(cid, creature.creatureStorage) < 0 then
doCreatureSetStorage(cid, creature.creatureStorage, 0)
end
doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1)
doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1)
doPlayerSendTextMessage(cid, msgType, getCreatureStorage(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getCreatureStorage(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".")
end
end
end
return true
end
Last edited: