• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Full HP/Mana each level

Dilio

Owner of Project Thala
Joined
Jun 8, 2008
Messages
188
Reaction score
7
Location
London, Ontario
All credit still goes to Kokokoko for the idea, and I'm sure I'm not the first to figure this out, but I figured out a simple alternative for full hp and mana at a level up.

Anyways, go to player.cpp and find:
Code:
		healthMax += vocation->getGain(GAIN_HEALTH);
Next highlight that up to:
Code:
		capacity += vocation->getGainCap();
Now, just replace that with:
Code:
		healthMax += vocation->getGain(GAIN_HEALTH);
		health = healthMax;
		manaMax += vocation->getGain(GAIN_MANA);
		mana = manaMax;
		capacity += vocation->getGainCap();
For people who are a bit more advanced, all you're doing is changing:
Code:
          health += vocation->getGain(GAIN_HEALTH);
to:
Code:
		health = healthMax;
and:
Code:
		mana += vocation->getGain(GAIN_MANA);
to:
Code:
		mana = manaMax;

As I said, the idea was Kokokoko's, but with his script, it debugged my server for some strange reason. So... yep.
 
This can be done on Lua. Why write it in C++ when it can be done easier and more flexible?
 
If you actually read what I said, it explained why I hard coded it... I also put a link to Kokokoko's LUA script. But, since you dun know how to read before posting, I'll just retype it out.

In lua, doCreatureAddHealth debugs my server, so, I hard coded it.

Just in case you missed ^^^^ again, here's an even simpler explanation.

doCreatureAddHealth = Debug for me.

Jesus, read before posting something already explained.
 
If you actually read what I said, it explained why I hard coded it... I also put a link to Kokokoko's LUA script. But, since you dun know how to read before posting, I'll just retype it out.

In lua, doCreatureAddHealth debugs my server, so, I hard coded it.

Just in case you missed ^^^^ again, here's an even simpler explanation.

doCreatureAddHealth = Debug for me.

Jesus, read before posting something already explained.

then your server doesn't support the creature event.. in some way...

in that way you can create a another type of script which will still fill you hp/mana to max in a advance...
 
then your server doesn't support the creature event.. in some way...

in that way you can create a another type of script which will still fill you hp/mana to max in a advance...

I have 0.3.5pl1 which is what Kokokoko's script was made for, and near everything but the doCreatureAddHealth(cid, amount) works. Also, with my hardcoding, you're changing like 4 words. I'm sure that's just as, if not easier then LUA'ing it. 4 words = doCreatureAddHealth, then you have the rest of the coding. ._.

Just to get everyone off my back about LUA:

Lua:
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
Credits to Kokokoko, full script on how to use can be found: Kokokoko's Full HP and MP levelup.

Nice code :p

Thank you very much, at least someone understood what I was getting at. :3



Now. Enough about LUA people, jeeze. ._. If you dun like the script, or are using LUA, kudos, that's your choice. I put up the hard coding, because it's what sets the Mana and Health on level up, so it makes the most sense that it wouldn't add any lag whatsoever. But, like I said, you want to use LUA, enjoy LUA. If you want to hard code, enjoy. :3
 
@Dilo:
Nope, it was to SyntheticX cause he's insulting me.
 
Code:
const SpectatorVec& list = getSpectators(getPosition());
addAnimatedText(list, getPosition(), TEXTCOLOR_RED, "Level up!");
 
lol i hate u guys XD when u submit all scripts then no server will be uniqe :eek: all will be same cuz all noobs have the scripts >_<'
 
lol i hate u guys XD when u submit all scripts then no server will be uniqe :eek: all will be same cuz all noobs have the scripts >_<'

I actually have tons of unique scripts that haven't been released and no other servers have em. :3 Might end up releasing them if my mapper doesn't gimme the maps soon so we can launch.
 
Back
Top