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

Heal Friend with damage

Crunch

Member
Joined
Jun 21, 2011
Messages
353
Reaction score
19
Location
England
Hi,

I have been playing around with spells and wanted to make a heal friend that does a little aoe of damage around the target they are healing. It works if the caster has written the name in properly but if they haven't it debugs the client. I have tried a few things but everything will debug the client if there isn't a specific name in there where the regular heal a friend will just poff.

Is it actually possible to mix the two things together?

This is the basic code which I started with before trying anything. TFS 1.3

Thanks

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

function onGetFormulaValues(player, level, magicLevel)
    local min = ((level / 5) + (magicLevel * 6.3) + 45)*2
    local max = ((level / 5) + (magicLevel * 14.4) + 90)*2
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat2:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat2:setArea(createCombatArea(AREA_CIRCLE2X2))

function onGetFormulaValues(player, level, magicLevel)
    local min = ((level / 5) + (magicLevel * 1.2) + 7)
    local max = ((level / 5) + (magicLevel * 2.85) + 16)
    return -min, -max
end

combat2:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    combat:execute(creature, variant)
    combat2:execute(creature, variant)
    return true
end
 
Hi @Crunch!

I've tried your script (I've named it heal_friend_aoe.lua, you should put your file name there instead) using the following entry in spells.xml and it seems to be working fine for me (no debugs in client when not specifying any player name).

Lua:
<!-- Heal friend entry in spells.xml Remember to check the spellId attribute and change it according to your needs (just use the next free number, for example) -->
<!-- Remember to change parameters such as level, mana, etc... to fit your needs -->
<instant group="healing" spellid="201" name="Heal Friend Aoe" words="exura sio aoe" level="8" mana="1" premium="0" aggressive="0" blockwalls="1" needtarget="1" playernameparam="1" params="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="healing/heal_friend_aoe.lua">
    <vocation name="Druid" />
    <vocation name="Elder Druid" />
</instant>

As a side note, the area you are using is also hitting the player. So, in the end, you are healing him but right afterwards also damaging him. If this is not intended, you can change the area you're setting in line:19 of your script:
Lua:
combat2:setArea(createCombatArea(AREA_CIRCLE2X2))

[[-- This is the value of AREA_CIRCLE2X2 defined in spells.lua (this hits the targeted player)
AREA_CIRCLE2X2 = {
    {0, 1, 1, 1, 0},
    {1, 1, 1, 1, 1},
    {1, 1, 3, 1, 1},
    {1, 1, 1, 1, 1},
    {0, 1, 1, 1, 0}
}

You can create a new one that doesn't hit the player (this one doesn't)
CUSTOM_AREA_CIRCLE2X2 = {
    {0, 1, 1, 1, 0},
    {1, 1, 1, 1, 1},
    {1, 1, 2, 1, 1},
    {1, 1, 1, 1, 1},
    {0, 1, 1, 1, 0}
}
]]

combat2:setArea(createCombatArea(CUSTOM_AREA_CIRCLE2X2))
 
Hi @Crunch!

I've tried your script (I've named it heal_friend_aoe.lua, you should put your file name there instead) using the following entry in spells.xml and it seems to be working fine for me (no debugs in client when not specifying any player name).

Lua:
<!-- Heal friend entry in spells.xml Remember to check the spellId attribute and change it according to your needs (just use the next free number, for example) -->
<!-- Remember to change parameters such as level, mana, etc... to fit your needs -->
<instant group="healing" spellid="201" name="Heal Friend Aoe" words="exura sio aoe" level="8" mana="1" premium="0" aggressive="0" blockwalls="1" needtarget="1" playernameparam="1" params="1" cooldown="1000" groupcooldown="1000" needlearn="0" script="healing/heal_friend_aoe.lua">
    <vocation name="Druid" />
    <vocation name="Elder Druid" />
</instant>

As a side note, the area you are using is also hitting the player. So, in the end, you are healing him but right afterwards also damaging him. If this is not intended, you can change the area you're setting in line:19 of your script:
Lua:
combat2:setArea(createCombatArea(AREA_CIRCLE2X2))

[[-- This is the value of AREA_CIRCLE2X2 defined in spells.lua (this hits the targeted player)
AREA_CIRCLE2X2 = {
    {0, 1, 1, 1, 0},
    {1, 1, 1, 1, 1},
    {1, 1, 3, 1, 1},
    {1, 1, 1, 1, 1},
    {0, 1, 1, 1, 0}
}

You can create a new one that doesn't hit the player (this one doesn't)
CUSTOM_AREA_CIRCLE2X2 = {
    {0, 1, 1, 1, 0},
    {1, 1, 1, 1, 1},
    {1, 1, 2, 1, 1},
    {1, 1, 1, 1, 1},
    {0, 1, 1, 1, 0}
}
]]

combat2:setArea(createCombatArea(CUSTOM_AREA_CIRCLE2X2))
Hi ribul, thanks for checking, I did manage to fix it, and like you say it was the spell ID I wasn’t using it correctly :)
 
Back
Top