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

Help! On spell base on health % being used

krankthefunk

New Member
Joined
Jan 7, 2008
Messages
127
Reaction score
2
Hi want to know how to make a spell that let's say you have 1000 Hp,
And the spell uses 5% of your health, so it has a base damage + 5% of your health are being converted into damage, but it drain 5% of your health while being used. How would this be done?

Thanks!
 
in spells.xml set mana to whatever you like.
but in spell script (in lua) use something like that:
Lua:
function onCastSpell(cid, var)

local cPos = getCreaturePosition(getCreatureTarget(cid))

local hp = getPlayerMaxHealth(cid)
local basedmg = 200
local hppercent = 5
local totaldmg = basedmg+(hp/100)*hppercent

if hp > (hp/100)*hppercent then
	doSendDistanceShoot(getCreaturePosition(cid), cPos, CONST_ANI_FIRE)
	doTargetCombatHealth(cid, getCreatureTarget(cid), COMBAT_FIREDAMAGE, -totaldmg, -totaldmg, CONST_ME_FIREAREA)
	doPlayerAddHealth(cid, -(hp/100)*hppercent)
else
return false
end
return true
end
 
Back
Top