• 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 Mass Healing in Percent

whiteblXK

Active Member
Joined
Apr 20, 2011
Messages
315
Solutions
9
Reaction score
32
Location
Poland
Hello, how to create spell will heal 40 percent HP players who are in circle3x3?
I tried change this spell but I can't :(
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setHealingFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 10, 12)
local area = createCombatArea(AREA_CIRCLE3X3)
setCombatArea(combat, area)
function onCastSpell(cid, var)
   return doCombat(cid, combat, var)
end
 
I don't think there's a function which supports this in TFS.
You can use combat formulas but they will not be percentage wise, as you use a fixed value and percentage needs a different value for each player.
 
Code:
function onTargetCreature(cid, target)
     if isPlayer(target) then
         min = getCreatureMaxHealth(target) * 0.4
         doTargetCombatHealth(cid, target, COMBAT_HEALING, min, min, CONST_ME_MAGIC_BLUE)
     end
     return true
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
 
Thanks Limos :)

I put your function to my script but this no working :/

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

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, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 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},
}


function onTargetCreature(cid, target)
     if isPlayer(target) then
         min = getCreatureMaxHealth(target) * 0.4
         doTargetCombatHealth(cid, target, COMBAT_HEALING, min, min, 19)
     end
     return true
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

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

function onCastSpell(cid, var)
    return doCombat(cid, combat, numberToVariant(cid))
end
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_SOUND_GREEN)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

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, 1, 1, 1, 0, 0, 0, 0},
   {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
   {0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0},
   {0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
   {0, 0, 0, 0, 1, 1, 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},
}

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

function onTargetCreature(cid, target)
     if isPlayer(target) then
         min = getCreatureMaxHealth(target) * 0.4
         doTargetCombatHealth(cid, target, COMBAT_HEALING, min, min, CONST_ME_NONE)
     end
     return true
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
       return doCombat(cid, combat, var)
end
 
No working :/ I have rune without useable(in *.dat ant items.otb). I want only click PPM on rune and heal all player who are in area
 
Explain what happens, what should be different and post how you added it, "no working" isn't useful since it's to vague to understand what the problem is.
 
When I clicking PPM on rune nothing is happens :/ Maybe in spells.xml is error:

Code:
<rune name="Mass Healing"  id="2272"    aggressive="0" mana="1000" maglv="10" cooldown="1000"  enabled="1" allowfaruse="1" script="buffs/SUPPORT/Mass Healing.lua"></rune>
 
Devland 0.97b, I don't have errors in console. I want create rune without using crosshair on player.

I fixed, thanks
 
Last edited:
Back
Top