• Sign up for October Mapping Competition! The prize includes Otland Premium time.
  • There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

(BUG .lua) Script that centers Sprite

jondropss

New Member
Joined
Jul 19, 2020
Messages
41
Reaction score
1
Hello otland friends. I am using a script to centralize the spell sprites on my narutibia server. Version 8.6 Tfs 0.4

However ... when using this script, the weapon stops damaging ... only the centralized effects sprites are showing, but without damage.


Could someone help me?

---> SCRIPT I'M USING NOW:

Lua:
 local min, max = 1700,1900 --Ataque mínino e ataque máximo

local w = {
    [1] = {ef = 173, sh = 41, dmg = COMBAT_FIREDAMAGE, posx = 1, posy = 1}, -- Isto seria a aplicação dentro da tabela, bastaria replicar em cada linha adicionada.
    [2] = {ef = 117, sh = 101, dmg = COMBAT_ICEDAMAGE, posx = 1, posy = 1},
    [3] = {ef = 46, sh = 38, dmg = COMBAT_POISONDAMAGE, posx = 1, posy = 1},
    [4] = {ef = 17, sh = 31, dmg = COMBAT_DEATHDAMAGE, posx = 1, posy = 1},
    [5] = {ef = 47, sh = 35, dmg = COMBAT_ENERGYDAMAGE, posx = 1, posy = 1},
    [6] = {ef = 36, sh = 31, dmg = COMBAT_PHYSICALDAMAGE, posx = 1, posy = 1},
    [7] = {ef = 81, sh = 104, dmg = COMBAT_HOLYDAMAGE, posx = 1, posy = 1}
}

