<globalevent name="effect" interval="1" event="script" value="welcomen.lua"/>
function onThink(interval, lastExecution)
local pos = {x=160, y=50, z=7, stackpos=1}
doSendMagicEffect(pos, 30)
doSendAnimatedText(pos, "Welcome", 140)
return TRUE
end
local texts = {
{{x=100,y=110,z=7}, 'Dragons'},
{{x=520,y=610,z=7}, 'Temple'},
{{x=424,y=424,z=2}, 'NPCs'}
}
function onThink(interval, lastExecution)
for _, text in ipairs(texts) do
doSendAnimatedText(text[1], text[2], math.random(0, 255))
end
return TRUE
end
Is that for 0.2?
local config = {
positions = {
["Depo"] = { x = 1269, y = 1375, z = 3 },
["Trainers"] = { x = 1272, y = 1374, z = 6 }
},
effects = {
CONST_ME_MORTAREA,
CONST_ME_HITBYFIRE,
CONST_ME_GIFTWRAPS,
CONST_ME_STUN
}
}
function onThink(cid, interval, lastExecution)
for text, pos in pairs(config.positions) do
doSendMagicEffect(pos, math.random(1, #config.effects))
doSendAnimatedText(pos, text, math.random(1, 255))
end
return TRUE
end
@hejsahejsa
use an loop with addEvent
function onThink(interval, lastExecution)
local texts =
{
["Trainer"] = {{x=96, y=118, z=7}, CONST_ME_MAGIC_GREEN, TEXTCOLOR_YELLOW},
["Temple"] = {{x=95, y=117, z=7}, CONST_ME_MAGIC_RED, TEXTCOLOR_BLUE},
["Teleport"] = {{x=92, y=118, z=7}, CONST_ME_MAGIC_BLUE, TEXTCOLOR_RED}
}
for text, param in pairs(texts) do
doSendAnimatedText(param[1], text, param[3])
doSendMagicEffect(param[1], param[2])
end
return TRUE
end
@Himad
I think TFS 0.2 don't have GlobalEvents.
@killak
Change math.random(01,255) to the name of the color that you want. Example TEXTCOLOR_RED.
@Mefiu
I think this is better!.
Lua:function onThink(interval, lastExecution) local texts = { ["Trainer"] = {{x=96, y=118, z=7}, CONST_ME_MAGIC_GREEN, TEXTCOLOR_YELLOW}, ["Temple"] = {{x=95, y=117, z=7}, CONST_ME_MAGIC_RED, TEXTCOLOR_BLUE}, ["Teleport"] = {{x=92, y=118, z=7}, CONST_ME_MAGIC_BLUE, TEXTCOLOR_RED} } for text, param in pairs(texts) do doSendAnimatedText(param[1], text, param[3]) doSendMagicEffect(param[1], param[2]) end return TRUE end