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

Action One potion for all voc. Mp/Hp depends on level and vocation.

Shadowman321

Member
Joined
Mar 27, 2010
Messages
205
Reaction score
22
Code:
amount = {
-- [vocation] = {minmp, maxmp, minhp, maxhp}, (it will be multiplied by player level)
	[1] = {3, 3.5, 0, 0}, 
	[2] = {3, 3.5, 0, 0},
	[3] = {1,1.2, 2, 2.2},
	[4] = {0, 0, 5, 7},
	[5] = {3, 3.5, 0, 0},
	[6] = {3, 3.5, 0, 0},
	[7] = {1,1.2, 2, 2.2},
	[8] = {0, 0, 5, 7}
}

function onUse(cid, item, itemEx)
local lv = getPlayerLevel(cid)
local conf = {
	v = amount[getPlayerVocation(cid)],
	voc = getPlayerVocation(cid),
	level = 180 -- min level
}

	if getPlayerLevel(cid) >= conf.level then
			doCreatureAddMana(cid, math.random((lv*conf.v[1]),(lv*conf.v[2])))
			doCreatureAddHealth(cid, math.random((lv*conf.v[3]),(lv*conf.v[4])))
			doCreatureSay(cid, "Aaaah... ", TALKTYPE_ORANGE_1)
			doSendMagicEffect(getPlayerPosition(cid), 12)
	else
		doPlayerSendTextMessage(cid, 22, "Only players above " .. conf.level .. " level can drink this potion.")
	end
end

Simply config.
Health and mana depends on vocation and level. You can simply exclude level dependence by removing "lv*" on lines where script add mana and health. And you can change min lvl to use potion. At last but not least, you can just change "local lv = getPlayerLevel(cid)" to "local lv = getPlayerSkill(cid, skillid)". And then mp/hp will depends on skill or magic level not on level.
 
Back
Top Bottom