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

Mana-Potions-On-ml-level

Menoxcide

New Member
Joined
Jan 5, 2012
Messages
57
Reaction score
0
Seen it but dont have a clue how its scripted a little help?

Examples:

a level 100 Sorcerer with ml 100 would be.

Min mana heal of 200 + (level) + (3*ml) = 600 mana heal.

level = 100
ml = 100*3 = 300
minimum heal of pot = 200
total = 600

is it possible?

i may be good at mapping, but scipting really isnt my game. i havnt a clue how to do this. all i can do is provide the potions script i use, and maybe someone to edit it?


Code:
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636
 
local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)
 
local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(itemEx.uid ~= cid or itemEx.itemid ~= 1) then
		return TRUE
	end
 
	if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end
 
	if(item.itemid == antidotePot) then
		if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == smallHealthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 60, 120, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == healthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 135, 285, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 100, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == strongHealthPot) then
		if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
 
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 280, 480, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == strongManaPot) then
		if(doTargetCombatMana(0, cid, 250, 390, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == greatSpiritPot) then
		if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
 
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 280, 520, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 240, 460, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == greatHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
 
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 570, 830, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == greatManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
 
		if(doTargetCombatMana(0, cid, 430, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	elseif(item.itemid == ultimateHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end
 
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 800, 1200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_2)
	end
	return TRUE
end
 
level = getPlayerLevel(cid)
ml = getPlayerMagic(cid)
health_min = 200 + (level) + (3*ml)
health_max = ?

math.ceil(math.random(health_min, health_max))
 
PHP:
local config = 
{ 
    healthMultiplier = 1.4, 
    manaMultiplier = 1.0 
} 

local RUNES = { 
    [0] = {hpMin = 500, hpMax = 10000, HPmultiLvl = 6.0, HPmultiMaglvl = 1.0, HPplus = 1000, hpValues = {0.8, 1.2}, -- HP RUNE 
              reqLevel = 250}, 
    [0] = {hpMin = 2000, hpMax = 25000, HPmultiLvl = 7.0, HPmultiMaglvl = 1.0, HPplus = 8000, hpValues = {0.8, 1.2}, -- SUPER HP RUNE 
              reqLevel = 1000}, 
    [2307] = {hpMin = 0, hpMax = 700000, HPmultiLvl = 2.0, HPmultiMaglvl = 1.2, HPplus = 100, hpValues = {1.2, 1.3}, -- DONATOR HP RUNE 
              reqLevel = 1}, 
    [0] = {-- MANA RUNE 
              mpMin = 1000, mpMax = 7000, MPmultiLvl = 4.0, MPmultiMaglvl = 5.0, MPplus = 300, manaValues = {0.8, 1.2}, 
              reqLevel = 250}, 
    [2282] = {-- SUPER MANA RUNE 
              mpMin = 0, mpMax = 20005550, MPmultiLvl = 1.2, MPmultiMaglvl = 1.3, MPplus = 100, manaValues = {0.8, 0.9}, 
              reqLevel = 8}, 
    [2270] = {-- SUPER MANA RUNE 
              mpMin = 0, mpMax = 20005550, MPmultiLvl = 1.3, MPmultiMaglvl = 1.5, MPplus = 100, manaValues = {1.3, 1.5}, 
              reqLevel = 200}, 
    [2284] = {-- DONATOR MANA RUNE 
              mpMin = 0, mpMax = 50000, MPmultiLvl = 1.5, MPmultiMaglvl = 1.5, MPplus = 100, manaValues = {1.5, 1.7},
              reqLevel = 8} 
} 

local exhaust = createConditionObject(CONDITION_EXHAUST) 
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 5000)) 
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(((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_RED) 
    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 
 
    return true 
end
Try credits to phowned
 
@up

but i mean, if you are lvl 100 and you heal 1000 gmana, and other lvl 200 hal 1500 of mana it's a example.... No like 5000 heals a lvl 100!???????????
 
Back
Top