• 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!

TFS 0.X double exori

Zazeros

Member
Joined
Feb 13, 2012
Messages
67
Reaction score
17
0.4
Hello guys, Im having a little problem here. I was trying to do a double exori, when the player uses the exori, it hits once, and them after 2sec, hits again
But, if the player moves, the exori will not follow him and it will happen in the spot of the first exori

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)

local area = createCombatArea(AREA_SQUARE1X1)
setCombatArea(combat, area)

function onGetFormulaValues(cid, level, skill, attack, factor)
    local skillTotal, levelTotal = skill + attack, level / 5
    return -(skillTotal * 0.9 + levelTotal), -(skillTotal * 1.9 + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")





function onCastSpell(cid, var)
for i = 0, 2000, 2000 do
        addEvent(function(cid)
            if not isPlayer(cid) then
                  return
              end
            return doCombat(cid, combat, var)
        end, i, cid)
    end
end

I just want it to 'follow' the player, if he walks, happening where he is.
 
@Zazeros
Making it selftarget probably worked.
There is also other way. Position of spell is based on var which is like table that has 2 values:
  • type - possible types: VARIANT_NUMBER, VARIANT_POSITION, VARIANT_TARGETPOSITION, VARIANT_STRING
  • value - number (cid), string (for exiva with name) or position (position or target position)

In case of normal spells, it's value is generate by spells.cpp using spells.xml config.
You can also create own var with functions:
Code:
numberToVariant(number)
stringToVariant(string)
positionToVariant(pos)
targetPositionToVariant(pos)

No matter what you configure in spells.xml. You can override it in LUA. Example spell that always execute on current player position:
Code:
    local newVar = positionToVariant(getThingPosition(cid))
    return doCombat(cid, combat, newVar)
Version with 'cid' also make it execute on current player position (in case of 'combat' with 'area', without 'area', it makes combat apply to player, difference is like healing player and healing all players on tile):
Code:
    local newVar = numberToVariant(cid)
    return doCombat(cid, combat, newVar)
 
Last edited:
Back
Top