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

[Request]On player get level.

celinhoxp

Mrs. Strikeer
Joined
Sep 22, 2008
Messages
24
Reaction score
1
Location
Brazil
I want a creture event, that when someone upgrade a level get your life and your mana full.

For exemple:
I'm sorcerer, level 130 and I'm with 150/600hp and 1000/2100 mana, but when I get lvl 131 my mana and heath get at limit.

If someone can help me, post that script please;


/Bye
 
There you go:

Put this in creaturescripts/scripts/

advance.lua

PHP:
function onAdvance(cid, playerlevel, oldlevel, newlevel)

newMana 	= getCreatureMaxMana(cid) - getCreatureMana(cid)
newHealth 	= getCreatureMaxHealth(cid) - getCreatureHealth(cid)

	doCreatureAddMana(cid, newMana)
	doCreatureAddHealth(cid, newHealth)

end


In the file creaturescripts/scripts/login.lua add this line

PHP:
	registerCreatureEvent(cid, "PlayerAdvance")

after the line

PHP:
	registerCreatureEvent(cid, "PlayerDeath")


In the file creaturescripts/creaturescripts.xml add the line

PHP:
<event type="advance" name="PlayerAdvance" script="advance.lua"/>

after the line

PHP:
	<event type="death" name="PlayerDeath" script="playerdeath.lua"/>


IMPORTANT NOTE: This will refill your mana/hp on every advance including magic level and skills. I have no idea how to limit it only for the actual level. :/
 
Hey Oxious,
can you edit a mana potion script that will give you more mana as your level up. I mean that when you getting more levels the higher mana restore becomes plz i need this Ive been searching and i can't find it

Thanks in advance
 
@Oxious

That script will add mana/health with all advances (skills, levels, maglevels)

This is better...

Code:
[COLOR="Blue"]function onAdvance[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"],[/COLOR] skill[COLOR="SeaGreen"],[/COLOR] oldlevel[COLOR="SeaGreen"],[/COLOR] newlevel[COLOR="SeaGreen"])[/COLOR]

	[COLOR="SeaGreen"]if[/COLOR] skill [COLOR="SeaGreen"]==[/COLOR] 8 [COLOR="SeaGreen"]then[/COLOR]

	newMana [COLOR="SeaGreen"]=[/COLOR] getCreatureMaxMana[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"])[/COLOR] [COLOR="SeaGreen"]-[/COLOR] getCreatureMana[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"])[/COLOR]
	newHealth [COLOR="SeaGreen"]=[/COLOR] getCreatureMaxHealth[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"])[/COLOR] [COLOR="SeaGreen"]-[/COLOR] getCreatureHealth[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"])[/COLOR]

	doCreatureAddMana[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"],[/COLOR] newMana[COLOR="SeaGreen"])[/COLOR]
	doCreatureAddHealth[COLOR="SeaGreen"]([/COLOR]cid[COLOR="SeaGreen"],[/COLOR] newHealth[COLOR="SeaGreen"])[/COLOR]



	end
end[/COLOR]
 
Back
Top