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

Full HP and MP when level up

kokokoko

Veteran OT User
Joined
Feb 4, 2008
Messages
921
Reaction score
257
--------------------FOR TFS 0.3.5-------------------
---If you want it for 0.3.4, check the post by JBD on page 2---



When you get a level advance, your HP and MP gets full. It's very simple, but still cool :p

creaturescripts/scripts, name the file levelUp.lua
Paste this:
Code:
function onAdvance(cid, skill, oldlevel, newlevel)

        if skill == SKILL__LEVEL then
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
	doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
		end
   return TRUE
end

creaturescripts/creaturescripts.xml
Add this:
Code:
	<event type="advance" name="levelUp" event="script" value="levelUp.lua"/>

And at the bottom of login.lua, add this:
Code:
	registerCreatureEvent(cid, "levelUp")

:wub:
 
Last edited:
it will work with ANY advance ;) for level only:

Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
	if skill == SKILL__LEVEL then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid))
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
	end
return true
end
 
Copy?

Original Thread:
http://otland.net/f16/easy-script-doesnt-work-46016/

JDB said:
script.lua
Lua:
function onAdvance(cid, newLevel)
local playerPos = getCreaturePosition(cid)
    if newLevel == SKILL__LEVEL then
        doSendMagicEffect(playerPos, CONST_ME_BIGCLOUDS)
        doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
        doCreatureAddMana(cid, getCreatureMaxMana(cid))
    end
    return TRUE
end

login.lua
PHP:
registerCreatureEvent(cid, "NewLevel")

creaturescripts.xml
PHP:
<event type="advance" name="NewLevel" script="script.lua"/>
 
Awesome, thanks guys.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Ookay.. I just tried it myself, and it didn't work. After skinning it till i had only this left, it still didn't work:

Code:
function onAdvance(cid, skill, oldlevel, newlevel)
            doPlayerSendTextMessage(cid, 22, "You have been promoted to.")
    return TRUE
end

Code:
<event type="advance" name="levelUp" script="levelUp.lua"/>

Doesn't creaturescripts work in TFS 0.3.5? Or am i just being stupid? Maybe the XML has changed. Has it?

Edit: Nvm.. LOL

Fix in first post.
 
Back
Top