• 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+ Runes go up to main backpack when crafted [TFS 1.2]

I have no idea when this got moved, but i think TFS 1.2, you will find inside spells/lib/spells.lua. Replace it with this:
Lua:
function Player:conjureItem(reagentId, conjureId, conjureCount, effect)
    if not conjureCount and conjureId ~= 0 then
        local itemType = ItemType(conjureId)
        if itemType:getId() == 0 then
            return false
        end

        local charges = itemType:getCharges()
        if charges ~= 0 then
            conjureCount = charges
        end
    end

    local conjureItem = self:getItemById(reagentId, true, -1)
    if reagentId ~= 0 and not conjureItem then
        self:sendCancelMessage(RETURNVALUE_YOUNEEDAMAGICITEMTOCASTSPELL)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local item = conjureItem:getParent():addItem(conjureId, conjureCount)
    if not item then
        item = self:addItem(conjureId, conjureCount)
        if not item then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if item:hasAttribute(ITEM_ATTRIBUTE_DURATION) then
        item:decay()
    end

    conjureItem:remove(1)
    self:getPosition():sendMagicEffect(item:getType():isRune() and CONST_ME_MAGIC_RED or effect)
    return true
end

Now it will add the conjure item in the container it was orginally, if there is no room in that container. It will just add it somewhere in players backpack. As backup
 
I have no idea when this got moved, but i think TFS 1.2, you will find inside spells/lib/spells.lua. Replace it with this:
Lua:
function Player:conjureItem(reagentId, conjureId, conjureCount, effect)
    if not conjureCount and conjureId ~= 0 then
        local itemType = ItemType(conjureId)
        if itemType:getId() == 0 then
            return false
        end

        local charges = itemType:getCharges()
        if charges ~= 0 then
            conjureCount = charges
        end
    end

    local conjureItem = self:getItemById(reagentId, true, -1)
    if reagentId ~= 0 and not conjureItem then
        self:sendCancelMessage(RETURNVALUE_YOUNEEDAMAGICITEMTOCASTSPELL)
        self:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local item = conjureItem:getParent():addItem(conjureId, conjureCount)
    if not item then
        item = self:addItem(conjureId, conjureCount)
        if not item then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if item:hasAttribute(ITEM_ATTRIBUTE_DURATION) then
        item:decay()
    end

    conjureItem:remove(1)
    self:getPosition():sendMagicEffect(item:getType():isRune() and CONST_ME_MAGIC_RED or effect)
    return true
end

Now it will add the conjure item in the container it was orginally, if there is no room in that container. It will just add it somewhere in players backpack. As backup

data/spells/lib/spells.lua:1: attempt to index local 'conjureItem' (a nil value)

when i use exevo con or some magic to generate items

Lua:
local item = conjureItem:getParent():addItem(conjureId, conjureCount)
    if not item then
        item = self:addItem(conjureId, conjureCount)
        if not item then
            self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end
Post automatically merged:

Lua:
function onCastSpell(creature, variant)
    return creature:conjureItem(0, 3447, 15, CONST_ME_MAGIC_BLUE)
end
 
Last edited:
Back
Top