Reparar este script

El Bu

Member
Messages
42
Points
151
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino
    Combat = COMBAT_FIREDAMAGE, -- Tipo de daño elemental
    Time = 150, -- Milisegundos que tardará en aparecer cada golpe
    Direction = {NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST}, -- Direciones a las que irá cada golpe. (Puedes cambiar el orden)
}
local function canEffect(pos, proj) -- Night Wolf based on Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    end
    local n = not proj and 3 or 2
    for i = 1, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function loop(delay, cid, times, burst, item, slot)
    local Belero, fonte = {}, {}
    if times <= table.maxn(Config.Direction) then
        if isPlayer(cid) and getPlayerSlotItem(cid, slot).itemid == item.itemid then
            local Formula = {
                min = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.5,
                max = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 2,
            }
            local toPosition = getPositionByDirection(getThingPos(cid), Config.Direction[times], 1)
            if canEffect(toPosition, true) then
                if getTileInfo(toPosition).protection or getTileInfo(getThingPos(cid)).protection then
                    Belero, fonte = Config.PZ[1], Config.PZ[2]
                else
                    Belero, fonte = Config.PVP[1], Config.PVP[2]
                    doAreaCombatHealth(cid, Config.Combat, toPosition, 0, - Formula.min, - Formula.max, CONST_ME_NONE)
                end
                doSendDistanceShoot(getThingPos(cid), toPosition, Belero)
                doSendMagicEffect(toPosition, fonte)
            end
        else
            return true
        end
        times, burst = times + 1, burst + 100
        addEvent(loop, delay, delay, cid, times, burst, item, slot)
    else
        loop(delay, cid, 1, burst, item, slot)
    end
    return true
end
function onEquip(cid, item, slot)
    local outfit = getCreatureOutfit(cid)
    outfit.lookType = getPlayerSex(cid) > 0 and Config.Outfit[2] or Config.Outfit[1]
    doSetCreatureOutfit(cid, outfit, -1)
    loop(Config.Time, cid, 1, 0, item, slot)
    return true
end
function onDeEquip(cid, item, slot)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    return true
end


1740333032735.png
Muchas Gracias. TFS 02 VERSION TIBIA 9.6
 
Solution
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino...
TFS 02 VERSION TIBIA 9.6 Que tal alguien me podria apoyar reparando este script de un helmeth que crea dos efectos alrededor del player uno dentro de pz y otro fuera de pz alrededor del player y hace un poco de daño al que le pegue, al caminar el player el efecto sigue saliendo alrededor de el ABAJO COLOCO EL ERROR QUE ME SALE EN CONSOLA:
JavaScript:
local Config = {
    PZ = { -- Efectos en Zona protegida
        CONST_ANI_ENERGY, -- Efecto mágico a distancia
        CONST_ME_PURPLEENERGY, -- Efecto mágico normal
    },
    PVP = { -- Efectos en Zona NO protegida
        CONST_ANI_FIRE, -- Efecto mágico a distancia
        CONST_ME_FIREAREA, -- Efecto mágico normal
    },
    Outfit = {336, 335}, -- Traje femenino, Traje masculino
    Combat = COMBAT_FIREDAMAGE, -- Tipo de daño elemental
    Time = 150, -- Milisegundos que tardará en aparecer cada golpe
    Direction = {NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST}, -- Direciones a las que irá cada golpe. (Puedes cambiar el orden)
}
local function canEffect(pos, proj) -- Night Wolf based on Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    end
    local n = not proj and 3 or 2
    for i = 1, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function loop(delay, cid, times, burst, item, slot)
    local Belero, fonte = {}, {}
    if times <= table.maxn(Config.Direction) then
        if isPlayer(cid) and getPlayerSlotItem(cid, slot).itemid == item.itemid then
            local Formula = {
                min = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 0.5,
                max = (getPlayerLevel(cid) * 1 + getPlayerMagLevel(cid) * 1) * 2,
            }
            local toPosition = getPositionByDirection(getThingPos(cid), Config.Direction[times], 1)
            if canEffect(toPosition, true) then
                if getTileInfo(toPosition).protection or getTileInfo(getThingPos(cid)).protection then
                    Belero, fonte = Config.PZ[1], Config.PZ[2]
                else
                    Belero, fonte = Config.PVP[1], Config.PVP[2]
                    doAreaCombatHealth(cid, Config.Combat, toPosition, 0, - Formula.min, - Formula.max, CONST_ME_NONE)
                end
                doSendDistanceShoot(getThingPos(cid), toPosition, Belero)
                doSendMagicEffect(toPosition, fonte)
            end
        else
            return true
        end
        times, burst = times + 1, burst + 100
        addEvent(loop, delay, delay, cid, times, burst, item, slot)
    else
        loop(delay, cid, 1, burst, item, slot)
    end
    return true
