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

Remove Health/Mana By Percentages for TFS

Zeriikler

New Member
Joined
Apr 14, 2008
Messages
31
Reaction score
0
Well let me start off by saying.. Credits to Evil Hero.
But i just made these work with TFS

So paste this inside your global.lua

Code:
--Remove health/mana by percentages: Evil Hero(Zeriikler:Changed few things)
function doPlayerAddManaPercent(cid, percent)
local mana = getPlayerMaxMana(cid)
doPlayerAddMana(cid, (mana / 100) * percent)
return TRUE
end
function doPlayerAddHealthPercent(cid, percent)
local health = getCreatureMaxHealth(cid)
doCreatureAddHealth(cid, (health / 100) * percent)
return TRUE
end
function doPlayerRemoveManaPercent(cid, percent)
local mana = getPlayerMaxMana(cid)
doPlayerRemoveMana(cid, (mana / 100) * percent)
return TRUE
end
function doPlayerRemoveHealthPercent(cid, percent)
local health = getCreatureMaxHealth(cid)
doPlayerRemoveHealth(cid, (health / 100) * percent)
return TRUE
end
--Remove HP/MANA
function doPlayerRemoveHealth(cid, hp)
doCreatureAddHealth(cid, -hp)
return TRUE
end
function doPlayerRemoveMana(cid, mana)
doPlayerAddMana(cid, -mana)
return TRUE
end

Example of use.
Code:
function onStepIn(cid, item, pos)
if item.actionid == 1029 then
doRemoveHealthPercent(cid,85)
doRemoveManaPercent(cid,85)
end
return 1
end

:)
 
if I put a minus (-) do the script will add percentage? because am too lazy for changing scripts XD
 
If I add this to a rune, and use the rune on a player, will it drain his health, or mine? :p

Also would be nasty with a rune that deals x% hp of the creatures remaining hp

etc you use this on a player with 200 hp
it drains 20% hp
first attack: -40 hp (160)
second attack: -32 hp (128)
third attack: -26 hp (102)
fourth attack: -21 hp (81)
fifth attack: -17 hp (64)

and so on... :p
 
Dear Zeriikler,

When i saw ths script i tought that it was amazing, ofcourse i like to test/exploid bugs in scripts and i have encountered a crash bug. When 2 monsters combo attack (small change) that remove -99% of health the server will crash.
 
@Topic:
Instead of doPlayerRemoveManaPercent(cid, 100), why not use doPlayerAddManaPercent(cid, -100).
2 less functions to copy ;)

Code:
--Remove health/mana by percentages: Evil Hero(Zeriikler:Changed few things)
function doPlayerAddManaPercent(cid, percent)		doPlayerAddMana(cid, (percent*getPlayerMaxMana(cid))/100)			end
function doPlayerAddHealthPercent(cid, percent)		doCreatureAddHealth(cid, (percent*getCreatureMaxHealth(cid))/100)	end
function doPlayerRemoveManaPercent(cid, percent)	doPlayerAddManaPercent(cid, -percent)								end
function doPlayerRemoveHealthPercent(cid, percent)	doPlayerAddHealthPercent(cid, -percent)								end

If I add this to a rune, and use the rune on a player, will it drain his health, or mine? :p

Also would be nasty with a rune that deals x% hp of the creatures remaining hp

etc you use this on a player with 200 hp
it drains 20% hp
first attack: -40 hp (160)
second attack: -32 hp (128)
third attack: -26 hp (102)
fourth attack: -21 hp (81)
fifth attack: -17 hp (64)

and so on... :p
Doesn't that mean that player will never die?

Dear Zeriikler,

When i saw ths script i tought that it was amazing, ofcourse i like to test/exploid bugs in scripts and i have encountered a crash bug. When 2 monsters combo attack (small change) that remove -99% of health the server will crash.

That's odd. It shouldn't do that. If it does, it's not a bug in the script, but more a bug in the OTServ itself.
 
Last edited:
There is no global.lua in new TFS
can someone help me fix this script for 0.3 TFS plx!!
 
Back
Top