• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Druid Addon (Rl tibia style) Wolf Paws

Elda Swok

Searching New Project
Joined
Jun 18, 2008
Messages
703
Reaction score
9
Location
Pittsburgh, Pa.
Code:
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

local config = {
wolfpaw = 5896,
bearpaw = 5897,
storage = 19016,
}


function creatureSayCallback(cid, type, msg)
    -- 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.
    if (not npcHandler:isFocused(cid)) then
		return false
    end
		if msgcontains(msg, 'addon') then
		if getPlayerStorageValue(cid, storage) > 0 then
		npcHandler:say('Would you like to wear bear paws like I do? No problem, just bring me 50 bear paws and 50 wolf paws and Ill fit them on.', cid)
		end
		elseif msgcontains(msg, 'bear paws') then
		npcHandler:say('Have you brought 50 bear paws and 50 wolf paws?', cid)
		end
		elseif msgcontains(msg, 'yes')  then
		npcHandler:say('Excellent! Like promised, here are your bear paws.', cid)
		if getPlayerItemCount(cid, wolfpaw) >= 50 and getPlayerItemCount(cid, bearpaw) >= 50 then
	if getPlayerSex(cid) == 1 then 
	doPlayerAddOutfit(cid, 144, 1)
	doPlayerRemoveItem(cid, wolfpaw, 50)
	doPlayerRemoveItem(cid, bearpaw, 50)
		setPlayerStorageValue(cid, storage, 1)

	else
	doPlayerAddOutfit(cid, 148, 1)
	doPlayerRemoveItem(cid, wolfpaw, 50)
	doPlayerRemoveItem(cid, bearpaw, 50)
		setPlayerStorageValue(cid, storage, 1)
	end
		elseif getPlayerItemCount(cid, wolfpaw) < 50 or getPlayerItemCount(cid, bearpaw) < 50 then
				npcHandler:say('Im sorry, but you do not have either 50 Bear Paws or 50 Wolf Paws.', cid)
end
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I'm not 100% sure that it's 100% functional but if you see an error please let me know.
 
Back
Top Bottom