end
function onEquip(cid, item, slot)
    local outfit = getCreatureOutfit(cid)
    outfit.lookType = getPlayerSex(cid) > 0 and Config.Outfit[2] or Config.Outfit[1]
    doSetCreatureOutfit(cid, outfit, -1)
    loop(Config.Time, cid, 1, 0, item, slot)
    return true
end
function onDeEquip(cid, item, slot)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    return true
end


View attachment 5278
Muchas Gracias. TFS 02 VERSION TIBIA 9.6

Abre tu servidor en visual studio code,
primero busca haber si tienes getPosByDir, si no la tienes abre el global.lua ( si tienes uno ) si no tienes pegalo en tu script mismo, al principio del todo.
En caso que tengas getPosByDir, entonces cambia en tu script el nombre de getPositionByDirection por getPosByDir.
Sino, utiliza este codigo:
JavaScript:
function getPositionByDirection(pos, dir, distance)
    local newPos = {x = pos.x, y = pos.y, z = pos.z}
    if dir == NORTH then
        newPos.y = newPos.y - distance
    elseif dir == NORTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y - distance
    elseif dir == EAST then
        newPos.x = newPos.x + distance
    elseif dir == SOUTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y + distance
    elseif dir == SOUTH then
        newPos.y = newPos.y + distance
    elseif dir == SOUTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y + distance
    elseif dir == WEST then
        newPos.x = newPos.x - distance
    elseif dir == NORTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y - distance
    end
    return newPos
end
 
Solution
Abre tu servidor en visual studio code,
primero busca haber si tienes getPosByDir, si no la tienes abre el global.lua ( si tienes uno ) si no tienes pegalo en tu script mismo, al principio del todo.
En caso que tengas getPosByDir, entonces cambia en tu script el nombre de getPositionByDirection por getPosByDir.
Sino, utiliza este codigo:
JavaScript:
function getPositionByDirection(pos, dir, distance)
    local newPos = {x = pos.x, y = pos.y, z = pos.z}
    if dir == NORTH then
        newPos.y = newPos.y - distance
    elseif dir == NORTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y - distance
    elseif dir == EAST then
        newPos.x = newPos.x + distance
    elseif dir == SOUTHEAST then
        newPos.x = newPos.x + distance
        newPos.y = newPos.y + distance
    elseif dir == SOUTH then
        newPos.y = newPos.y + distance
    elseif dir == SOUTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y + distance
    elseif dir == WEST then
        newPos.x = newPos.x - distance
    elseif dir == NORTHWEST then
        newPos.x = newPos.x - distance
        newPos.y = newPos.y - distance
    end
    return newPos
end
Listo muchas gracias!! eres el mejor brother
 

Tibia Server Lists

#1 FEATURED US Ultron OT 1,513 / 5,000Online EXPStages PROTO8.6 ENGINEUltron OT RANK PTS5.9 +100% VOTES0 #2 FEATURED US Nefera 159 / 0Online EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.1 +100% VOTES0 #3 FEATURED ES Deixis 1 / 0Online EXPStages PROTO1098 ENGINETFS RANK PTS3.7 +100% VOTES1 #4 FEATURED ES Maeli 5 / 150Online EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.7 +100% VOTES0 #5 MX Marlboro War 32 / 300Online EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -33% VOTES0 #6 BR Tibinha YurOts 17 / 150Online EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.2 -14% VOTES0 #7 US Halera 3 / 0Online EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.9 -83% VOTES0 #8 BR Exordion Legacy 52 / 2,000Online EXPx2 PROTO7.72 ENGINEExordion RANK PTS4.9 +100% VOTES0 #9 PL Lubelski 6 / 1,000Online EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.6 -15% VOTES0 #10 ES JustRL FreeTC 1530 30 / 250Online EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS4.3 +100% VOTES0 #11 DE DBU Online 0 / 400Online EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS4.3 +100% VOTES0 #12 PL ReWar 0 / 2,000Online EXPcustom PROTO8.6 ENGINEOther RANK PTS4.3 0% VOTES0 #13 PL Velesta 0 / 1,000Offline EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.3 -99% VOTES0 #14 ES Farlia Global 2026 0 / 333Offline EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS3.9 -22% VOTES0 #15 SE MortalisOT Custom 0 / 500Offline EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS3.8 +100% VOTES0 #16 US Rommania 0 / 500Online EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 +100% VOTES0 #17 US BerethaOnline 1 / 2,000Online EXPStages PROTO10.98 ENGINETFS RANK PTS3.5 +100% VOTES0
Top