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

Potion that increase the HP every "x" seconds

kingsley666

Active Member
Joined
Jul 24, 2011
Messages
151
Reaction score
32
Location
Venezuela
Hello, hope you are doing good,

I created this thread because i have no idea how to do this, i want to create a potion that increase the hp of the character by "x" health every "y" time for "z" times, is like the utura spell but in action.

I was trying to use the combat function but it is missing the variant paramenter. :(

I hope you can help me :)
 
Solution
I tryed your code with no result, nor error.

Sorry i forgot to tell i'm using TFS 1.2
Untested so let me know if it works. So you know, all I really did was look at the intense recovery spell for a reference and adapted it to a potion. These kinds of scripts are the perfect types to practice and learn with, just keep trying and researching and I'm sure you will figure out how to do it.
Lua:
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) -- in milliseconds so this is equal to 60 seconds
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 40) -- 40 health gained every tick
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) -- how often heal is gained, also in...
Lua:
local amounthp = 10000    -- how much hp it heals
local every = 5 * 1000                                 -- every 5 seconds
local timer = 4                                             -- how many times it heals

if timer > 0 then
addEvent(doCreatureAddHealth, cid, amounthp, every , timer-1)
end

How about it?
If player relog it won't be working anymore.
 
I tryed your code with no result, nor error.

Sorry i forgot to tell i'm using TFS 1.2
Untested so let me know if it works. So you know, all I really did was look at the intense recovery spell for a reference and adapted it to a potion. These kinds of scripts are the perfect types to practice and learn with, just keep trying and researching and I'm sure you will figure out how to do it.
Lua:
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) -- in milliseconds so this is equal to 60 seconds
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 40) -- 40 health gained every tick
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) -- how often heal is gained, also in miliseconds so every 3 seconds
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if type(target) == "userdata" and not target:isPlayer() then
        return false
    end

    if target:addCondition(condition) then
        target:say("Aah...", TALKTYPE_MONSTER_SAY)
        item:transform(2006)
        return true
    end
    return false
end
 
Last edited:
Solution
Untested so let me know if it works. So you know, all I really did was look at the intense recovery spell for a reference and adapted it to a potion. These kinds of scripts are the perfect types to practice and learn with, just keep trying and researching and I'm sure you will figure out how to do it.
Lua:
local condition = Condition(CONDITION_REGENERATION)
condition:setParameter(CONDITION_PARAM_TICKS, 1 * 60 * 1000) -- in milliseconds so this is equal to 60 seconds
condition:setParameter(CONDITION_PARAM_HEALTHGAIN, 40) -- 40 health gained every tick
condition:setParameter(CONDITION_PARAM_HEALTHTICKS, 3000) -- how often heal is gained, also in miliseconds so every 3 seconds
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if type(target) == "userdata" and not target:isPlayer() then
        return false
    end

    if target:addCondition(condition) then
        target:say("Aah...", TALKTYPE_MONSTER_SAY)
        item:transform(2006)
        return true
    end
    return false
end

@Apollos This is what i needed, it is working perfectly, i'm still learning to code with TFS, i also tryed to use the condition fuction but i didn't know how to set it to the player :oops:.

Thank you very much for your help.
 
Back
Top