Manarune that heals % of maxmana and hprune that heals % of maxhealth
I made this script for someone in support and I decided to share it incase other people would want it too.
Tested with TFS 0.3.6pl1 8.54
Actions.xml
Mana rune (heals % of maxmana).
Hp rune (heals % hp of maxhealth).
Hp and mana.
Rune for certain vocations (mana rune for sorcerers and druids as example).
Runes for TFS 0.2 client 9.1+
Tested with TFS 0.2.14 9.6
actions.xml
Mana rune (heals % of maxmana).
Hp rune (heals % hp of maxhealth).
Hp and mana.
NOTE: If both functions for animated text don't work on your server, you can use this one instead.
If you still have problems, errors or anything else that makes it not work, report it in this thread.
I made this script for someone in support and I decided to share it incase other people would want it too.
Tested with TFS 0.3.6pl1 8.54
Actions.xml
XML:
<action itemid="XXXX" event="script" value="other/rune.lua"/>
Mana rune (heals % of maxmana).
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local manamax = getPlayerMaxMana(cid)
local min = 3 -- this means 3% minimum healing
local max = 5 -- this means 5% maximum healing
local mana_add = math.random((manamax * (min/100)), (manamax * (max/100)))
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),"+"..mana_add.."", TEXTCOLOR_LIGHTBLUE)
doAddCondition(cid, exhaust)
return true
end
Hp rune (heals % hp of maxhealth).
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local hpmax = getCreatureMaxHealth(cid)
local min = 3 -- this means 3% minimum healing
local max = 5 -- this means 5% maximum healing
local hp_add = math.random((hpmax * (min/100)), (hpmax * (max/100)))
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doCreatureAddHealth(cid, hp_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),"+"..hp_add.."", TEXTCOLOR_GREEN)
doAddCondition(cid, exhaust)
return true
end
Hp and mana.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local hpmax, manamax = getCreatureMaxHealth(cid), getPlayerMaxMana(cid)
local minhp, maxhp = 3, 5 -- this means 3% minimum hp healing and 5% maximum hp healing
local minmana, maxmana = 3, 5 -- this means 3% minimum mana healing and 5% maximum mana healing
local hp_add, mana_add = math.random((hpmax * (minhp/100)), (hpmax * (maxhp/100))), math.random((manamax * (minmana/100)), (manamax * (maxmana/100)))
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doCreatureAddHealth(cid, hp_add)
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),"+"..hp_add.."", TEXTCOLOR_GREEN)
doAddCondition(cid, exhaust)
return true
end
Rune for certain vocations (mana rune for sorcerers and druids as example).
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local manamax = getPlayerMaxMana(cid)
local min = 3 -- this means 3% minimum healing
local max = 5 -- this means 5% maximum healing
local mana_add = math.random((manamax * (min/100)), (manamax * (max/100)))
if(hasCondition(cid, CONDITION_EXHAUST)) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
if(isSorcerer(cid) or isDruid(cid))then
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doSendAnimatedText(getPlayerPosition(cid),"+"..mana_add.."", TEXTCOLOR_LIGHTBLUE)
doAddCondition(cid, exhaust)
else
doPlayerSendTextMessage(cid,22,"This is only for sorcerers and druids.")
end
return true
end
Runes for TFS 0.2 client 9.1+
Tested with TFS 0.2.14 9.6
actions.xml
XML:
<action itemid="XXXX" script="other/manarune.lua"/>
Mana rune (heals % of maxmana).
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local manamax = getPlayerMaxMana(cid)
local min = 3 -- this means 3% minimum healing
local max = 5 -- this means 5% maximum healing
local mana_add = math.random((manamax * (min/100)), (manamax * (max/100)))
if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "+"..math.floor(mana_add).." mana", getCreaturePosition(cid), mana_add, TEXTCOLOR_TEAL)
doAddCondition(cid, exhaust)
return true
end
Hp rune (heals % hp of maxhealth).
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local hpmax = getCreatureMaxHealth(cid)
local min = 3 -- this means 3% minimum healing
local max = 5 -- this means 5% maximum healing
local hp_add = math.random((hpmax * (min/100)), (hpmax * (max/100)))
if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doCreatureAddHealth(cid, hp_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "+"..math.floor(hp_add).." health", getCreaturePosition(cid), hp_add, TEXTCOLOR_GREEN)
doAddCondition(cid, exhaust)
return true
end
Hp and mana.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000) -- time in seconds x1000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local hpmax, manamax = getCreatureMaxHealth(cid), getPlayerMaxMana(cid)
local minhp, maxhp = 3, 5 -- this means 3% minimum hp healing and 5% maximum hp healing
local minmana, maxmana = 3, 5 -- this means 3% minimum mana healing and 5% maximum mana healing
local hp_add, mana_add = math.random((hpmax * (minhp/100)), (hpmax * (maxhp/100))), math.random((manamax * (minmana/100)), (manamax * (maxmana/100)))
if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You are exhausted")
return true
end
doCreatureAddHealth(cid, hp_add)
doPlayerAddMana(cid, mana_add)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "+"..math.floor(hp_add).." health and +"..math.floor(mana_add).." mana", getCreaturePosition(cid), hp_add, TEXTCOLOR_GREEN)
doAddCondition(cid, exhaust)
return true
end
NOTE: If both functions for animated text don't work on your server, you can use this one instead.
Lua:
doCreatureSay(cid, "+"..math.floor(mana_add).."", TALKTYPE_ORANGE_1)
If you still have problems, errors or anything else that makes it not work, report it in this thread.
Last edited: