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

Npc quest

kamilcioo

Veteran OT User
Joined
Jul 25, 2008
Messages
979
Solutions
1
Reaction score
291
Can someone reapir it?

Help. REP++ for every try.

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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 addExp(cid, amount)
doPlayerAddExp(cid, amount)
doSendAnimatedText(getThingPos(cid), amount, 215)
end

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end

local v = getPlayerStorageValue(cid, 15000)
if msgcontains(msg, 'mission') or (v >= 0 and msgcontains(msg, 'broken sword')) then
if v < 0 then
selfSay('Please bring me 10 {broken sword}.', cid)
setPlayerStorageValue(cid, 15000, 0)
elseif v == 0 then
if doPlayerRemoveItem(cid, 2350, 1) then
setPlayerStorageValue(cid, 15000, 1)
addExp(cid, 1000)
doPlayerAddItem(cid, 2383, 1)
selfSay('Thank you! Please take this sword for your help. <you received 1000 points of experience>', cid)
else
selfSay('You don\'t have it.', cid)
end
elseif msgcontains(msg, 'quest') or msgcontains(msg, 'mission') then
if v == -1 then
selfSay('You can start the {mission}.', cid)
elseif v == 0 then
selfSay('Your current mission is to give me {broken sword}.', cid)
elseif v == 1 then
selfSay('You have finished all missions.', cid)
end
end
return true
end

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



luaDoCreateNpc(). Npc name(Edek) not found
[Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/edek.lua
data/npc/scripts/edek.lua:48: 'end' expected (to close 'function' at line 15) near '<eof>'
 
Last edited:
Missing an end.
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end

function addExp(cid, amount)
doPlayerAddExp(cid, amount)
doSendAnimatedText(getThingPos(cid), amount, 215)
end

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end

local v = getPlayerStorageValue(cid, 15000)
if msgcontains(msg, 'mission') or (v >= 0 and msgcontains(msg, 'broken sword')) then
if v < 0 then
selfSay('Please bring me 10 {broken sword}.', cid)
setPlayerStorageValue(cid, 15000, 0)
elseif v == 0 then
if doPlayerRemoveItem(cid, 2350, 1) then
setPlayerStorageValue(cid, 15000, 1)
addExp(cid, 1000)
doPlayerAddItem(cid, 2383, 1)
selfSay('Thank you! Please take this sword for your help. <you received 1000 points of experience>', cid)
else
selfSay('You don\'t have it.', cid)
end
elseif msgcontains(msg, 'quest') or msgcontains(msg, 'mission') then
if v == -1 then
selfSay('You can start the {mission}.', cid)
elseif v == 0 then
selfSay('Your current mission is to give me {broken sword}.', cid)
elseif v == 1 then
selfSay('You have finished all missions.', cid)
end
end
end
return true
end
 
Back
Top