• 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 Health and mana runes (few runes in one script)

PhoOwned

^_^
Joined
Nov 11, 2010
Messages
375
Reaction score
66
Based on potions script.
It's script with my server config [example]:
PHP:
local config =
{
	healthMultiplier = 1.4,
	manaMultiplier = 1.0
}

local RUNES = {
	[2275] = {hpMin = 500, hpMax = 10000, HPmultiLvl = 6.0, HPmultiMaglvl = 1.0, HPplus = 1000, hpValues = {0.8, 1.2}, -- HP RUNE
			  reqLevel = 250},
	[2276] = {hpMin = 2000, hpMax = 25000, HPmultiLvl = 7.0, HPmultiMaglvl = 1.0, HPplus = 8000, hpValues = {0.8, 1.2}, -- SUPER HP RUNE
			  reqLevel = 1000},
	[2284] = {hpMin = 100, hpMax = 70000, HPmultiLvl = 10.0, HPmultiMaglvl = 1.0, HPplus = 15000, hpValues = {0.8, 1.2}, -- DONATOR HP RUNE
			  reqLevel = 1},
	[2298] = {-- MANA RUNE
			  mpMin = 1000, mpMax = 7000, MPmultiLvl = 4.0, MPmultiMaglvl = 5.0, MPplus = 300, manaValues = {0.8, 1.2},
			  reqLevel = 250},
	[2299] = {-- SUPER MANA RUNE
			  mpMin = 7000, mpMax = 20000, MPmultiLvl = 6.0, MPmultiMaglvl = 10.0, MPplus = 1000, manaValues = {0.7, 1.6},
			  reqLevel = 1000},
	[2300] = {-- DONATOR MANA RUNE
			  mpMin = 10000, mpMax = 50000, MPmultiLvl = 8.0, MPmultiMaglvl = 15.0, MPplus = 100, manaValues = {0.6, 1.4},
			  reqLevel = 1}
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
setConditionParam(exhaust, CONDITION_PARAM_SUBID, EXHAUST_HEALING)	

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local rune = RUNES[item.itemid]
	if(not rune) then
		return false
	end

	if(hasCondition(cid, CONDITION_EXHAUST, EXHAUST_HEALING)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((rune.reqLevel and getPlayerLevel(cid) < rune.reqLevel) or (rune.vocations and not isInArray(rune.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
	then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Only players " .. (rune.reqLevel and (" of level " .. rune.reqLevel) or "") .. " or above may use this rune.")
		return true
	end

	if(rune.hpMin) then
		local health = getPlayerLevel(cid) * rune.HPmultiLvl + getPlayerMagLevel(cid) * rune.HPmultiMaglvl + rune.HPplus
		if(not doCreatureAddHealth(itemEx.uid, math.ceil(math.min(rune.hpMax, math.max(rune.hpMin, math.random(health * rune.hpValues[1], health * rune.hpValues[2]))) * config.healthMultiplier))) then
			return false
		end
	end

	if(rune.mpMin) then
		local mana = getPlayerLevel(cid) * rune.MPmultiLvl + getPlayerMagLevel(cid) * rune.MPmultiMaglvl + rune.MPplus
		if(not doPlayerAddMana(itemEx.uid, math.ceil(math.min(rune.mpMax, math.max(rune.mpMin, math.random(mana * rune.manaValues[1], mana * rune.manaValues[2]))) * config.manaMultiplier))) then
			return false
		end
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
		if(isPlayer(tid)) then
			doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
		end
	end

	doAddCondition(cid, exhaust)
	return true
end
PHP:
local config =
{
	healthMultiplier = 1.4,
	manaMultiplier = 1.0
}
It use multipliers when add HP/MANA, if for ex. hpMax = 10000 and healthMultiplier = 1.5 is can add up to 15000 health
------------------------------------
You can make config of rune that add HP and MANA, not only HP or MANA :cool:
 
Back
Top