<action itemid="11111111111" event="script" value="script.lua"/>
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
Posting reply from PM.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
<action itemid="11111111111" event="script" value="script.lua"/>
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
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