Hammel
Mapper
- Joined
- Dec 14, 2009
- Messages
- 37
- Reaction score
- 0
Hey, someone can help me with this scripit?
It doesn't work, what's the erro? Please someone can fix it?
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if (not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'mission') then
npcHandler:say('Go kill {6666 demons} with Grizzly Adams and come back to me after that', cid)
talk_state = 1
end
elseif msgcontains(msg, 'mission') and talk_state == 2 then
npcHandler:say('Did you kill the demons?', cid)
talk_state = 0
elseif msgcontains(msg, '') and talk_state == 2 then
npcHandler:say('Did you kill the demons?', cid)
talk_state = 0
elseif msgcontains(msg, 'yes') and talk_state == 3 then
if getPlayerStorageValue(cid, 65535) == 1 then
npcHandler:say('Excelent! Now talk about hallowed axe', cid)
doPlayerSetStorageValue(cid, 65536,1)
talk_state = 0
end
else
npcHandler:say('Go defeat the demons first.', cid)
talk_state = 0
end
if msgcontains(msg, 'hallowed axe') then
npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 1 then
local price = 1000
if getPlayerItemCount(cid, 2386) >= 1 and getPlayerMoney(cid) >= price then
if getPlayerStorageValue(cid, 65536) == 1 then
if doPlayerRemoveMoney(cid, price) == true then
npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
doPlayerRemoveItem(cid, 2386, 1)
doPlayerAddItem(cid, 8293, 1)
talk_state = 0
end
else
npcHandler:say('I need an axe and ' .. price .. ' gold coins to make you a {hallowed axe}.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
npcHandler:say('Did you defeat the demon oak?', cid)
talk_state = 3
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerStorageValue(cid, 35700) == 1 then
npcHandler:say('Good job! Go now to the gravestone south of Demon Oak, you might find something useful there!', cid)
doPlayerSetStorageValue(cid, 35700, 2)
talk_state = 0
else
npcHandler:say('Go defeat the demon oak first.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'hugo') then
selfSay('Ah, the bane of the Plains of Havoc, the hidden beast, the unbeatable foe. I live here for years and I am sure it\'s only a {myth}.', cid)
talk_state = 4
elseif msgcontains(msg, 'myth') and talk_state == 3 then
selfSay('There are many tales about the fearsome Hugo. It\'s said it is an abomination, accidentally created by {Yenny the Gentle}. It\'s halve demon, halve something else and people say it\'s still alive after dozens of years.', cid)
talk_state = 5
elseif msgcontains(msg, 'yenny the gentle') and talk_state == 4 then
selfSay('Yenny, known as the Gentle, was one of most powerfull magicwielders in ancient times and known throughout the world for her mercy and kindness.', cid)
setPlayerStorageValue(cid,6664,1)
talk_state = 6
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
npcHandler:say('Ok thanks.', cid)
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
It doesn't work, what's the erro? Please someone can fix it?