function onUseWeapon(cid, var)
        local effect = getPlayerStorageValue(cid, 4561)
        local target = getCreatureTarget(cid)

        if target ~= 0 then
                local wx = w[effect] or w[math.random(#w)]
                doSendDistanceShoot(getThingPos(cid), getThingPos(target), wx.sh)
                local pos = {x = getThingPos(target).x + (wx.posx), y = getThingPos(target).y + (wx.posy), z = getThingPos(target).z} -- Aqui vai trabalhar em cima das posições definidas la na tabela.
                addEvent(doAreaCombatHealth, 100, cid, wx.dmg, pos, 0, -min, -max, wx.ef) -- E aqui vai aplicar o efeito na posição final.
        end
        return true
end
 
Solution
That's because you're sending the damage to the animation position, instead of the target position.

Lua:
local min, max = 1700,1900 --Ataque mínino e ataque máximo

local config = {
    [1] = {effect = 173, shoot_effect = 41, dmg =...

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,590
Solutions
245
Reaction score
2,683
That's because you're sending the damage to the animation position, instead of the target position.

Lua:
local min, max = 1700,1900 --Ataque mínino e ataque máximo

local config = {
    [1] = {effect = 173, shoot_effect = 41, dmg = COMBAT_FIREDAMAGE, pos_x = 1, pos_y = 1}, -- Isto seria a aplicação dentro da tabela, bastaria replicar em cada linha adicionada.
    [2] = {effect = 117, shoot_effect = 101, dmg = COMBAT_ICEDAMAGE, pos_x = 1, pos_y = 1},
    [3] = {effect = 46, shoot_effect = 38, dmg = COMBAT_POISONDAMAGE, pos_x = 1, pos_y = 1},
    [4] = {effect = 17, shoot_effect = 31, dmg = COMBAT_DEATHDAMAGE, pos_x = 1, pos_y = 1},
    [5] = {effect = 47, shoot_effect = 35, dmg = COMBAT_ENERGYDAMAGE, pos_x = 1, pos_y = 1},
    [6] = {effect = 36, shoot_effect = 31, dmg = COMBAT_PHYSICALDAMAGE, pos_x = 1, pos_y = 1},
    [7] = {effect = 81, shoot_effect = 104, dmg = COMBAT_HOLYDAMAGE, pos_x = 1, pos_y = 1}
}

function onUseWeapon(cid, var)
    local target = getCreatureTarget(cid)   
    if target ~= 0 then
        local index = config[getPlayerStorageValue(cid, 4561)] or config[math.random(#config)]
        local target_pos = getThingPosition(target)
        local animation_pos = {x = target_pos.x + index.pos_x, y = target_pos.y + index.pos_y, z = target_pos.z} -- Aqui vai trabalhar em cima das posições definidas la na tabela.
       
        doSendDistanceShoot(getThingPosition(cid), target_pos, index.shoot_effect) -- shoot animation
        addEvent(doSendMagicEffect, 100, animation_pos, index.effect) -- damage animation
        addEvent(doAreaCombatHealth, 100, cid, index.dmg, target_pos, 0, -min, -max, CONST_ME_NONE) -- damage, with no animation -- E aqui vai aplicar o efeito na posição final.
    end
    return true
end
 
Last edited:
Solution
OP
jondropss

jondropss

New Member
Joined
Jul 19, 2020
Messages
41
Reaction score
1
Hey, thanks for answering me !!

I used your script, the Missile effect came out, but when the impact effect appeared I took debug
however without error in the distro!

🧐🧐🕵️‍♂️
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,590
Solutions
245
Reaction score
2,683
idk why CONST_ME_NONE would debug the client..

but feel free to choose any of the other effects. lol
Figure out what works for you, I guess.
Lua:
CONST_ME_DRAWBLOOD = 0
CONST_ME_LOSEENERGY = 1
CONST_ME_POFF = 2
CONST_ME_BLOCKHIT = 3
CONST_ME_EXPLOSIONAREA = 4
CONST_ME_EXPLOSIONHIT = 5
CONST_ME_FIREAREA = 6
CONST_ME_YELLOW_RINGS = 7
CONST_ME_GREEN_RINGS = 8
CONST_ME_HITAREA = 9
CONST_ME_TELEPORT = 10
CONST_ME_ENERGYHIT = 11
CONST_ME_MAGIC_BLUE = 12
CONST_ME_MAGIC_RED = 13
CONST_ME_MAGIC_GREEN = 14
CONST_ME_HITBYFIRE = 15
CONST_ME_HITBYPOISON = 16
CONST_ME_MORTAREA = 17
CONST_ME_SOUND_GREEN = 18
CONST_ME_SOUND_RED = 19
CONST_ME_POISONAREA = 20
CONST_ME_SOUND_YELLOW = 21
CONST_ME_SOUND_PURPLE = 22
CONST_ME_SOUND_BLUE = 23
CONST_ME_SOUND_WHITE = 24
CONST_ME_BUBBLES = 25
CONST_ME_CRAPS = 26
CONST_ME_GIFT_WRAPS = 27
CONST_ME_FIREWORK_YELLOW = 28
CONST_ME_FIREWORK_RED = 29
CONST_ME_FIREWORK_BLUE = 30
CONST_ME_STUN = 31
CONST_ME_SLEEP = 32
CONST_ME_WATERCREATURE = 33
CONST_ME_GROUNDSHAKER = 34
CONST_ME_HEARTS = 35
CONST_ME_FIREATTACK = 36
CONST_ME_ENERGYAREA = 37
CONST_ME_SMALLCLOUDS = 38
CONST_ME_HOLYDAMAGE = 39
CONST_ME_BIGCLOUDS = 40
CONST_ME_ICEAREA = 41
CONST_ME_ICETORNADO = 42
CONST_ME_ICEATTACK = 43
CONST_ME_STONES = 44
CONST_ME_SMALLPLANTS = 45
CONST_ME_CARNIPHILA = 46
CONST_ME_PURPLEENERGY = 47
CONST_ME_YELLOWENERGY = 48
CONST_ME_HOLYAREA = 49
CONST_ME_BIGPLANTS = 50
CONST_ME_CAKE = 51
CONST_ME_GIANTICE = 52
CONST_ME_WATERSPLASH = 53
CONST_ME_PLANTATTACK = 54
CONST_ME_TUTORIALARROW = 55
CONST_ME_TUTORIALSQUARE = 56
CONST_ME_MIRRORHORIZONTAL = 57
CONST_ME_MIRRORVERTICAL = 58
CONST_ME_SKULLHORIZONTAL = 59
CONST_ME_SKULLVERTICAL = 60
CONST_ME_ASSASSIN = 61
CONST_ME_STEPSHORIZONTAL = 62
CONST_ME_BLOODYSTEPS = 63
CONST_ME_STEPSVERTICAL = 64
CONST_ME_YALAHARIGHOST = 65
CONST_ME_BATS = 66
CONST_ME_SMOKE = 67
CONST_ME_INSECTS = 68
CONST_ME_DRAGONHEAD = 69
CONST_ME_NONE = 255
 
Top