Hello OTlanders again!
So i have one more question - request Can you add to this script, one thing?
I want to, this npc addition/also giving first druid addon (50 Bear Paws 50 Wolf Paws)
here is code of script, thanks in advance!
So i have one more question - request Can you add to this script, one thing?
I want to, this npc addition/also giving first druid addon (50 Bear Paws 50 Wolf Paws)
here is code of script, thanks in advance!
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
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 (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and (not npcHandler:isFocused(cid)) then
npcHandler:say(getPlayerSex(cid) == 0 and "Well hello there lovely lady! Are You from wrecked ship? Probably, was it terrible, {yep}?" or "Well hello sir, Are You from wrecked ship? Probably, was it terrible, {yep}?", cid)
Topic[cid] = 0
npcHandler:addFocus(cid)
elseif msgcontains(msg, "yep") and npcHandler:isFocused(cid) then
npcHandler:say("Our clothes look like rags. Is it wet? You should be shivering. I willl search some clothes for you. What have we got here..? It will be good for you, {yes}?", cid)
Topic[cid] = 1
elseif Topic[cid] == 1 then
if msgcontains(msg, "yes") then
if doPlayerRemoveItem(cid, 2237, 1) then
npcHandler:say("Here you are.", cid)
doPlayerAddItem(cid, 2654, 1)
doPlayerAddItem(cid, 2649, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
Topic[cid] = 0
else
npcHandler:say("You do not have a dirt cape to exchange.", cid)
Topic[cid] = 0
end
elseif msgcontains(msg, "no") then
npcHandler:say("Okay then.", cid)
Topic[cid] = 0
end
elseif(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") and npcHander:isFocused(cid) then
npcHandler:say("Good bye.", cid, TRUE)
Topic[cid] = nil
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, "job") then
npcHandler:say("I can give you a new {cape} in exchange for a dirty one.", cid)
Topic[cid] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")