• 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/mana on lvl up

Cyro

Intermediate OT User
Joined
May 24, 2011
Messages
1,293
Reaction score
110
Location
Egypt
function: when you up level your mana and life is full, equal to the global


create a file with name fullmh.lua

Code:
function onAdvance(cid, skill, oldlevel, newlevel)
                  if skill == SKILL__LEVEL then
                   doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
                doCreatureAddMana(cid, getCreatureMaxMana(cid))
   end
return true
end

register login.lua

Code:
registerCreatureEvent(cid, "fullmh")

and add creaturescript.xml

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

Credits to Skydanger the real author of the script.
 
use this :) FULL MANA AND HP ON SKILL A AND LVL ADVANCED, MORE SAVE PLAYER

Lua:
local config = {
    savePlayersOnAdvance = true
}

local skills = {
	SKILL_CLUB, SKILL_SWORD,
	SKILL_AXE, SKILL_DISTANCE, SKILL_SHIELD,
	SKILL__LEVEL, SKILL__MAGLEVEL
}
 
function onAdvance(cid, skill, oldLevel, newLevel)
	if(isInArray(skills, skill)) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
		doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
		return true
	end

    if(config.savePlayersOnAdvance) then
        doPlayerSave(cid, true)
    end

    return true
end

and put this in your login.lua

Lua:
registerCreatureEvent(cid, "lvlup")
 
Am not requesting am releasing it :) and for me hp/mana on skill is useless :p
 
Where i can add it create a file with name fullmh.lua

Code:

function onAdvance(cid, skill, oldlevel, newlevel)
if skill == SKILL__LEVEL then
doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))
end
return true
end

?
 
I prefere change advance save system, without change any login.lua / creaturescipts.xml

There is my script if anyone need it, i made it to own needs, but its simple and useful.

Lua:
local config = {
	savePlayersOnAdvance = true 
}

function onAdvance(cid, skill, oldLevel, newLevel)
	if(config.savePlayersOnAdvance) then
		doPlayerSave(cid, true)
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid)) 
		doCreatureAddMana(cid, getPlayerMaxMana(cid)-getPlayerMana(cid)) 
	end
	
local pos = getPlayerPosition(cid) 
local effectPositions = { 
{x = pos.x, y = pos.y - 1, z = pos.z}, 
{x = pos.x, y = pos.y + 1, z = pos.z}, 
{x = pos.x - 1, y = pos.y, z = pos.z}, 
{x = pos.x + 1, y = pos.y, z = pos.z}
}
    for _, ePos in ipairs(effectPositions) do 
		doSendMagicEffect(ePos, CONST_ME_HOLYAREA) 	
		doSendAnimatedText(getThingPos(cid), "Gratz!" , 70) 	
        end 
	return true
end
 
Back
Top