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

Suicide spell

goleto

New Member
Joined
May 8, 2010
Messages
10
Reaction score
0
I'd like to know how to do a spell takes off the user's health instead of his mana, is there any way? Can anyone please put here a full script? I want something like an attack spell, like exori or whatever, that takes off the user's health. Sry fot the bad English ;/
 
can you do it for selftarget? (no needing target)
because when you change it to selftarget in spells.xml damage works different
 
like this
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

AoE spell.. like gran mas frigo, gran mas flam, exori, etc.
 
kk here ;U
Same part in spells.xml
and this in lua file:
Code:
local config = {
	damage = {70,90},   --Health in percent 1 is target 2 is user
	die = 3000,          --User dies if less than that -> 0 and player never dies
	canKill = true
}

function onCastSpell(cid, var)
	local target = variantToNumber(var)
	if target == 0 then
		return doPlayerSendCancel(cid,"You need a target to cast this spell.") and doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
	end
	local x = config.canKill and math.ceil or math.floor
	local h = {getCreatureHealth(target),getCreatureHealth(cid)}
	local d = {x(h[1]*config.damage[1]/100),h[2] <= config.die and h[2] or x(h[2]*config.damage[2]/100)}
	doAreaCombatHealth(0, COMBAT_DEATHDAMAGE, getCreaturePosition(cid), 0, -d[2], -d[2], CONST_ME_MORTAREA)
	doAreaCombatHealth(cid, COMBAT_DEATHDAMAGE, getCreaturePosition(target), 0, -d[1], -d[1], CONST_ME_MORTAREA)
	return true
end

There is a small config:

damage = {70,90}
=> 70% of hp for target, 90% for caster
die = 3000
=> Player dies if less than that - if it is 0 there is no limit
canKill = true
=> Wheater the spell should kill or not if you set it to false the target/caster will not die, they will stay at 1 hp

Thank you so much, now it's fucking perfect!!!
 
Back
Top