darkshin
New old member
- Joined
- Dec 14, 2010
- Messages
- 231
- Reaction score
- 22
Hey Guys, I was trying to make an NPC do a random talk with timing and animation.
I've made it work, but, somehow, all Npcs around my server started to talk the function like it were in their scripts aswell. Its pretty weird, I can't find out why.
Any ideas?
I've made it work, but, somehow, all Npcs around my server started to talk the function like it were in their scripts aswell. Its pretty weird, I can't find out why.
Any ideas?
Code:
local function speech1(cid)
return selfSay("Upon the hearth the fire is red..")
end
local function soundEffect(cid)
return doSendMagicEffect(getCreaturePosition(getNpcCid()), 25)
end
local lastSound = 0
function onThink()
if lastSound < os.time() then
lastSound = (os.time() + 10)
if math.random(1, 100) < 7 then
addEvent(speech1, 100)
addEvent(soundEffect, 100)
end
end