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

Level-Based Health Potion

Cornwallis

Member
Joined
Jan 3, 2010
Messages
480
Reaction score
16
Okey, I tried to edit my recently edited mana potion script <3, unfortunately it failed ;s most likely because it was made by me ):
Code:
local vocations = {3,4,7,8}  --Druid, sorc + promotion

function onUse(cid, item, fromPosition, itemEx, toPosition)
        if not isPlayer(itemEx.uid) then
                return doPlayerSendCancel(cid, 'You can only use this rune on players.')
        end
        if not(isInArray(vocations,getPlayerVocation(itemEx.uid)) and getPlayerLevel(itemEx.uid) >= 80) then
                return doCreatureSay(itemEx.uid, "Only snipers and crusaders of level 80 and above may use this potion.",TALKTYPE_ORANGE_1)
        end
        local level, mlevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
        local health_minimum = level * 2.2 + mlevel * 10.0 
        local health_maximum = level * 2.3 + mlevel * 10.0
        doPlayerAddHealth(itemEx.uid, math.random(health_minimum, health_maximum))
        doSendMagicEffect(toPosition, 12)
        doChangeTypeItem(item.uid, item.type - 1)
        return true
end

Also, if possible can someone add this somewhere in there and if possible, but not neccesary, make it happen 500 miliseconds after you use the item.
Code:
	local mana_minimum = level * 0.7 + mlevel * 3.0 
	local mana_maximum = level * 0.8 + mlevel * 4.0
	doPlayerAddMana(itemEx.uid, math.random(mana_minimum, mana_maximum))
	doSendMagicEffect(toPosition, 12)
 
It doesn't work, i dont think this exists: doPlayerAddHealth
I tried to do: doCreatureAddHealth and it just spams the wrong vocation or level message.
Edit; I changed doPlayerAddHealth(itemEx.uid, math.random(health_minimum, health_maximum))
to
doCreatureAddHealth(cid, math.random(health_minimum, health_maximum))
 
I'm trying to heal myself. Also, I don't want to heal other players either and i couldnt find doPlayerAddHealth in functions so i used that.
 
sorry for double post but if u want it to heal like that just use the ultimate healing rune and edit it.. LOL

REP++ me if i helped you!
 
make the potions a rune, use it in spells.xml and change it for the uh script. its just as simple?

then use this

LUA:
<rune name="Ultimate Health potion" id="XXXX" allowfaruse="0" charges="1" lvl="130" maglv="0" exhaustion="1400" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/ultimate health potion.lua"/>
 
I don't want this as a spell, is it that hard to understand?! I do know that if i wanted it to be a spell, and i do know that i could copy from the uh script, or make my own since i can spell script somewhat now. Please, only post if its an action and if this isnt possible, knights and paladins are shit out of luck.
 
This works fine for me :
LUA:
local vocations = {3,4,7,8}  --Druid, sorc + promotion
function addMana(cid,l,m)
	local mana_minimum = l * 0.7 + m * 3.0 
	local mana_maximum = l * 0.8 + m * 4.0
	doPlayerAddMana(cid, math.random(mana_minimum, mana_maximum))
	doSendMagicEffect(getThingPos(cid), 12)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if not isPlayer(itemEx.uid) then
                return doPlayerSendCancel(cid, 'You can only use this rune on players.')
        end
        if not isInArray(vocations,getPlayerVocation(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 80 then
                return doCreatureSay(itemEx.uid, "Only snipers and crusaders of level 80 and above may use this potion.",TALKTYPE_ORANGE_1)
        end
        local level, mlevel = getPlayerLevel(cid), getPlayerMagLevel(cid)
        local health_minimum = level * 2.2 + mlevel * 10.0 
        local health_maximum = level * 2.3 + mlevel * 10.0
        doCreatureAddHealth(itemEx.uid, math.random(health_minimum, health_maximum))
        doSendMagicEffect(toPosition, 12)
        doChangeTypeItem(item.uid, item.type - 1)
		addEvent(addMana,500,itemEx.uid,level,mlevel)
        return true
end
 
Last edited:
Back
Top