LucasFerraz
Systems Analyst
I made this script myself. I need help because it's not working.
You make a dialog with the NPC like this and he must change my life crystal to life ring.
You make a dialog with the NPC like this and he must change my life crystal to life ring.
LUA:
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, 'rebel')) then
selfSay('Are you saying that Gamel is a member of the rebellion?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'yes')) then
selfSay('Do you know what his plans are about?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'crystal') and talkState[talkUser] == 1) then
selfSay('That is terrible! Will you give me the crystal?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'yes')) then
if getPlayerItemCount(cid,2177) >= 1 then
doPlayerRemoveItem(cid,2177,1)
doPlayerAddItem(cid,2168,1)
selfSay('Thank you! Take this ring. If you ever need some healing, come here, bring me the ring and ask me to \'heal\' you.', cid)
else
selfSay('Come back with the crystal.', cid)
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())