• 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 Getting the ID of a rune. TFS 1.3

spyk3z

Theós:Undying
Joined
Jul 23, 2007
Messages
385
Reaction score
90
Location
Home.
Lua:
local cooldownID = 199029
local cooldownTime = 900

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3.2) + 20
    local max = (level / 5) + (maglevel * 5.4) + 40
    return min, max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, cooldownTime)

function onCastSpell(creature, var, isHotkey)
local player = creature:getPlayer()
local item = player:getItemById(31093, true, -1)
    if creature:getCondition(CONDITION_EXHAUST_HEAL) then
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
            return false
                end
                    creature:addCondition(exhaust)
                addEvent(function() item:transform(31173) print('item removed') end,0)
            addEvent(function() item:transform(31093) print('item removed') end, cooldownTime)
    return combat:execute(creature, var)
    end

What I'm doing is adding a cooldown and transforming the rune to another to display that it's on cooldown. The problem is it only works while in a backpack. How would I go about making it work outside of a backpack? Also is there a way to force use or far use on an item without changing the .dat?
 
If the item that you are transforming gets removed your server will crash. Because it will refer to null pointer. You should get the item again in addEvent.
 
Back
Top