• 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 Two costs of mana for Heal Fiend

goesraphael

Member
Joined
Apr 4, 2017
Messages
59
Solutions
1
Reaction score
8
Hey guys, how u doing?


I need a script (preferably with function in sources) that when player1(druid) heals player2, spend 35 mana.
And when player1(druid) heals himself, spend 70 mana.

I use Nostalrius sources, I think that is the same as tfs 1.2.


This is my healfriend.lua:
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, maglevel)
    local base = 120
    local variation = 40

    local min = math.max((base - variation), ((3 * maglevel + 2 * level) * (base - variation) / 100))
    local max = math.max((base + variation), ((3 * maglevel + 2 * level) * (base + variation) / 100))

    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return combat:execute(creature, variant)
end


And this is in spells.xml:
Code:
    <instant name="Heal Friend" words="exura sio" maglv="7" mana="35" prem="1" aggressive="0" blockwalls="1" needtarget="1" playernameparam="1" params="1" needlearn="1" script="spells/heal friend.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>
 
Back
Top