math.random se usa para escolher um numero na sorte, ou seja, vai randomizar um numero de tanto a tanto. Acho que o que você esta procurando é o addEvent, assim você pode fazer um texto e depois de tantos segundos ir outro e assim vai.
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Editado Março 24 por Demonbholder
tpw e pq peguei um script: http://www.xtibia.com/forum/topic/134984-moveevent-dance-system/ . E tirei a troca de outfit e queria q ele cantasse a uma parte da musica E.T. da katy perry, entao teria q ser seguido, o script ta assim:
"local conf = {}
-- // config // ---
conf.danceTexts = {"Boy, you're an alien!", "Your touch so foreign!", "It's supernatural!", "Extraterrestrial!"}
conf.textSpeed = 1500 -- how fast animated texts is sending?
conf.danceSpeed = 100 -- dance speed
-- // end // --
function dancer(tab)
if isPlayer(tab[1]) then
local dirs = {[0] = {1,3},[1] = {0,2},[2] = {1,3},[3] = {0,2}}
local look = dirs[getCreatureLookDirection(tab[1])]
doCreatureSetLookDir(tab[1], look[math.random(1,2)])
tab[2].dancer = addEvent(dancer,conf.danceSpeed, {tab[1], tab[2]})
end
end
function messager(tab)
if isPlayer(tab[1]) then
doCreatureSay(tab[1], conf.danceTexts[math.random(1, #conf.danceTexts)], TALKTYPE_ORANGE_2)
tab[2].messager = addEvent(messager,conf.textSpeed, tab)
end
end
function onSay(cid, words, param, channel)
local pid = getPlayerGUID(cid)
if type(events[pid]) ~= "table" then
events[pid] = {}
end
if string.lower(param) == "on" and not(events[pid].dancer) then
dancer({cid, events[pid]})
messager({cid, events[pid]})
elseif string.lower(param) == "off" and events[pid].dancer then
stopEvent(events[pid].dancer)
stopEvent(events[pid].messager)
end
return TRUE
end"
eu queria coloka oq ta em azul pra n se radom e sim na ordem
Editado Março 24 por betosk
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Não pude testar porque esse script não funcionou aqui no meu Ot de testes. Espero que tenha funcionado ai '-'.
Bom, se funcionou ai, tenta assim:
numa = 1
local conf = {}
-- // config // ---
conf.danceTexts = {"Boy, you're an alien!", "Your touch so foreign!", "It's supernatural!", "Extraterrestrial!"}
conf.textSpeed = 1500 -- how fast animated texts is sending?
conf.danceSpeed = 100 -- dance speed
-- // end // --
function dancer(tab)
if isPlayer(tab[1]) then
local dirs = {[0] = {1,3},[1] = {0,2},[2] = {1,3},[3] = {0,2}}
local look = dirs[getCreatureLookDirection(tab[1])]
doCreatureSetLookDir(tab[1], look[math.random(1,2)])
tab[2].dancer = addEvent(dancer,conf.danceSpeed, {tab[1], tab[2]})
end
end
function messager(tab)
if isPlayer(tab[1]) then
doCreatureSay(tab[1], conf.danceTexts[numa], TALKTYPE_ORANGE_2)
numa = numa == #conf.danceTexts and 1 or numa + 1
tab[2].messager = addEvent(messager,conf.textSpeed, tab)
end
end
function onSay(cid, words, param, channel)
local pid = getPlayerGUID(cid)
if type(events[pid]) ~= "table" then
events[pid] = {}
end
if string.lower(param) == "on" and not(events[pid].dancer) then
dancer({cid, events[pid]})
messager({cid, events[pid]})
elseif string.lower(param) == "off" and events[pid].dancer then
stopEvent(events[pid].dancer)
stopEvent(events[pid].messager)
end
return TRUE
end
deu sim! vlw cara se manja mto! haha, +1 em reputaçao pra vc =)
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

Tranquilo, eu vou reportar para moverem, já que eu não posso.



info
Grupo: Campones
Registrado: 22/04/07
Posts: 4
Reputação: 0
to fazendo um script de talkaction, e estava querendo configurar para falar os textos na ordem certa. Se eu quizer coloka aleatorio eu coloko math.radom(0,4) -ja que sao 4 textos pre-definidos-, oq eu coloko em vez de math.radom para q seja na ordem q colokei acima?
Editado Março 24 por betosk