Lua [NPC][TFS 1.2] Function Error (HELP!)

gui56

New Member
Joined
Feb 4, 2009
Messages
19
Reaction score
0
Hey there,

Recently I updated my TFS version from 1.0 to 1.2 and I'm having some troubles updating my Task System, can anyone help?

CONSOLE ERROR:



NPC/SCRIPTS/TASK.LUA:

Code:
local choose = {}

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_PRIVATE and 0 or cid
if isInArray({"task", "tasks"}, msg:lower()) then
selfSay("Here.", cid)
taskNPCuid = getNpcCid()
if player:getStorageValue(cid, 32150) < 0 then player:setStorageValue(cid, 32150, 0) end
return taskWindow:sendToPlayer(cid)
end
return true
end

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

Sir Islam

Never Give Up
Joined
Jun 6, 2008
Messages
504
Reaction score
118
Location
Suez , Egypt
Code:
local choose = {}

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_PRIVATE and 0 or cid
if isInArray({"task", "tasks"}, msg:lower()) then
selfSay("Here.", cid)
taskNPCuid = getNpcCid()
if Player(cid):getStorageValue(32150) < 0 then Player(cid):setStorageValue(32150, 0) end
return taskWindow:sendToPlayer(cid)
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
OP
G

gui56

New Member
Joined
Feb 4, 2009
Messages
19
Reaction score
0
Got this solved with this one :), thanks:

Code:
local choose = {}
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)
    local player = Player(cid)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
    local taskWindow = ModalWindow(1900, "Mission Management", "Select a task:")
    if isInArray({"task", "tasks"}, msg:lower()) then
        selfSay("Here.", cid)
        taskNPCuid = getNpcCid()
        if player:getStorageValue(32150) < 0 then player:setStorageValue(32150, 0) end
        return taskWindow:sendToPlayer(cid)
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Top