• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Remove Health/Mana By Percentages for TFS

skrm

New Member
Joined
Mar 15, 2008
Messages
67
Reaction score
0
hey, i read this on another post, but it wont work because I dont have a global.lua in tfs 0.3+

Im supposed to put this in global.lua (which tfs 0.3 doesnt have)

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

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


So is there any way of making this work? thanks in advance.
 
If this doesn't work, try..
LUA:
function doPlayerAddManaPercent(cid, percent)
	local mana = getPlayerMaxMana(cid)
	return doPlayerAddMana(cid, ((mana / 100) * percent))
end

function doPlayerAddHealthPercent(cid, percent)
	local health = getCreatureMaxHealth(cid)
	return doCreatureAddHealth(cid, ((health / 100) * percent))
end

function doPlayerRemoveManaPercent(cid, percent)
	local mana = getPlayerMaxMana(cid)
	return doPlayerRemoveMana(cid, -((mana / 100) * percent))
end

function doPlayerRemoveHealthPercent(cid, percent)
	local health = getCreatureMaxHealth(cid)
	return doPlayerRemoveHealth(cid, -((health / 100) * percent))
end

function doPlayerRemoveHealth(cid, hp)
	return doCreatureAddHealth(cid, -hp)
end

function doPlayerRemoveMana(cid, mana)
	return doPlayerAddMana(cid, -mana)
end
 
Back
Top