function onThink()
local random = math.random(5)
if random == 1 then
selfSay("ho !")
elseif random == 2 then
selfSay("ho ho !")
elseif random == 3 then
selfSay("ho ho ho!")
elseif random == 4 then
selfSay("ho ho ho ho!")
elseif random == 5 then
selfSay("ho ho ho ho hohohhhih!")
end
Code:function onThink() local random = math.random(5) if random == 1 then selfSay("ho !") elseif random == 2 then selfSay("ho ho !") elseif random == 3 then selfSay("ho ho ho!") elseif random == 4 then selfSay("ho ho ho ho!") elseif random == 5 then selfSay("ho ho ho ho hohohhhih!") end
function onThink() npcHandler:onThink() end
local something = 0
function onThink()
if something < 5 then
something = something + 1
elseif random == 6 then
selfSay("Haidihoo")
something = 0
end
end
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
local something = 0
function onThink()
if something < 5 then
something = something + 1
elseif random == 6 then
selfSay("Haidihoo")
something = 0
end
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
-- here comes what the NPC should do
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
elseif something >= 6 thenCode: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 local something = 0 function onThink() if something < 5 then something = something + 1 elseif random == 6 then selfSay("Haidihoo") something = 0 end 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 -- here comes what the NPC should do return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Why it doesn't work?
elseif something >= 6 then
You realize this topic is from 2008 right ?
Help is better late than never, sad for the tread started that had to wait 8 years for the solution thou... Haha![]()