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

Require a spell

Mooosie

mistofdeath.com
Premium User
Joined
Aug 2, 2008
Messages
739
Solutions
2
Reaction score
50
Location
Sweden
I want a spell who hits if the player/creature has 8% hp left. When the player casts the spell he hits 8% of the players/creatures health.

I really need it! Thx rep!!
 
Code:
function onCastSpell(cid, var)
local damage = (getCreatureMaxHealth(variantToNumber(var))*8/100)
if (variantToNumber(var)) ~= nil then
doTargetCombatHealth(cid, variantToNumber(var), COMBAT_ENERGYDAMAGE, - damage, - damage, CONST_ME_NONE)
end
return true
end

D: Try something like this. It probably wont work tho, as I made it only to stop ur bump :O
U can still try tho =D
 
Last edited:
Thanx, it is working, but it is hitting 8% of the player/creature whole the time. Can you do so, if they not got 8% return false? i cant figure that out.
 
@up
more explained:

I am a player, i say the word for the spell. - If i the target get 8% hp, then kill it, else just say cancel, like "Your target have'nt 8% hp." -

Thx cykotitan, ;)
 
maybe a function like this after onCastSpell???:
if ((getCreatureHealth(variantToNumber(var)) <= (getCreatureMaxHealth(variantToNumber(var))*8/100))

It's an idea.... idk how to make spells :P
 
Code:
function onCastSpell(cid, var)
local hp = (getCreatureMaxHealth(variantToNumber(var))*8/100)
local damage = (getCreatureHealth(variantToNumber(var)))
if (variantToNumber(var)) ~= nil then
if getCreatureHealth(variantToNumber(var) =< hp then
doTargetCombatHealth(cid, variantToNumber(var), COMBAT_ENERGYDAMAGE, - damage, - damage, CONST_ME_NONE)
end
end
return true
end

D:

Fixed lil bug
 
Last edited:
Back
Top