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

spells The Forgotten Server 0.4

Ranzor

Pixel Art
Joined
Apr 7, 2016
Messages
68
Reaction score
28
Location
Germany
I want a spells folder that has the spells as in the example below



I want the spells to be like this example
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


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

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

In my OT the spells are like this, but I want it as in the example above.
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_FIREATTACK)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -1, -8, -1, -14, 5, 5, 1.39, 2.19)

local distanceCombat = createCombatObject()
setCombatParam(distanceCombat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(distanceCombat, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(distanceCombat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatFormula(distanceCombat, COMBAT_FORMULA_LEVELMAGIC, -1, -8, -1, -14, 5, 5, 1.39, 2.19)

function onCastSpell(cid, var)
if(variantToNumber(var) ~= 0) then
return doCombat(cid, distanceCombat, var)
end
return doCombat(cid, combat, var)
end
 
They are both the same, they use the same objects, consts and methods. I think you are thrown off by the arr table, but generally speaking they look like either will work.
 
I want the spells with arr in a single script
Alright then open up your spells.lua in data\spells\lib\ and add the arr table without the local keyword, now you can reference that arr table in all your scripts.
So your arr table will look like this.
Lua:
arr = {
    {0, 0, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1},
    {1, 1, 1, 3, 1, 1, 1},
    {1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 0, 0}
}
This file spells.lua will automatically reference the arr table because its scope is no longer local, its scope is now global. You will also see other tables in there such as AREA_WAVE4, AREA_SQUAREWAVE5 etc.. that are also used in spells.
 
Back
Top