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

[Request] Heal Percentage

Brad

Mapper
Joined
Aug 27, 2008
Messages
592
Reaction score
21
Location
Canada Eh?
I'm wondering if its possible to make a Spell, Rune, Or Pot that heals a % of your Max hp Or mana. Ive used search and looked around but cant seem to find one.


Thanks~
 
LUA:
function healPercent(cid, percent)
    return doCreatureAddHealth(cid, (getCreatureMaxHealth(cid) * percent / 100))
end
 
Well, I'm messing around with it trying to get it to work and ended up getting myself a yellow skull with it. Lol (I'm not a scripter) Could you possibly give me an example of a spell with that?

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_DISPEL, CONDITION_PARALYZE)
  function healPercent(cid, percent)
    return doCreatureAddHealth(cid, (getCreatureMaxHealth(cid) * percent / 100))
end 

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

Yes i know i did it wrong.
 
add this function in your lib and
Code:
function onCastSpell(cid, var)
 healPercent(cid, hereputnumber)
	return doCombat(cid, combat, var)
end
in spell
 
Ive got it healing percentages now! Thanks a ton you guys, but i have 1 other problem with it tho.
Every time i use it it gives me a yellow skull and a regular battle sign (not pz) But it still heals me.
 
Code:
		<instant name="test" words="test" lvl="35" mana="10" prem="1" selftarget="1" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="healing/test.lua">
		<vocation id="3"/>
		<vocation id="7"/>
	</instant>

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onCastSpell(cid, var)
 healPercent(cid, 25)
	return doCombat(cid, combat, var)
end
 
Last edited:
Code:
local percent = 25

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_DISPEL, CONDITION_PARALYZE)
function onGetFormulaValues(cid, level, maglevel)
	local v = getCreatureMaxHealth(cid) * percent / 100
	return v, v
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

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