• 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!

Lua [NPC] Lubo Quest Skript dont work

Philow

New Member
Joined
Apr 28, 2009
Messages
9
Reaction score
0
Hi,

Can someone take a look in my skript and help me?
The lubo.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

npcHandler:setMessage(MESSAGE_GREET, "Welcome to my adventurer shop, |PLAYERNAME|! What do you need?")

function playerBuyCitizenAddonNPC(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
        return false
	end	-- if ende
	if (parameters.confirm ~= true) and (parameters.decline ~= true) and (parameters.minoleather ~= true) then	
		if(getPlayerPremiumDays(cid) == 1) and (parameters.premium == true) then
				npcHandler:say('Sorry, but this addon is only for vip players!', cid)
				npcHandler:resetNpc()
				return true
		end 	-- if ende
		if (getPlayerStorageValue(cid, 10001) == 1) then
				npcHandler:say('You already have this addon!', cid)
				npcHandler:resetNpc()
				return true
		elseif (parameters.part == 1)
		then
				npcHandler:say('Sorry, the backpack I wear is not for sale. It\'s handmade from rare minotaur leather.', cid)
				return true
		elseif (getPlayerStorageValue(cid, 10001) == 3) and (parameters.part == 2)
		then
				npcHandler:say('Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?', cid)
				return true
		end		-- if ende
	elseif (parameters.confirm ~= true) and (parameters.decline ~= true) and(parameters.minoleather == true)  then
		--if(parameters.confirm  == true )
		npcHandler:say('Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?', cid)
		
		return true
	elseif (parameters.confirm  == true) then
		local addonNode = node:getParent()
		local addoninfo = addonNode:getParameters()
		if (addoninfo.minoleather == true) then
			npcHandler:say('Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!', cid)
			npcHandler:resetNpc()
			setPlayerStorageValue(cid,10001,3)
			return true
		elseif (addoninfo.part == 2) then
			local addonNode = node:getParent()
			local addoninfo = addonNode:getParameters()
			local items_number = 0
			if table.maxn(addoninfo.items) > 0 then
				for i = 1, table.maxn(addoninfo.items) do
					local item = addoninfo.items[i]
					if (getPlayerItemCount(cid,item[1]) >= item[2]) then
						items_number = items_number + 1
					end 	-- if ende
				end	-- for ende
			end 	-- if ende
			if(items_number == table.maxn(addoninfo.items)) then
				--doPlayerRemoveMoney(cid, addoninfo.cost)
				if table.maxn(addoninfo.items) > 0 then
					for i = 1, table.maxn(addoninfo.items) do
						local item = addoninfo.items[i]
						doPlayerRemoveItem(cid,item[1],item[2])
					end -- for ende 
				end-- if ende
				--doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
				--doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
				--setPlayerStorageValue(cid,addoninfo.storageID,1)
				npcHandler:say('Here you are.', cid)
				npcHandler:say('Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?', cid)
				setPlayerStorageValue(cid,10001,4)
			else
				npcHandler:say('You do not have needed items or cash!', cid)
			end-- els ende
		npcHandler:resetNpc()
		return true
		end
	end
end

local noNode = KeywordNode:new({'no'}, playerBuyCitizenAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyCitizenAddonNPC, {confirm = true})

local MinotaurLeatherNode = KeywordNode:new({'Minotaur Leather'}, playerBuyCitizenAddonNPC, {minoleather = true})
MinotaurLeatherNode:addChildKeywordNode(yesNode)
MinotaurLeatherNode:addChildKeywordNode(noNode)


local outfit_node = keywordHandler:addKeyword({'Addon'}, playerBuyCitizenAddonNPC, {premium = false,part = 1})
    outfit_node:addChildKeywordNode(MinotaurLeatherNode)
local outfit_node = keywordHandler:addKeyword({'Backpack'}, playerBuyCitizenAddonNPC, {premium = false,part = 2, items = {{5878,100}}})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
	

--keywordHandler:addKeyword({'Addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Sorry, the backpack I wear is not for sale. It\'s handmade from rare minotaur leather.'})
--keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.'})

npcHandler:addModule(FocusModule:new())
and here the xml file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Lubo" script="data/npc/scripts/npc/lubo.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="128" head="57" body="122" legs="126" feet="94" addons="3"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|."/>

 <parameter key="module_shop" value="1"/>
        <parameter key="shop_buyable" value="backpack,1988,25;fishing rod,2580,175;rope,2120,60;torch,2050,3;worm,3976,1;crowbar,2416,260" />
        <parameter key="shop_sellable" value="" />
    </parameters>
</npc>
I get no errors in the log but the NPC only react to trade.
The code is not finished but i think he shout rect to Addon or Backpack.
Thank you.
 
Back
Top