Cześć wszystkim.
Mam problem z npc, nie odpisuje mi.
Tutaj skrypt:
Bardzo proszę o pomoc.
Pozdrawiam
Mam problem z npc, nie odpisuje mi.
Tutaj skrypt:
Code:
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 onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) 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, 'no') and getPlayerStorageValue(cid, 60300) == -1 and getPlayerStorageValue(cid, 60300) == -1 then
npcHandler:say('Well... as you wish.', cid)
talk_state = 0
elseif msgcontains(msg, 'yes') and getPlayerStorageValue(cid, 60300) == -1 and getPlayerStorageValue(cid, 60300) == -1 then
npcHandler:say('My roof is broken. I need some {nails} to repair it... 30 of them will be nice. I will really apreciate Your help!', cid)
talk_state = 5
elseif msgcontains(msg, 'nails') and talk_state == 5 then
npcHandler:say('Yes, metal, strong nail! I think War Golems may have some nails, You can find them south to my home.', cid)
doPlayerSetStorageValue(cid,60300, 1)
talk_state = 0
elseif (msgcontains(msg, 'nail') or msgcontains(msg, 'nails') or msgcontains(msg, 'yes') or msgcontains(msg, 'done') or msgcontains(msg, 'reward')) and getPlayerItemCount(cid,8309) < 30 and getPlayerStorageValue(cid, 60301) == -1 then
npcHandler:say('Please hurry up! I really need them.', cid)
elseif getPlayerStorageValue(cid, 60300) == 1 and getPlayerStorageValue(cid, 60301) == -1 and (msgcontains(msg, 'reward') or msgcontains(msg, 'yes') or msgcontains(msg, 'nail') or msgcontains(msg, 'nails') or msgcontains(msg, 'done')) then
if getPlayerItemCount(cid,8309) >= 30 then
if doPlayerRemoveItem(cid,8309,30) then
npcHandler:say('Thank You so much! I really apreciate it. If You want You can explore my basement. Go past the door on the left.', cid)
doPlayerSetStorageValue(cid,60301, 1)
talk_state = 0
end
end
------------------------------------------------ confirm no ------------------------------------------------
-- 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
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Bardzo proszę o pomoc.
Pozdrawiam