• 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 Makes addon items you get from quests

gr33nd3v1l

You see a Green Devil.
Joined
Feb 12, 2008
Messages
140
Reaction score
0
Location
Croatia
Well this was originally made for my server but i guess it can be used on any TFS or EVO.

Basically what i made is an npc that makes \or\ sells all the addon items you can't loot from monsters unless i have them in a quest on my server.
Its really really basic so anyone can edit it and add\remove items or prices\needed ingredients.

I don't know how much this is needed but i thought if i needed it someone else might aswell. This works with no errors on my server, be sure you are using Jiddo's npc system tho ;D
I think thats the one i got =)

This goes in data/npc/scripts/questitems.lua

Code:
----------------------------------------------- Made for Genesis -----------------------------------------------
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

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(npcHandler.focus ~= cid) then
		return false
	end

		addon_need_premium = 'Sorry, you need a premium account to get addons.'
		addon_have_already = 'Sorry, you already have this addon.'
		addon_have_not_items = 'Sorry, you don\'t have these items.'
		addon_give = 'Here you are.'
		player_gold = getPlayerItemCount(cid,2148)
		player_plat = getPlayerItemCount(cid,2152)*100
		player_crys = getPlayerItemCount(cid,2160)*10000
		player_money = player_gold + player_plat + player_crys
		
		if msgcontains(msg, 'items') then
			selfSay('I can make you royal steel, draconian steel, hell steel, crude iron, warrior\'s sweat, spider silk yarns, magic sulphur, Simon\'s favourite staff and Ceiron\'s wolf tooth chain. You can also buy some fighting spirit, sniper gloves, mandrake, a mermaid\'s comb, or i could trade you an engraved crossbow for a normal crossbow.') 
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'royal steel') then
				if getPlayerItemCount(cid,2487) >= 1 then
					selfSay('Have you got a crown armor?')
					talk_state = 1
				else
					selfSay('I need a crown armor to make some royal steel. Come back when you have one.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerTakeItem(cid,2487,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5887, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'draconian steel') then
				if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,5880) >= 1 then
					selfSay('Did you bring me a Dragon shield and some iron ore?')
					talk_state = 2
				else
					selfSay('I need a Dragon shield and some iron ore to make that.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 2 then
			talk_state = 0
			if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,5880) >= 1 then
					if doPlayerTakeItem(cid,2516,1) and doPlayerTakeItem(cid,5880,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5889, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'hell steel') then
				if getPlayerItemCount(cid,6500) >= 1 and getPlayerItemCount(cid,5887) >= 1 then
					selfSay('Did you bring me some demonic essence and a piece of royal steel?')
					talk_state = 3
				else
					selfSay('I need some demonic essence and a piece of royal steel to make that.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 3 then
			talk_state = 0
				if getPlayerItemCount(cid,6500) >= 1 and getPlayerItemCount(cid,5887) >= 1 then
					if doPlayerTakeItem(cid,6500,1) and doPlayerTakeItem(cid,5887,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5888, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'crude iron') then
				if getPlayerItemCount(cid,5880) >= 10 then
					selfSay('Did you bring me 10 iron ores?')
					talk_state = 4
				else
					selfSay('I need 10 iron ores to make a chunk of crude iron.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			talk_state = 0
				if getPlayerItemCount(cid,5880) >= 10 then
					if doPlayerTakeItem(cid,5880,10) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5892, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'warrior\'s sweat') then
				if getPlayerItemCount(cid,2005) >= 1 then
					selfSay('Did you bring me a bucket of water?')
					talk_state = 5
				else
					selfSay('I can make almost a perfect fake out of plain water, bring me a bucket full of water.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			talk_state = 0
				if getPlayerItemCount(cid,2005) >= 1 then
					if doPlayerTakeItem(cid,2005,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5885, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'spider silk') then
				if getPlayerItemCount(cid,5879) >= 10 then
					selfSay('Have you got 10 giant spider silks for me?')
					talk_state = 6
				else
					selfSay('Bring me 10 giant spider silks.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 6 then
			talk_state = 0
				if getPlayerItemCount(cid,5879) >= 10 then
					if doPlayerTakeItem(cid,5879,10) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5886, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'sulphur') then
				if getPlayerItemCount(cid,2147) >= 1 and getPlayerItemCount(cid,2150) >= 1 and getPlayerItemCount(cid,2149) >= 1 and getPlayerItemCount(cid,2146) >= 1 and getPlayerItemCount(cid,2151) >= 1 then
					selfSay('Did you bring me the gems?')
					talk_state = 7
				else
					selfSay('I need a small ruby, emerald, sapphire, amethyst and a talon to make some magic sulphur.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 7 then
			talk_state = 0
				if getPlayerItemCount(cid,2147) >= 1 and getPlayerItemCount(cid,2150) >= 1 and getPlayerItemCount(cid,2149) >= 1 and getPlayerItemCount(cid,2146) >= 1 and getPlayerItemCount(cid,2151) >= 1 then
					if doPlayerTakeItem(cid,2147,1) and doPlayerTakeItem(cid,2150,1) and doPlayerTakeItem(cid,2149,1) and doPlayerTakeItem(cid,2146,1) and doPlayerTakeItem(cid,2151,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5904, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'staff') then
				if getPlayerItemCount(cid,5901) >= 10 then
					selfSay('Can i have that wood?')
					talk_state = 8
				else
					selfSay('Bring me 10 pieces of wood.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 8 then
			talk_state = 0
				if getPlayerItemCount(cid,5901) >= 10 then
					if doPlayerTakeItem(cid,5901,10) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 6107, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'mandrake') then
				if player_money >= 15000 then
					selfSay('Did you bring me 15000 gold coins?')
					talk_state = 9
				else
					selfSay('Mandrake roots cost 15000 gold coins.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 9 then
			talk_state = 0
				if player_money >= 15000 then
					if doPlayerRemoveMoney(cid,15000) then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5015, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'spirit') then
				if player_money >= 15000 then
					selfSay('Did you bring me 15000 gold coins?')
					talk_state = 10
				else
					selfSay('Fighting spirit costs 15000 gold coins.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 10 then
			talk_state = 0
				if player_money >= 15000 then
					if doPlayerRemoveMoney(cid,15000) then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5884, 1)
					end
			else
				selfSay(addon_have_not_items)
			end

------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'wolf tooth chain') then
				if getPlayerItemCount(cid,5879) >= 1 and getPlayerItemCount(cid,2826) >= 1 then
					selfSay('Did you bring me some giant spider silk and a dead wolf?')
					talk_state = 11
				else
					selfSay('I need freshly killed wolf and some giant spider silk.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 11 then
			talk_state = 0
				if getPlayerItemCount(cid,5879) >= 1 and getPlayerItemCount(cid,2826) >= 1 then
					if doPlayerTakeItem(cid,5879,1) and doPlayerTakeItem(cid,2826,1) == 0 then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5940, 1)
					end
			else
				selfSay(addon_have_not_items)
			end

------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'engraved') then
				if getPlayerItemCount(cid,2455) >= 1 then
					selfSay('Did you bring me a crossbow to trade for this engraved crossbow?')
					talk_state = 12
				else
					selfSay('I can\'t just give you this crossbow, bring me one to trade.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 12 then
			talk_state = 0
				if getPlayerItemCount(cid,2455) >= 1 then
					if doPlayerTakeItem(cid,2455,1) then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5947, 1)
					end
			else
				selfSay(addon_have_not_items)
			end

------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'gloves') then
				if player_money >= 10000 then
					selfSay('Did you bring me 10000 gold coins?')
					talk_state = 13
				else
					selfSay('Sniper gloves cost 10000 gold coins.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 13 then
			talk_state = 0
				if player_money >= 10000 then
					if doPlayerRemoveMoney(cid,10000) then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5875, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ addon ------------------------------------------------
		elseif msgcontains(msg, 'mandrake') then
				if player_money >= 5000 then
					selfSay('Did you bring me 5000 gold coins?')
					talk_state = 14
				else
					selfSay('I can give you a mermaid\'s comb for 5000 gold coins.')
					talk_state = 0
				end
------------------------------------------------ confirm yes ------------------------------------------------
		elseif msgcontains(msg, 'yes') and talk_state == 14 then
			talk_state = 0
				if player_money >= 5000 then
					if doPlayerRemoveMoney(cid,5000) then
						selfSay(addon_give)
						doPlayerAddItem(cid, 5015, 1)
					end
			else
				selfSay(addon_have_not_items)
			end
------------------------------------------------ confirm no ------------------------------------------------
		elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 34) then
			selfSay('Ok then.')
			talk_state = 0
		end
return true
end

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

Add this into data/npc/Martin.lua
Code:
<npc name="Martin" script="data/npc/scripts/questitems.lua" autowalk="25" floorchange="0" access="3" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="153" head="0" body="114" legs="114" feet="114" addons="3" corpse="2212"/>

<parameters>

<parameter key="message_greet" value="Hello |PLAYERNAME|. I can make all the addon items you can't get from monsters." />
<parameter key="message_needmoremoney" value="You do not have enough money." />
<parameter key="message_decline" value="Dont you have |TOTALCOST| gold coins?" />

</parameters>

</npc>

I simply used the existing addon npc script that i had with my server and edited the lines to my liking, so i don't think i deserve any credits ;)


\\\\\
Can someone please move this i am very sorry i clicked the wrong link =(
 
Last edited:
Back
Top