Mam problem z tym npc:
Jak zagadam do niego to mowi hi playername, i have been expecting you
a na mission/help itp nie reaguje:
XML:
lua:
PLZ HELP!
Jak zagadam do niego to mowi hi playername, i have been expecting you
a na mission/help itp nie reaguje:
XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dad" script="dad.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="129" head="114" body="119" legs="114" feet="114" corpse="2212"/>
</npc>
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'hi')) then
selfSay('Hi son!', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'help') and talkState[talkUser] == 1) then
selfSay('Real mens says quest!', cid)
elseif(msgcontains(msg, 'quest') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid, 1100)==6) then
selfSay('I need 5 fresh corpses of rats to make some equipment for you.', cid)
setPlayerStorageValue(cid, 1100,7)
selfSay('Because of rats are much stronger then rabbits i will borrow you my shield and my old knife', cid)
doPlayerAddItem(cid, 2526,1)
doPlayerAddItem(cid, 2379,1)
end
elseif(msgcontains(msg, 'rat') and talkState[talkUser] == 1) then
if(getPlayerStorageValue(cid,1100)==7 and doPlayerRemoveItem(cid, 2813,5)) then
selfSay('Uncle Alfred want to see you', cid)
setPlayerStorageValue(cid, 1100,8)
else
selfSay('You arent doing it good.', cid)
end
elseif(msgcontains(msg, 'bye') and talkState[talkUser] == 1) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())