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

Lua Great mana potion custom script

Bntz

Dprethor!
Joined
Mar 16, 2009
Messages
101
Reaction score
1
Location
México
Hi!

i make some great mana potios scripts and don't work

im use TFS 1.0

i dont know where is the error :c

Script 1:

Code:
local greatManaPot = 7590
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
 
    end
    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

if item.itemid == greatManaPot then
    end
if (getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 49) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doPlayerAddMana(cid, 200)
    player:addCondition(exhaust)
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 99) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doPlayerAddMana(cid, 400)
    player:addCondition(exhaust)
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
elseif (getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 1000) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doPlayerAddMana(cid, 700)
    player:addCondition(exhaust)
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    end
    end


SCRIPT 2

Code:
local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
if (getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 49) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
    doCreatureAddHealth(cid,200)
 
elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 99) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
    doCreatureAddHealth(cid,400)
 
elseif (getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 199) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
    doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
    doCreatureAddHealth(cid,700)

end
end



for first script i'm use: [TFS 1.0] LUA Functions
 
Script 1
Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end
    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if (getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 49) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doPlayerAddMana(cid, 200)
    elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 99) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doPlayerAddMana(cid, 400)
    elseif (getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 1000) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doPlayerAddMana(cid, 700)
    end
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    player:addCondition(exhaust)
    return true -- you forgot return true
end

Script 2
Code:
local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    if (getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 49) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
        doCreatureAddHealth(cid,200)
    elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 99) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
        doCreatureAddHealth(cid,400)
    elseif (getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 199) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doSendAnimatedText(getPlayerPosition(cid), "Ahhhh...!", TEXTCOLOR_ORANGE)
        doCreatureAddHealth(cid,700)
    end
    return true -- you forgot return true
end
 
Last edited:
Thanks for responding man ! still not working does not increase mana just says "Ahhhh...!" on script 1 :c

and script 2 dont's works

also try with:

if not doTargetCombatMana(0, cid, 400, CONST_ME_MAGIC_BLUE) then
return false
end

And doesn't work

and:

Code:
if (getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 49) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doTargetCombatMana(0, cid, 200, CONST_ME_MAGIC_BLUE)
    elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 99) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doTargetCombatMana(0, cid, 400, CONST_ME_MAGIC_BLUE)
    elseif (getPlayerLevel(cid) >= 100 and getPlayerLevel(cid) <= 1000) and (getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
        doTargetCombatMana(0, cid, 700, CONST_ME_MAGIC_BLUE)
    end
 
Last edited:
Script 1
Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function addMana(cid, vocation, min, max, amount)
    if vocation == 4 or vocation == 8 then
        if getPlayerLevel(cid) > min and getPlayerLevel(cid) <= max then
            doPlayerAddMana(cid, amount)
            return true
        end
    end
    return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local v = getPlayerVocation(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if addMana(cid, v, 1, 49, 200) or addMana(cid, v, 50, 99, 400) or addMana(cid, v, 100, 1000, 700) then
        player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        player:addCondition(exhaust)
    else
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry not possible.")
        return false
    end
    return true
end

Script 2
Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function addHealth(cid, vocation, min, max, amount)
    if vocation == 4 or vocation == 8 then
        if getPlayerLevel(cid) > min and getPlayerLevel(cid) <= max then
            doCreatureAddHealth(cid, amount)
            return true
        end
    end
    return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local v = getPlayerVocation(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if addHealth(cid, v, 1, 49, 200) or addHealth(cid, v, 50, 99, 400) or addHealth(cid, v, 100, 199, 700) then
        player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        player:addCondition(exhaust)
    else
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry not possible.")
        return false
    end
    return true
end
 
Last edited:
Script 1
Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function addMana(cid, vocation, min, max, amount)
    if vocation == 4 or vocation == 8 then
        if getPlayerLevel(cid) > min and getPlayerLevel(cid) <= max then
            doPlayerAddMana(cid, amount)
            return true
        end
    end
    return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local v = getPlayerVocation(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if addMana(cid, v, 1, 49, 200) or addMana(cid, v, 50, 99, 400) or addMana(cid, v, 100, 1000, 700) then
        player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        player:addCondition(exhaust)
    else
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry not possible.")
        return false
    end
    return true
end

Script 2
Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function addHealth(cid, vocation, min, max, amount)
    if vocation == 4 or vocation == 8 then
        if getPlayerLevel(cid) > min and getPlayerLevel(cid) <= max then
            doCreatureAddHealth(cid, amount)
            return true
        end
    end
    return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    local player = Player(cid)
    local v = getPlayerVocation(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if addHealth(cid, v, 1, 49, 200) or addHealth(cid, v, 50, 99, 400) or addHealth(cid, v, 100, 199, 700) then
        player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
        player:addCondition(exhaust)
    else
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Sorry not possible.")
        return false
    end
    return true
end
you are using meta lua and old lua
 
Look: i make it and wotks

Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end
    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if(not isInArray({1,2,5,6}, player:getVocation():getId()) or player:getLevel() >= 1 and player:getLevel() <= 100) and not(player:getGroup():getId() >= 2) then
        if not doTargetCombatMana(0, cid, 150, 250, CONST_ME_MAGIC_BLUE) then
            return false
        end
        end
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    player:addCondition(exhaust)
    return true
end
but as I add more level ranges?

only need add elseif?

Code:
elseif(not isInArray({1,2,5,6}, player:getVocation():getId()) or player:getLevel() >= 101 and player:getLevel() < 200) and not(player:getGroup():getId() >= 2) then
if not doTargetCombatMana(0, cid, 250, 350, CONST_ME_MAGIC_BLUE) then
return false
end
 
Look: it wotks

Code:
local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition, isHotkey)
    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end
    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end
    if(not isInArray({1,2,5,6}, player:getVocation():getId()) or player:getLevel() >= 1 and player:getLevel() <= 100) and not(player:getGroup():getId() >= 2) then
        if not doTargetCombatMana(0, cid, 150, 250, CONST_ME_MAGIC_BLUE) then
            return false
        end
        end
    player:say("Aaaah...", TALKTYPE_MONSTER_SAY)
    player:addCondition(exhaust)
    return true
end
but as I add more level ranges?

only need add elseif?

Code:
elseif(not isInArray({1,2,5,6}, player:getVocation():getId()) or player:getLevel() >= 101 and player:getLevel() < 200) and not(player:getGroup():getId() >= 2) then
if not doTargetCombatMana(0, cid, 150, 250, CONST_ME_MAGIC_BLUE) then
return false
end
use loops
 
Back
Top