legolas23
New Member
- Joined
- Jan 8, 2009
- Messages
- 537
- Reaction score
- 3
Poprawi ktos npc za repka? Nie odpowiada mi na slowa ze skryptu ;s
Code:
yalaharia = {x=237, y=928, z=7}
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)
if(npcHandler.focus ~= cid) then
return false
end
if msgcontains(msg, 'quest') or msgcontains(msg, 'quests') or msgcontains(msg, 'mission') or msgcontains(msg, 'travel') or msgcontains(msg, 'yalaharia') or msgcontains(msg, 'fishing rod') then
if getPlayerStorageValue(cid, 10002) == -1 then
npcHandler:say("Hey ,if you bring me an interesting box from these ruins I can take you to Yalaharia ok?", cid)
talk_state = 1642
elseif getPlayerStorageValue(cid, 10002) == 1 then
npcHandler:say("Got this box for me?", cid)
talk_state = 1643
elseif getPlayerStorageValue(cid, 10002) == 2 then
npcHandler:say("Do you want to travel Yalaharia now?", cid)
talk_state = 1644
end
elseif talk_state == 1642 then
if msgcontains(msg, 'yes') then
npcHandler:say("Thank you! Please look in questlog for more information.", cid)
setPlayerStorageValue(cid, 10002, 1)
elseif msgcontains(msg, 'no') then
selfSay('Then not.')
end
elseif talk_state == 1643 then
if msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,6103) >= 1 then
doPlayerRemoveItem(cid, 6103, 1)
npcHandler:say("Thanks you! Now I can take you to Yalaharia for 50gp.", cid)
setPlayerStorageValue(cid, 10002, 2)
else
selfSay('Sorry, you dont have it.')
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Ok then not.", cid)
end
elseif talk_state == 1644 then
if msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid, 10002) == 2 then
if(doPlayerRemoveMoney(cid, 50) == TRUE) then
doTeleportThing(cid,yalaharia)
npcHandler:say("Here we go!", cid)
else
npcHandler:say("You dont have enough gps...", cid)
end
elseif msgcontains(msg, 'no') then
npcHandler:say("Ok then not.", cid)
end
talk_state = 0
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())