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

Lua New Spell

GOD Esteve

New Member
Joined
May 18, 2011
Messages
87
Reaction score
1
I have this spell below, it`s working but i whant to make a new thing and not get success

Sorry if it`s in wrong place, tell me and i put in the correct place

Using OTX 3.0 (TFS 1.0)

Code:
local spell = {}
spell.config = {
[7] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 0,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[6] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 1,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[5] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 2,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[4] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 3,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[3] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 4,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[2] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 5,
area = {
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 2, 0, 0, 0}
}  
},
[1] = {
damageType = 1,
areaEffect = 1,
sqmtoPush = 6,
area = {
{0, 0, 0, 3, 0, 0, 0}
}  
}
}


spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, 0, -1, 0)
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 50)-50, cid, spell.combats[n], var)
    end
    return true
end


The new thing that i whant to make it`s for each wave that spells use, can make the target move x sqms that it`s defined here [sqmtoPush = 6], but move to direction that the player that use the spell it`s looking.

For example
If i am the player and use the spells and hit the creature in the first wave, will move 6 sqms, but if i am looking > in the 3 firsts sqm and after i turn to north, will move the target 3 sqms to > and 3 sqms to north


Sorry for bad english, not american.
 
Last edited:
Back
Top