zbizu
Legendary OT User
Text and effects for tp room written in classic style so script should work on other TFS versions too(non-metatables version is in a spoiler below).
globalevents.xml:
text.lua:
TFS 1.1:
non-metatables version for older servers:
globalevents.xml:
Code:
<globalevent name="text" interval="3500" script="text.lua"/>
text.lua:
TFS 1.1:
Code:
local effects = {
{position = Position(995, 100, 7), text = 'Teleports', effect = CONST_ME_GROUNDSHAKER},
{position = Position(281, 254, 8), text = 'TP Room'}, -- text only
{position = Position(307, 254, 1), text = 'Event', effect = CONST_ME_GROUNDSHAKER},
}
function onThink(interval)
for i = 1, #effects do
local settings = effects[i]
local spectators = Game.getSpectators(settings.position, false, true, 7, 7, 5, 5)
if #spectators > 0 then
if settings.text then
for i = 1, #spectators do
spectators[i]:say(settings.text, TALKTYPE_MONSTER_SAY, false, spectators[i], settings.position)
end
end
if settings.effect then
settings.position:sendMagicEffect(settings.effect)
end
end
end
return true
end
non-metatables version for older servers:
Code:
local fields = {
{x = 995, y = 1000, z = 7, text = "Teleports", eff = CONST_ME_GROUNDSHAKER},
{x = 281, y = 254, z = 8, text = "TP Room"}, -- text only
{x = 307, y = 254, z = 15, text = "Event", eff = CONST_ME_GROUNDSHAKER},
}
function onThink(interval)
for i = 1, #fields do
local pos = fields[i]
local people = getSpectators(pos, 7, 5, false, true)
if people then
if pos.text then
doCreatureSay(people[1], pos.text, TALKTYPE_ORANGE_1, false, 0, pos)
end
if pos.eff then
doSendMagicEffect(pos, pos.eff)
end
end
end
return true
end
Last edited by a moderator: