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

Task problem,dont showoff list

clario

OTS based on Heroes III Might and Magic
Joined
Feb 4, 2018
Messages
98
Reaction score
5
So the problem is that , the npc dont show list (it can be just written by he)
gd1Ke7w.gif

QID2C6D.png

Script:
NPC LUA.
local tasks =
{
[1] = {questStarted = 1500, questStorage = 65000, killsRequired = 1, raceName = "Pikeman", rewards = {{enable = true, type = "exp", values = 200}, {enable = true, type = "money", values = 200}}},

[10] = {questStarted = 1509, questStorage = 65009, killsRequired = 150, raceName = "Halberdier", rewards = {{enable = true, type = "exp", values = 300}, {enable = true, type = "money", values = 250}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},


[19] = {questStarted = 1518, questStorage = 65018, killsRequired = 300, raceName = "Archer", rewards = {{enable = true, type = "exp", values = 1000}, {enable = true, type = "money", values = 400}}},

[28] = {questStarted = 1527, questStorage = 65027, killsRequired = 500, raceName = "Marksman", rewards = {{enable = true, type = "exp", values = 3000}, {enable = true, type = "money", values = 800}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},

[37] = {questStarted = 1536, questStorage = 65036, killsRequired = 300, raceName = "Griffin", rewards = {{enable = true, type = "exp", values = 800}, {enable = true, type = "points", values = 2}}},

[46] = {questStarted = 1545, questStorage = 65045, killsRequired = 300, raceName = "Royal Griffin", rewards = {{enable = true, type = "money", values = 1500}, {enable = true, type = "points", values = 2}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},


[55] = {questStarted = 1554, questStorage = 65054, killsRequired = 150, raceName = "Swordsman", rewards = {{enable = true, type = "exp", values = 1500}, {enable = true, type = "points", values = 1}}},


[64] = {questStarted = 1563, questStorage = 65063, killsRequired = 200, raceName = "Crusader", rewards = {{enable = true, type = "exp", values = 2000}, {enable = true, type = "points", values = 1}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},

[73] = {questStarted = 1572, questStorage = 65072, killsRequired = 300, raceName = "Monk", rewards = {{enable = true, type = "exp", values = 4000}, {enable = true, type = "points", values = 2}}},

[82] = {questStarted = 1581, questStorage = 65081, killsRequired = 300, raceName = "Zealot", rewards = {{enable = true, type = "exp", values = 15000}, {enable = true, type = "points", values = 2}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},


[91] = {questStarted = 1590, questStorage = 65090, killsRequired = 300, raceName = "Cavalier", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}}},


[100] = {questStarted = 1599, questStorage = 65099, killsRequired = 300, raceName = "Champion", rewards = {{enable = true, type = "exp", values = 12000}, {enable = true, type = "points", values = 2}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}},


[109] = {questStarted = 1608, questStorage = 65108, killsRequired = 70, raceName = "Angel", rewards = {{enable = true, type = "exp", values = 7000}, {enable = true, type = "points", values = 1}}},


[119] = {questStarted = 1617, questStorage = 65117, killsRequired = 70, raceName = "Archangel", rewards = {{enable = true, type = "exp", values = 10000}, {enable = true, type = "points", values = 1}, {enable = true, type = "boss", values = RANDOMPIRATEBOSS_POSITION}}}

}



local rankStorage = 32150
local choose = {}

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, 17868, text)

elseif tasks[tonumber(msg)] then
msg = tonumber(msg)
if getCreatureStorage(cid, tasks[msg].questStarted) == 1 then
selfSay("You are already making this task.", cid)
talkState[talkUser] = 0
return true
end
if getCreatureStorage(cid, tasks[msg].questStarted) == 2 then
selfSay("You already finished this task.", cid)
talkState[talkUser] = 0
return true
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
return true
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
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
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())

Creaturescripts lua.;
local questCreatures =
{
["Pikeman"] = {questStarted = 1500, questStorage = 65000, creatureStorage = 15000, killsRequired = 1, raceName = "Pikeman"},
["Halberdier"] = {questStarted = 1509, questStorage = 65009, creatureStorage = 15001, killsRequired = 100, raceName = "Halberdier"},
["Archer"] = {questStarted = 1518, questStorage = 65018, creatureStorage = 15002, killsRequired = 100, raceName = "Archer"},
["Marksman"] = {questStarted = 1527, questStorage = 65027, creatureStorage = 15003, killsRequired = 100, raceName = "Marksman"},
["Griffin"] = {questStarted = 1536, questStorage = 65036, creatureStorage = 15004, killsRequired = 100, raceName = "Griffin"},
["Royal Griffin"] = {questStarted = 1545, questStorage = 65045, creatureStorage = 15005, killsRequired = 100, raceName = "Royal Griffin"},
["Swordsman"] = {questStarted = 1554, questStorage = 65054, creatureStorage = 15006, killsRequired = 100, raceName = "Swordsman"},
["Crusader"] = {questStarted = 1563, questStorage = 65063, creatureStorage = 15007, killsRequired = 150, raceName = "Crusader"},
["Monk"] = {questStarted = 1572, questStorage = 65072, creatureStorage = 15008, killsRequired = 150, raceName = "Monk"},
["Zealot"] = {questStarted = 1581, questStorage = 65081, creatureStorage = 15009, killsRequired = 150, raceName = "Zealot"},
["Cavalier"] = {questStarted = 1590, questStorage = 65090, creatureStorage = 15010, killsRequired = 150, raceName = "Cavalier"},
["Champion"] = {questStarted = 1599, questStorage = 65099, creatureStorage = 15011, killsRequired = 300, raceName = "Champion"},
["Angel"] = {questStarted = 1608, questStorage = 65108, creatureStorage = 15012, killsRequired = 300, raceName = "Angel"},
["Archangel"] = {questStarted = 1617, questStorage = 65117, creatureStorage = 15013, killsRequired = 500, raceName = "Archangel"}

}

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

how can i fix it ?
 
Back
Top