• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Pedido] weather tfs 1.3

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Pedido] weather tfs 1.3 Empty [Pedido] weather tfs 1.3 Miér Feb 07, 2018 7:38 pm

    Invitado

    Anonymous
    Invitado
    en global.lua al final copia y pegar todo esto.



    Código:
    weatherConfig = {

        groundEffect = CONST_ME_LOSEENERGY,

        fallEffect = CONST_ANI_ICE,

        thunderEffect = true,

        minDMG = 5,

        maxDMG = 10

    }

     

    function Player.sendWeatherEffect(self, groundEffect, fallEffect, thunderEffect)

        local position, random = self:getPosition(), math.random

        position.x = position.x + random(-4, 4)

          position.y = position.y + random(-4, 4)

     

        local fromPosition = Position(position.x + 1, position.y, position.z)

           fromPosition.x = position.x - 7

           fromPosition.y = position.y - 5

     

        local tile, getGround

        for Z = 1, 7 do

            fromPosition.z = Z

            position.z = Z

     

            tile = Tile(position)

            if tile then -- If there is a tile, stop checking floors

                fromPosition:sendDistanceEffect(position, fallEffect)

                position:sendMagicEffect(groundEffect, self)

     

                getGround = tile:getGround()

                if getGround and ItemType(getGround:getId()):getFluidSource() == 1 then

                    position:sendMagicEffect(CONST_ME_WATERSPLASH, self)

                end

                break

            end

        end

     

        if thunderEffect and tile then

            if random(2) == 1 then

                local topCreature = tile:getTopCreature()

     

                if topCreature and topCreature:isPlayer() then

                    position:sendMagicEffect(CONST_ME_BIGCLOUDS, self)

                    doTargetCombatHealth(0, self, COMBAT_ENERGYDAMAGE, -weatherConfig.minDMG, -weatherConfig.maxDMG, CONST_ME_NONE)

                    self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You were hit by lightning and lost some health.")

                end

            end

        end

    end


    globalevents.xml :
    ponemos


    Código:
    <globalevent name="Weather" interval="200" script="Weather.lua" />


    globalevents/scripts :
    crear un archivo "Weather.lua"




    Código:
    function onThink(interval, lastExecution)
     local players = Game.getPlayers()
     if #players == 0 then
     return true
     end
     
     local player
     for i = 1, #players do
     player = players[i]
     player:sendWeatherEffect(weatherConfig.groundEffect, weatherConfig.fallEffect, weatherConfig.thunderEffect)
     end
     return true
    end

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).