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

Solved Npc local voices tfs 1.3 add inteval

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i have a npc that talks alone, using this:

Code:
local voices = { {text = 'Hey! Hablame, te ayudare con informacion util del server'} }
npcHandler:addModule(VoiceModule:new(voices))

npcHandler:addModule(FocusModule:new())

But he surely talks alot, is there a way to put an interval for that? like spawn a message every 2 minutes or something? Thanks!!

tfs 1.3
 
Solution
after a quick reading I found this
Lua:
-- Creates a new instance of VoiceModule
function VoiceModule:new(voices, timeout, chance)
    local obj = {}
    setmetatable(obj, self)
    self.__index = self

    obj.voices = voices
    for i = 1, #obj.voices do
        local voice = obj.voices[i]
        if voice.yell then
            voice.yell = nil
            voice.talktype = TALKTYPE_YELL
        else
            voice.talktype = TALKTYPE_SAY
        end
    end

    obj.voiceCount = #voices
    obj.timeout = timeout or 10
    obj.chance = chance or 25
    return obj
end
so that module expects 1 to 3 params where the second is the exhaust time and the third is the chance that the message got
after a quick reading I found this
Lua:
-- Creates a new instance of VoiceModule
function VoiceModule:new(voices, timeout, chance)
    local obj = {}
    setmetatable(obj, self)
    self.__index = self

    obj.voices = voices
    for i = 1, #obj.voices do
        local voice = obj.voices[i]
        if voice.yell then
            voice.yell = nil
            voice.talktype = TALKTYPE_YELL
        else
            voice.talktype = TALKTYPE_SAY
        end
    end

    obj.voiceCount = #voices
    obj.timeout = timeout or 10
    obj.chance = chance or 25
    return obj
end
so that module expects 1 to 3 params where the second is the exhaust time and the third is the chance that the message got
 
Solution
after a quick reading I found this
Lua:
-- Creates a new instance of VoiceModule
function VoiceModule:new(voices, timeout, chance)
    local obj = {}
    setmetatable(obj, self)
    self.__index = self

    obj.voices = voices
    for i = 1, #obj.voices do
        local voice = obj.voices[i]
        if voice.yell then
            voice.yell = nil
            voice.talktype = TALKTYPE_YELL
        else
            voice.talktype = TALKTYPE_SAY
        end
    end

    obj.voiceCount = #voices
    obj.timeout = timeout or 10
    obj.chance = chance or 25
    return obj
end
so that module expects 1 to 3 params where the second is the exhaust time and the third is the chance that the message got
im sorry where should that be? in modules?
 
Back
Top