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

TFS 1.X+ Strenghthening potions custom

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
922
Location
Chile
hello guys, i have been trying to edit a file, and i wanted to add a text when the potion is used, so i did the lines, but when i put them, i see the text but the potion isn't consumed, and if i remove the lines, the potion is consumed and ofc no text...
i tried every possible modification but i cant get it working

some caritative soul that could help me fix this mess??
also i tried this
Code:
if item.itemid == 7440 || 29512 then
but seems that doesnt work here, how would it be done?


LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end
   
   
   

    if item.itemid == 7440 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        end
        else
    end
    if item.itemid == 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        end
        else
    end
   
   
    if item.itemid == 29512 then
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
            return true
    end
   
    if item.itemid == 29511 then
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
            return true
    end
   
   
   



    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end
 
Solution
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)...
or instead of ||
what text are you trying to add? it also looks like you're adding else for no reason
 
or instead of ||
what text are you trying to add? it also looks like you're adding else for no reason
damn right i forgot to erase that else, something i tried before
i want that when 29512 and 29511 are used, they get a message like "Skills up! and also put those into the restriction of vocations, 29512 only for mages and 29511 for palys and knights, but i cant do it right :S

last version!

LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end
   
   
   

    if item.itemid == 7440 or 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        end
        end
       
    if item.itemid == 29511 then
    if player:isMage() then
            player:say('Only paladin and knights may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
    end
    end
   
   
    if item.itemid == 29512 then
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
            return true
    end
   
    if item.itemid == 29511 then
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
            return true
    end
   


    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end
 
Last edited:
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if item.itemid == 7440 or 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
        end
    elseif item.itemid == 29511 then
        if player:isMage() then
            player:say('Only paladin and knights may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
        end
    end
    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end
 
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if item.itemid == 7440 or 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
        end
    elseif item.itemid == 29511 then
        if player:isMage() then
            player:say('Only paladin and knights may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
        end
    end
    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end

oh now when a knight uses the potion 29511 it says only sorcerers and druids can :/
and mages can use the potion 29511 that is meant for knights and paladins
mages can use both potions
 
Last edited:
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if item.itemid == 7440 or item.itemid == 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
        end
    elseif item.itemid == 29511 then
        if player:isMage() then
            player:say('Only paladin and knights may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
        end
    end
    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end
forgot to fix where you had or 29512 (that doesn't work as you think it does)
 
Solution
LUA:
local berserker = Condition(CONDITION_ATTRIBUTES)
berserker:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
berserker:setParameter(CONDITION_PARAM_SKILL_MELEE, 5)
berserker:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mastermind = Condition(CONDITION_ATTRIBUTES)
mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000)
mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3)
mastermind:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local bullseye = Condition(CONDITION_ATTRIBUTES)
bullseye:setParameter(CONDITION_PARAM_TICKS, 30 * 60 * 1000)
bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5)
bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10)

local mighty = Condition(CONDITION_ATTRIBUTES)
mighty:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
mighty:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_MELEE, 40)
mighty:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local crystalline = Condition(CONDITION_ATTRIBUTES)
crystalline:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000)
crystalline:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 40)
crystalline:setParameter(CONDITION_PARAM_SKILL_SHIELD, -20)

local config = {
    [7439] = berserker,
    [7440] = mastermind,
    [29511] = mighty,
    [29512] = crystalline,
    [7443] = bullseye
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local useItem = config[item.itemid]
    if not useItem then
        return true
    end

    if item.itemid == 7440 or item.itemid == 29512 then
        if not player:isMage() then
            player:say('Only sorcerers and druids may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Poder magico!!!.', TALKTYPE_MONSTER_SAY)
        end
    elseif item.itemid == 29511 then
        if player:isMage() then
            player:say('Only paladin and knights may drink this fluid.', TALKTYPE_MONSTER_SAY)
            return true
        else
            player:say('Skills a mi!!.', TALKTYPE_MONSTER_SAY)
        end
    end
    player:addAchievementProgress('Potion Addict', 100000)
    player:addCondition(useItem)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    item:remove(1)
    return true
end
forgot to fix where you had or 29512 (that doesn't work as you think it does)


awesome they work, could you explain to me what doesnt work as i think? so i dont make the same mistake hehe

thanks man!!
 
awesome they work, could you explain to me what doesnt work as i think? so i dont make the same mistake hehe

thanks man!!
after you use or you're evaluating a completely new condition, not using the previous condition to check for another value
so you need to compare item.itemid twice, once to compare against 7440 and another to compare item.itemid to 29512 if the previous condition returns false
leaving you with if item.itemid == 7440 or item.itemid == 29512 then
if you leave it if item.itemid == 7440 or 29512 then the 29512 gets evaluated to true because it's just a number for the condition
 
Back
Top