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

Spell New base for Healing Spells

Jano

oturhaN
Joined
Feb 21, 2008
Messages
876
Solutions
1
Reaction score
68
Location
Chile
PHP:
function onCastSpell(cid, var)
local dif = getPlayerMaxHealth(cid) - getPlayerHealth(cid)
if getPlayerHealth(cid) ~= getPlayerMaxHealth(cid) then
min = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) * 3) * 0.5 - 30
max = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) * 3) * 0.6
healing = math.random(min, max)
if healing > dif then
healing = dif
end
doPlayerAddHealth(cid, healing)
doSendMagicEffect(getPlayerPosition(cid), 12)
doSendAnimatedText(getPlayerPosition(cid), healing, 30)
doRemoveCondition(cid, CONDITION_PARALYZE)
else
doSendMagicEffect(getPlayerPosition(cid), 12)
doRemoveCondition(cid, CONDITION_PARALYZE)
end
end
---By Nahruto
-This Script show how mouch hp you gain.
-This is the Light healing, but you can take this base, to the others healing spells.
-If you have not the function
Code:
doRemoveCondition
you should do a combat to remove the paralyze condition.
 
Shorten :D
PHP:
function onCastSpell(cid, var) 
	if getPlayerHealth(cid) ~= getPlayerMaxHealth(cid) then 
		local heal = createFormula(cid, 0.5, 30, 0.6, 0)
		doPlayerAddHealth(cid, heal) 
		doSendAnimatedText(getPlayerPosition(cid), heal, 30) 
	end 
	doSendMagicEffect(getPlayerPosition(cid), 12) 
	doRemoveCondition(cid, CONDITION_PARALYZE) 
end 

function createFormula(cid, min1, minRem, max1, maxRem)
	local base = (getPlayerLevel(cid) * 2 + getPlayerMagLevel(cid) * 3)
	local value = math.random(base * min1 + minRem, base * max1 + maxRem)
	return math.min(value, getPlayerMaxHealth(cid) - getPlayerHealth(cid))
end

nice one ;)
 
Last edited:
Actually in core, minb (maxRem here) is added to the mina (min1 here), not taken - same with max values.
Code:
local value = math.random(base * min1 + minRem, base * max1 + maxRem)

Anyway, you may do it by combat (but you won't be able anymore to send an information how much did the player heal, whats bad), you should use:
Code:
function getFormulaValues(cid, level, maglevel)
	min = (level * 2 + maglevel * 3) * Xa + Xb
	max = (level * 2 + maglevel * 3) * Ya + Yb
	return min, max
end
and instead of:
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, Xa, Xb, Ya, Yb)
use:
Code:
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getFormulaValues")
 
Last edited:
Actually in core, minb (maxRem here) is added to the mina (min1 here), not taken - same with max values.
Code:
local value = math.random(base * min1 + minRem, base * max1 + maxRem)

Anyway, you may do it by combat (but you won't be able anymore to send an information how much did the player heal, whats bad), you should use:
Code:
function getFormulaValues(cid, level, maglevel)
	min = (level * 2 + maglevel * 3) * Xa + Xb
	max = (level * 2 + maglevel * 3) * Ya + Yb
	return min, max
end
and instead of:
Code:
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, Xa, Xb, Ya, Yb)
use:
Code:
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getFormulaValues")

You're right, I thought wrong :D

About that combat, I didn't inform them about it since I thought that the meaning of this was to not use combats ^.-
 
yeah, the point of this was dont use more combats for healing spells :/.
nice one colandus.
 
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getFormulaValues")
....
 
Back
Top