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

Hoggle.lua

Creon

Well-Known Member
Joined
Aug 25, 2009
Messages
708
Reaction score
92
Location
United States
I've been trying to figure this out for some time now, and I simply cannot. The problem is that when you say yes, Hoggle isn't setting the storage to be able to pass through the door. Please help :(

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(msg == "garden") then
	npcHandler:say({'My garden is full of wild-growing plants and my back is aching like hell. Perhaps you are interested in cutting these pest plants ...', 'I\'ll give you 5 shiny pieces of gold for this job. Is this a deal?'} , cid)
	talkState[talkUser] = 1
    end
	if(msg == "yes") then
	if(getPlayerStorageValue(cid, 4832) < 2) then
	setPlayerStorageValue(cid, 4832, 2)
	npcHandler:say({'Excellent. You will have to rattle at the garden gate a bit to get it open, it\'s quite old, you know. Tell me about the garden when you are finished.'} , cid)
	talkState[talkUser] = 2
	end
	end
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
npcHandler:setCallback(CALLBACK_GREET, greetCallback)--
 
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 doMessageCheck(msg, 'garden') then
		npcHandler:say('My garden is full of wild-growing plants and my back is aching like hell. Perhaps you are interested in cutting these pest plants ...', cid)
		npcHandler:say('I\'ll give you 5 shiny pieces of gold for this job. Is this a deal?', cid, 3000)
		talkState[talkUser] = 1
	elseif doMessageCheck(msg, 'yes') and talkState[talkUser] = 1 then
		doCreatureSetStorage(cid, 4832, 1)
		npcHandler:say('Nice, Hab dich auch lieb :D blabla cu', cid)
		talkState[talkUser] = 0

	elseif doMessageCheck(msg, 'garden') and(getCreatureStorage(cid, 4832) == 2) then
		doCreatureSetStorage(cid, 4832, 3)
		npcHandler:say('Excellent. You will have to rattle at the garden gate a bit to get it open, it\'s quite old, you know. Tell me about the garden when you are finished.', cid)
		talkState[talkUser] = 0

-- no
	elseif doMessageCheck(msg, 'no') and isInArray({1}, talkState[talkUser]) then
		selfSay("Ok then.", cid)
		talkState[talkUser] = 0
	end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
without test
 
Back
Top