• 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+ Conjure 2 runes in hand

gordaum

New Member
Joined
Mar 4, 2025
Messages
10
Reaction score
0
I'm trying to make it so that when the player casts 2 runes, 1 in each hand, he consumes twice the amount of soul points. But I've tried everything and I can't :/

tfs 1,5
spells in scripts
scripts/folder/functions.lua


LUA:
function Player:conjureItem(conjureMana, reagentId, conjureId, conjureCount, effect)
    local conjureFromHandsOnly = true
    
    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

    if not conjureFromHandsOnly then
        if reagentId ~= 0 and not self:removeItem(reagentId, 1, -1) then
            self:sendCancelMessage(RETURNVALUE_YOUNEEDAMAGICITEMTOCASTSPELL)
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

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

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

        self:getPosition():sendMagicEffect(effect or CONST_ME_MAGIC_RED)
    else
        local leftItem = self:getSlotItem(CONST_SLOT_LEFT)
        local rightItem = self:getSlotItem(CONST_SLOT_RIGHT)
        local totalConjures = 0
        
        if reagentId ~= 0 then
            if leftItem and leftItem:getId() == reagentId then
                leftItem:remove()
                
                local item = self:addItem(conjureId, 1, true, conjureCount, CONST_SLOT_LEFT)
                if not item then
                    self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
                    self:getPosition():sendMagicEffect(CONST_ME_POFF)
                    return false
                end

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

                self:getPosition():sendMagicEffect(effect or CONST_ME_MAGIC_RED)
                totalConjures = 1
            end
            
            if rightItem and rightItem:getId() == reagentId then
                local infiniteMana = self:getGroup():hasFlag(PlayerFlag_HasInfiniteMana)
                local notEnoughMana = self:getMana() < conjureMana * 2 and not infiniteMana
                
                if totalConjures == 1 and notEnoughMana then
                    -- not enough mana on second hand
                    return true
                elseif totalConjures == 1 then
                    -- take mana for second hand
                    self:addMana(-conjureMana)
                    self:addManaSpent(conjureMana)
                end

                rightItem:remove()
                
                local item = self:addItem(conjureId, 1, true, conjureCount, CONST_SLOT_RIGHT)
                if not item then
                    self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
                    self:getPosition():sendMagicEffect(CONST_ME_POFF)
                    return false
                end

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

                self:getPosition():sendMagicEffect(effect or CONST_ME_MAGIC_RED)
                totalConjures = totalConjures + 1
            end
            
            if totalConjures == 0 then
                self:sendCancelMessage(RETURNVALUE_YOUNEEDAMAGICITEMTOCASTSPELL)
                self:getPosition():sendMagicEffect(CONST_ME_POFF)
                return false
            end
        else
            local item = self:addItem(conjureId, conjureCount)
            if not item then
                self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
                self:getPosition():sendMagicEffect(CONST_ME_POFF)
                return false
            end

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

            self:getPosition():sendMagicEffect(effect or CONST_ME_MAGIC_RED)
        end
    end
    
    return true
end
 
In TFS 1.5, soul points are typically consumed manually through a script or the spell system if soul = X is defined in the spell XML
Post automatically merged:

Okay okay i think i got it

Try with
LUA:
self:addSoul(-1)

In your code it would look like this;
LUA:
-- take mana for second hand
self:addMana(-conjureMana)
self:addManaSpent(conjureMana)
self:addSoul(-1)
 
Last edited:
In TFS 1.5, soul points are typically consumed manually through a script or the spell system if soul = X is defined in the spell XML
Post automatically merged:

Okay okay i think i got it

Try with
LUA:
self:addSoul(-1)

In your code it would look like this;
LUA:
-- take mana for second hand
self:addMana(-conjureMana)
self:addManaSpent(conjureMana)
self:addSoul(-1)
I had already done this, it ended up consuming 3 souls of the uh and 1 soul of the second uh, that is, the second rune always consumes only 1
 
Back
Top