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

Lua How do i make an new mana potion

sirspray

New Member
Joined
Dec 15, 2012
Messages
93
Reaction score
2
Location
Sweden
[2007] = {empty = 2007, splash = 7, mana = {900, 1200}, level = 150, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- super mana potion

i have put this im here but how do i make so it heals mana? when i use it is say Gulp. i have checkted actions.xml and it is there when i remove it it just say u cant use this obeject!

Sorry for bad english :s
 
Code:
local pots = {
    [2007] = {empty = 2007, splash = 7, mana = {900, 1200}, level = 150, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = pots[item.itemid]
    if tmp then
        local rand = math.random(tmp.mana[1], tmp.mana[2])
        if isPlayer(itemEx.uid) then
            if not isInArray(tmp.vocations, getPlayerVocation(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'This potion may only be used by ' .. vocStr)
                return true
            end
            if not getPlayerLevel(cid) >= tmp.level then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need to be level ' .. tmp.level .. ' to use this potion.')
                return true
            end
            doCreatureSay(cid, 'Gulp.', TALKTYPE_MONSTER)
            doCreatureAddMana(cid, rand)
            doSendAnimatedText(cid, '+ ' .. rand, TALKTYPE_LIGHTBLUE)
            doSendMagicEffect(getCreaturePosition(cid), tmp.splash)
            doTransformItem(item.uid, tmp.empty)
        end
    end
    return true
end
 
Code:
local pots = {
    [2007] = {empty = 2007, splash = 7, mana = {900, 1200}, level = 150, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local tmp = pots[item.itemid]
    if tmp then
        local rand = math.random(tmp.mana[1], tmp.mana[2])
        if isPlayer(itemEx.uid) then
            if not isInArray(tmp.vocations, getPlayerVocation(cid)) then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'This potion may only be used by ' .. vocStr)
                return true
            end
            if not getPlayerLevel(cid) >= tmp.level then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You need to be level ' .. tmp.level .. ' to use this potion.')
                return true
            end
            doCreatureSay(cid, 'Gulp.', TALKTYPE_MONSTER)
            doCreatureAddMana(cid, rand)
            doSendAnimatedText(cid, '+ ' .. rand, TALKTYPE_LIGHTBLUE)
            doSendMagicEffect(getCreaturePosition(cid), tmp.splash)
            doTransformItem(item.uid, tmp.empty)
        end
    end
    return true
end
Where im gonna put this?
 
Back
Top