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

manarune that also heals life

Singed

New Member
Joined
Apr 20, 2009
Messages
112
Solutions
1
Reaction score
2
Hey guys, i'm trying to make a rune that heals you and gives you mana at the same time, and i already got it working, but it only shows the life that it gives, and it doesn't put the amount of mana it gives.

here is the code i have

PHP:
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)

function onGetFormulaValues(cid, level, maglevel)
	min = (level * 1 + maglevel * 4) * 2.08
	max = (level * 1 + maglevel * 4) * 2.7
	if min < 250 then
		min = 250
	end
	return min, max
end

local function addMana()
	local level = getPlayerLevel(cid)
	local mlevel = getPlayerMagLevel(cid)
	local pos = getPlayerPosition(cid)


	local mana_minimum = (level * 1) + (mlevel * 2) - 100
	local mana_maximum = (level * 2) + (mlevel * 2)

	mana_add = math.random(mana_minimum, mana_maximum)
	doPlayerAddMana(cid, mana_add)
	doSendAnimatedText(pos, "+" .. mana_add, TEXTCOLOR_LIGHTBLUE)
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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

Any help would be appreciated, I really want it to show how much mana and life it is giving.
 
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)
function onGetFormulaValues(cid, level, maglevel)
	local min = (level * 1 + maglevel * 4) * 2.08
	local max = (level * 1 + maglevel * 4) * 2.7
	return math.max(250, min), max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function addMana(cid)
	local level, mlevel, pos = getPlayerLevel(cid), getPlayerMagLevel(cid)
	local min = level * 1 + mlevel * 2 - 100
	local max = level * 2 + mlevel * 2

	local mana_add = math.random(min, max)
	doPlayerAddMana(cid, mana_add)
	doSendAnimatedText(getThingPos(cid), "+" .. mana_add, TEXTCOLOR_LIGHTBLUE)
	return true
end

function onCastSpell(cid, var)
	return doCombat(cid, combat, var) and addMana(cid)
end
 
i don't have that command in config.lua, should i just add it?

nvm its there and its on yes

but it still only shows the mana, i think its cause we are trying to do both events
at the same time, is there any way we can try and maybe put a delay between the
onCastSpell and addMAna?
 
Last edited:
weird ..

126696875543.png


(TFS 0.2)
 
Okay, it works.

thank you, its because my freaking gm is too high lvl so it
didn't have enough room to show both ahahha

(the gm was a freak accident of a monster so its like lvl 700k+)
 
Is there anyway you can put a \n at the end of the

doSendAnimatedText(getThingPos(cid), "+" .. mana_add, TEXTCOLOR_LIGHTBLUE)

?
 
Code:
doSendAnimatedText(getThingPos(cid), "+" .. mana_add .. "\n", TEXTCOLOR_LIGHTBLUE)
Not sure if it's gonna work as you intend.
 
Back
Top