Ir para conteúdo

Posts Recomendados

globalevents.xml:

<globalevent name="text" interval="3500" script="text.lua"/>

text.lua:

[TFS 1.1]

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

Para versões que não utilizam metatable :

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

Créditos : zbisu

Link para o comentário
https://xtibia.com/forum/topic/232937-tfs-1011-tp-room-texteffects/
Compartilhar em outros sites

×
×
  • Criar Novo...