• 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 Area spell that deals damage based on players distance.

XaviRd

New Member
Joined
Nov 22, 2015
Messages
15
Reaction score
3
I was trying to make a script in which the creature launches a spell according to the distance of the player, if the player is near the spell will be a small explosion with a lot of damage, if the player is far ... the spell will be bigger and with less damage, but i can not more it and i have my head burned, i've been with this for hours.
if someone can correct me because i do not know what to do with this script. i leave my script. thanks alot.

is a spell, tfs 1.2, the "Damage" does not work, and the "Areas" do not work. i know is sh_t .


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

function getSpellDamage(cid, min, max)

local min, max = -3000, -4000

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

arr1 = {
{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, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 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}
}


local area1 = createCombatArea(arr1)
setCombatArea(combat, area1)

--------------------------------------------------------------------------

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

function getSpellDamage(cid, min2, max2)

local min2, max2 = -2000, -3000

return min2, max2
end

setCombatCallback(combat2, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

arr2 = {
{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, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 3, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 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}
}


local area2 = createCombatArea(arr2)
setCombatArea(combat2, area2)

--------------------------------------------------------------------------

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

function getSpellDamage(cid, min3, max3)

local min3, max3 = -1000, -2000

return min3, max3
end

setCombatCallback(combat3, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")

arr3 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}


local area3 = createCombatArea(arr3)
setCombatArea(combat3, area3)

--------------------------------------------------------------------------

local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)

function getSpellDamage(cid, min4, max4)

local min4, max4 = 0, -1000

return min4, max4
end

setCombatCallback(combat4, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage")



arr4 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}


local area4 = createCombatArea(arr4)
setCombatArea(combat4, area4)



--------------------------------------------------------------------------


function onCastSpell(cid, var)

local pos = Position(32448, 31778, 7) ------ position where are boss
local creature = Creature(cid)
if isCreature(cid) == true then
if creature:getPathTo( pos, 1, 2, true, true, 0) then
creature:say("I kill you!", TALKTYPE_ORANGE_1)
combat:execute(cid, var)
elseif creature:getPathTo( pos, 2, 3, true, true, 0) then
creature:say("I kill you!", TALKTYPE_ORANGE_1)
combat2:execute(cid, var)
elseif creature:getPathTo( pos, 3, 4, true, true, 0) then
creature:say("I kill you!", TALKTYPE_ORANGE_1)
combat3:execute(cid, var)
elseif creature:getPathTo( pos, 4, 5, true, true, 0) then
creature:say("I kill you!", TALKTYPE_ORANGE_1)
combat4:execute(cid, var)
end
end
return true
end
 
Last edited:
Back
Top