• 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 ;/
 
No.
The player will use the spell, then the spell will attack the target, but the player who used the spell will lose hp.
If possible I'd like that the player who uses the spell could lose health based on his skills.
Like:
"If a knight has sword skill 10
He'll do 100 damage
And will lost 100 hp.

If a knight has sword skill 50
He'll do 500 damage
And will lost 50 hp. "

But if it's not possible I'd be happy if it just took hp, I fucking need it so much...
 
I don't think that is possible in spells but if you make a spell system with the use of talkactions then maybe it can be done, well that's just an idea someone with better lua skills than me can probably make it.
 
It's possible

I saw that on "Sinteria" like 8.0 client that when you wrote "Exevo gran mas death" It took all your HP and did SICK dmg

I'm sure any pro here could do that for you
 
This is defiantly possible with spells. From what I understand you want a spell that does damage to your target (like exori hur for example) and you want it to also do recoil dmg back to the caster. So the question is do you want manashield to affect the caster taking recoil dmg? If not then its simple, just use

Code:
doCreatureAddHealth(cid, health[, hitEffect[, hitColor[, force]]])

For example if you want to make it do a static 100 recoil dmg then you would put -100 for health however if you want it based off skills then you would put for example - the skill you want * a multiplier
 
This is defiantly possible with spells. From what I understand you want a spell that does damage to your target (like exori hur for example) and you want it to also do recoil dmg back to the caster. So the question is do you want manashield to affect the caster taking recoil dmg? If not then its simple, just use

Code:
doCreatureAddHealth(cid, health[, hitEffect[, hitColor[, force]]])

For example if you want to make it do a static 100 recoil dmg then you would put -100 for health however if you want it based off skills then you would put for example - the skill you want * a multiplier

I do beleive -Damage doesnt work anymore. But not positive on that.
 
This is defiantly possible with spells. From what I understand you want a spell that does damage to your target (like exori hur for example) and you want it to also do recoil dmg back to the caster. So the question is do you want manashield to affect the caster taking recoil dmg? If not then its simple, just use

Code:
doCreatureAddHealth(cid, health[, hitEffect[, hitColor[, force]]])

For example if you want to make it do a static 100 recoil dmg then you would put -100 for health however if you want it based off skills then you would put for example - the skill you want * a multiplier

Could u please put the code here? Like exori mort taking the ures's life off, or any other spell, but the full script? Taking 5000?
 
Here ...
You have to set the skills the script should check. It get the highest skill out of these then.

-->local skills = {SKILL_CLUB,SKILL_SWORD,SKILL_AXE}

Also set the damage formulas:
local formula = {skill*10,skill*5}
First is the damage the target is hit with and second is the damage the player himself gets.
Code:
local function skill(cid)
	local skills = {SKILL_CLUB,SKILL_SWORD,SKILL_AXE}
	table.sort(skills, function(a,b) return getPlayerSkill(cid,a)>getPlayerSkill(cid,b)  end)
	return getPlayerSkill(cid,skills[1])
end


function onCastSpell(cid, var)
	local skill, target = skill(cid),variantToNumber(var)
	local formula = {skill*10,skill*5}
	if target == 0 then
		return doPlayerSendCancel(cid,"You need a target to cast this spell.")
	end
	if not (getCreatureHealth(cid) > formula[2]) then
		return doPlayerSendCancel(cid,"You do not have enough hit points to cast this spell.")
	end
	doAreaCombatHealth(0, COMBAT_DEATHDAMAGE, getCreaturePosition(cid), 0, -formula[2], -formula[2], CONST_ME_MORTAREA)
	doAreaCombatHealth(cid, COMBAT_DEATHDAMAGE, getCreaturePosition(target), 0, -formula[1], -formula[1], CONST_ME_MORTAREA)
	return true
end

In spells.xml something like that:
Code:
	<instant name="Wound" words="exori som" lvl="50" mana="0" prem="0" range="3" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="wound.lua">
		<vocation id="1"/>
	</instant>
 
It didn't work...
Didn't take off player's health or even made damage to the target...
It said it needed a target, but it already had.
 
Try with this in spells.xml.

Code:
	<instant name="Wounded" words="exori som" lvl="50" mana="0" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/som.lua">
		<vocation id="1"/>
		<vocation id="2"/>
	</instant>
 
Now it worked! Thank you so much! REP+!
Can u edit the script just one more time? I don't want this spell based on skills anymore. I want that it takes 90% of the user's hp and 70% of the target's. And I think this isn't possible, but when the user's hp is lesser than 3000, he will die using the spell.
 
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
 
Back
Top