• 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 1.5]the script is working but only in the character itself, not in the area as it should, where did I go wrong? someone help me to solve?

Shoorkill

Member
Joined
Dec 17, 2018
Messages
126
Reaction score
21
local combat1 = Combat()
combat1:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat1:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat1:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat1:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat1:setFormula(COMBAT_FORMULA_LEVELMAGIC, 0.6, -30, 1.2, 0)

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat2:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat2:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat2:setFormula(COMBAT_FORMULA_LEVELMAGIC, 0.6, -30, 1.2, 0)

local condition1 = Condition(CONDITION_REGENERATION)
condition1:setParameter(CONDITION_PARAM_TICKS, 60000)
condition1:setParameter(CONDITION_PARAM_MANAGAIN, 1000)
condition1:setParameter(CONDITION_PARAM_MANATICKS, 1)
condition1:setParameter(CONDITION_PARAM_DELAYED, 1)
condition1:setParameter(CONDITION_PARAM_HEALTHGAIN, 1000)
combat1:addCondition(condition1)

local condition2 = Condition(CONDITION_ENERGY)
condition2:setParameter(CONDITION_PARAM_DELAYED, 1)
condition2:addDamage(120, 60000, -1000)
combat2:addCondition(condition2)

local area1 = createCombatArea({
{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 area2 = createCombatArea({
{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 function createCombatArea(array)
local area = CombatArea()
for x, column in ipairs(array) do
for y, value in ipairs(column) do
if value == 1 then
area:addPosition(Position(x - 1, y - 1, 0))
end
end
end
return area
end

combat:setArea(area1)
combat:setArea(area2)


local function onCastSpell1(parameters)
combat1:execute(parameters.cid, parameters.var)
end

local function onCastSpell2(parameters)
combat2:execute(parameters.cid, parameters.var)
end

function onTargetCreature(cid, target)
local function sun1(cid)
doCreatureSay(cid, "...", TALKTYPE_ORANGE_1)
return true
end

local rand = math.random(1, 5)
if isPlayer(target) and rand == 5 then
doSendAnimatedText(getCreaturePosition(target), "Regen!", TEXTCOLOR_TEAL)
return true
elseif isPlayer(target) and rand == 4 then
doSendAnimatedText(getCreaturePosition(target), "Regen!", TEXTCOLOR_TEAL)
doSendMagicEffect(getCreaturePosition(target), 24)
return true
elseif isPlayer(target) and rand < 4 then
doSendAnimatedText(getCreaturePosition(target), "Regen!", TEXTCOLOR_TEAL)
return true
else
doSendAnimatedText(getCreaturePosition(target), "Regen!", TEXTCOLOR_TEAL)
return true
end
end

combat1:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
local parameters = { cid = cid, var = var }
addEvent(onCastSpell1, 1, parameters)
addEvent(onCastSpell2, 1, parameters)
end
 
Back
Top