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

CreatureEvent Update Automatic Currently Health/Mana

Printer

if Printer then print("LUA") end
Senator
Premium User
Joined
Dec 27, 2009
Messages
5,782
Solutions
31
Reaction score
2,286
Location
Sweden?
I saw this script by this guy: http://otland.net/f81/max-mana-hp-171712/#post1668876, so i thougt about upgrade it bit better script :p, I recommend only use this one high exp servers!

Simpely what this script do, its show your currently and max health & mana. It updates how many seconds you configure it.

Tested on tfs 0.3.6

OtTixZ.png


Tfs: 0.3.6 & 0.2
Goto creaturescripts/creaturescripts.xml and add this line:
Lua:
<event type="login" name="UpdateMH" event="script" value="updatemh.lua"/>

Goto creaturescripts/scripts and create new lua and name it "updatemh.lua" and paste this script below:
Lua:
--///True = 0.3///-- & --///False = 0.2///--
local tfs_version = true
local otswe_updatetime = 3 -- Seconds

function updateMH(cid) 
    if isPlayer(cid) then
                update = addEvent(updateMH, otswe_updatetime*1000, cid)
    end
    if tfs_version == true then
		doPlayerSendCancel(cid, "Your Currently Health Is: "..getCreatureHealth(cid).."/"..getCreatureMaxHealth(cid).." And Your Currently Mana Is: "..getCreatureMana(cid).."/"..getCreatureMaxMana(cid)..".")
		else
		doPlayerSendCancel(cid, "Your Currently Health Is: "..getPlayerHealth(cid).."/"..getPlayerMaxHealth(cid).." And Your Currently Mana Is: "..getPlayerMana(cid).."/"..getPlayerMaxMana(cid)..".")
		end
	return true
end

function onLogin(cid)
	if isPlayer(cid) then
		update = addEvent(updateMH, 1*1, cid)
		return true
	end
end
 
function onLogout(cid)
	if isPlayer(cid) then
		stopEvent(update)
		return true
	end
end
 
Last edited:
I think it's possible to make like this to for 0.2:
Go to global.lua or /libs and just choose one of the files there and add this at the top or the bottom:

Lua:
getCreatureHealth = getPlayerHealth
getCreatureMaxHealth = getPlayerMaxHealth
getCreatureMana = getPlayerMana
getCreatureMaxMana = getPlayerMaxMana

I've never tried this but this should work aswell.
 
Thanks fixed :p I thougt the getCreatureHealth would work.
 
Edit: Didn't notice the change at first but anyway.

Why make two scripts when you can have one for both versions?

Lua:
local health = getCreatureHealth or getPlayerHealth;
".. health(cid).."
 
Last edited:
Up ok!
 
Last edited:
bump merged for both versions. Didnt test but it should work.
 
Nice idea on how to handle this problem :)
the idea Ninja said is a good one, that way you won't need the tfs_version variable
 
I know darling, but trying to be creative ^^
 
Back
Top