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

Healing rune actions

Etzi

New Member
Joined
May 19, 2014
Messages
28
Reaction score
1
(TFS 0.3.6 8.60) I need a healing rune script made in actions with these formulas

Code:
COMBAT_FORMULA_LEVELMAGIC, 16, 1750, 16, 1800)


Thx :)
 
Try this. (side note: I have no clue what those values mean :()
tested on 0.3.7

actions.xml
Code:
<action itemid="11111111111" event="script" value="script.lua"/>
script.lua
Code:
local cfg = {
   removeOnUse = 1, -- remove item on use | 1 = true  0 = false |
   advanced = 1,    -- 1 = Use Advanced, 0 = use Basic
   lvl = 35,        -- level required to use the item

   -- advanced
   level = 2.5,     -- player level * amount
   magic = 3,       -- player magic level * amount
   min = 4.6,       -- min heal |
   max = 5.2,       -- max heal |

     -- Example: Player_level 50, Magic_level 65
     -- (50 * 2.5 + 65 * 3) * 4.6 == 1472 -- Min_heal
     -- (50 * 2.5 + 65 * 3) * 5.2 == 1664 -- Max_heal

   --basic
   min_heal = 700,  -- min heal
   max_heal = 1000, -- max heal


}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isPlayer(itemEx.uid) and getPlayerLevel(cid) >= cfg.lvl then
     if cfg.advanced == 1 then
       mini = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic) * cfg.min
       maxi = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic) * cfg.max
       doCreatureAddHealth(itemEx.uid, math.random(mini, maxi))
     else
       doCreatureAddHealth(itemEx.uid, math.random(cfg.min_heal, cfg.max_heal))
     end
     doSendMagicEffect(toPosition,14)
     if cfg.removeOnUse == 1 then
       doRemoveItem(item.uid, 1)
     end
   else
     doCreatureSay(cid, "You must be level ".. cfg.lvl .." to use this rune.", TALKTYPE_ORANGE_1)
   end
   return true
end
 
Last edited:
tfs 0.3.6 8.60 I will explain for you. I got ultimate healing rune in spells.xml right now but i wanna convert it to actions.xml

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 16, 1750, 16, 1800)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

So it heals like that much these formulas is what i want i hope you understand more now :)
Posting reply from PM.

Other then the magic effect being green instead of blue.. and mine not dispelling paralyze, the scripts are mostly the same.
I'm not sure how you want your healing, and I already expressed not knowing what the formula of healing means.
I'll post an updated version with blue sparkles and dispel paralyze. You will need to update the healing formula to fit your needs.

actions.xml
Code:
<action itemid="11111111111" event="script" value="script.lua"/>
script.lua
Code:
local cfg = {
   removeOnUse = 1, -- remove item on use | 1 = true  0 = false |
   advanced = 0,    -- 1 = Use Advanced, 0 = use Basic
   lvl = 35,        -- level required to use the item

   -- advanced
   level = 2.5,     -- player level * amount
   magic = 3,       -- player magic level * amount
   min = 4.6,       -- min heal |
   max = 5.2,       -- max heal |

     -- Example: Player_level 50, Magic_level 65
     -- (50 * 2.5 + 65 * 3) * 4.6 == 1472 -- Min_heal
     -- (50 * 2.5 + 65 * 3) * 5.2 == 1664 -- Max_heal

   --basic
   min_heal = 700,  -- min heal
   max_heal = 1000, -- max heal


}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isPlayer(itemEx.uid) and getPlayerLevel(cid) >= cfg.lvl then
     if cfg.advanced == 1 then
       mini = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic) * cfg.min
       maxi = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic) * cfg.max
       doCreatureAddHealth(itemEx.uid, math.random(mini, maxi))
     else
       doCreatureAddHealth(itemEx.uid, math.random(cfg.min_heal, cfg.max_heal))
     end
     doSendMagicEffect(toPosition, 12)
     doRemoveCondition(cid, 32)
     if cfg.removeOnUse == 1 then
       doRemoveItem(item.uid, 1)
     end
   else
     doCreatureSay(cid, "You must be level ".. cfg.lvl .." to use this rune.", TALKTYPE_ORANGE_1)
   end
   return true
end
 
Last edited:
Final response.

Got my friend to explain the formula used.
Here's the updated script.lua
Good luck.
Code:
local cfg = {
   level = 16,
   magic = 16,
   min = 1750,
   max = 1800,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if isCreature(itemEx.uid) then
     mini = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic + cfg.min)
     maxi = (getPlayerLevel(cid) * cfg.level + getPlayerMagLevel(cid) * cfg.magic + cfg.max)
     doCreatureAddHealth(itemEx.uid, math.random(mini, maxi))
     doSendMagicEffect(toPosition, 12)
     doRemoveCondition(cid, 32)
     doRemoveItem(item.uid, 1)
   else
     doCreatureSay(cid, "This rune can only be used on creatures.", TALKTYPE_ORANGE_1)
   end
   return true
end
 
Back
Top