• 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 ] Spell item req

piku247

Judgment day is comming
Joined
Jun 15, 2009
Messages
70
Reaction score
135
Hi, i want to ask if theres any script that can for eg. give a new created spell for the player to use, by wearing a shield or any other item.
I mean, if you wearing a specific shield/item, you can cast specific spell assigned to that shield/item.

Thats something i need but cannot find anywhere.
 
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.01) + 1
    local max = (player:getLevel() / 5) + (skill * attack * 0.03) + 6
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    for slot = CONST_SLOT_RIGHT, CONST_SLOT_LEFT do
        local item = creature:getSlotItem(slot)
        if item then
            return combat:execute(creature, variant)
        end
    end

    creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    creature:getPosition():sendMagicEffect(CONST_ME_POFF)
    return false
end
 
Last edited:
Back
Top