• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Set character to the right hp/mana according to lvl/voc

newbieh

New Member
Joined
Dec 17, 2007
Messages
2
Reaction score
0
Hello!

I could really use some help setting my servers character to the right hp/mana for each lvl/voc!

The thing got bad from the beginning and now I'm looking for some hardcore pro to help me figure this out!


Thank you extremely much for your help!
 
Code:
function onLogin(cid)
	local level = getPlayerLevel(cid)
	local voc = getPlayerVocation(cid)
	local gains = {
		-- [voc id] = {health/lvl, mana/lvl}
		[1] = {20, 20},
		[2] = {20, 20},
		[3] = {20, 20},
		[4] = {20, 20},
		[5] = {20, 20},
		[6] = {20, 20},
		[7] = {20, 20},
		[8] = {20, 20}
	}

	if (gains[voc]) then
		setCreatureMaxHealth(cid, (gains[voc][1]*level))
		setCreatureMaxMana(cid, (gains[voc][2]*level))
	end

	return true
end
 
There is a formula por it Chojrak

For HP:
[level - 8] * (vocation ammount gain HP) + 185

For MP:
[level - 8] * (vocation ammount gain MP) + 35
 
Code:
function onLogin(cid)
	local level = getPlayerLevel(cid)
	local voc = getPlayerVocation(cid)
	local gains = {
		-- [voc id] = {health/lvl, mana/lvl}
		[1] = {20, 20},
		[2] = {20, 20},
		[3] = {20, 20},
		[4] = {20, 20},
		[5] = {20, 20},
		[6] = {20, 20},
		[7] = {20, 20},
		[8] = {20, 20}
	}

	if (gains[voc]) then
		setCreatureMaxHealth(cid, (gains[voc][1]*level))
		setCreatureMaxMana(cid, (gains[voc][2]*level))
	end

	return true
end


How do I execute this command? And does this work for all vocations etc?

Thank you very much! Everyone!
 
PHP:
UPDATE `players` /* Sorcerers and Druids */
SET `health` = `level` * 5 + 145, `healthmax` = `level` * 5 + 145, mana = `level` * 30 - 205, manamax = `level` * 30 - 205
WHERE `vocation` = "1" OR `vocation` = "5" OR `vocation` = "2" OR `vocation` = "6";

UPDATE `players` /* Paladins */
SET `health` = `level` * 10 + 105, `healthmax` = `level` * 10 + 105, mana = `level` * 15 - 85, manamax = `level` * 15 - 85
WHERE `vocation` = "3" OR `vocation` = "7";

UPDATE `players` /* Knights */
SET `health` = `level` * 15 + 65, `healthmax` = `level` * 15 + 65, mana = `level` * 5 - 5, manamax = `level` * 5 - 5
WHERE `vocation` = "4" OR `vocation` = "8";

There you go, a SQL query :)
 

Similar threads

Back
Top