• 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 Summon bomb TFS 1.3 explodes when it dies

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hello guys, I would like summon bomb spell
I found some scripts here in the forum, but they don't work like I want.
What I would like is:
-Player summon a monster (lets use skeleton as example), summon will last for 30 seconds if it doesn't die.
-If summon die or last for 30 seconds, it will explode in a exori area, causing damage according to the formula below.

Code:
function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 1.4) + 8
    local max = (level / 5) + (magicLevel * 2.2) + 14
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
 
Have you seen this topic already?
 
Hello again, I'm trying to put a effect bigger than 32x32, so I need to use offset (x,y). However, the effect is now appearing on the player instead of the creature, what am I doing wrong?

spell.lua:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setArea(createCombatArea(AREA_SQUARE1X1))
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, true)

function onGetFormulaValues(player, skill, attack, skill, factor)
    local maxHealth = player:getMaxHealth()
    local maxMana = player:getMaxMana()
    local playlvl = player:getLevel()
    
    local min = ((playlvl < 300 and playlvl or 300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,55
    local max = ((playlvl < 300 and playlvl or 300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,1
    
    return -min, -max   
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")


function onCastSpell(cid, var)
    local player = Player(cid)
    if player == nil then
        return false
    end
 
    local playerPos = player:getPosition()
    if #player:getSummons() >= 2 then
        player:sendCancelMessage("You cannot summon more creatures.")
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local creatureId = doSummonCreature("Barrelbomb", playerPos)
    if creatureId == false then
        player:sendCancelMessage(RET_NOTENOUGHROOM)
        playerPos:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local monster = Monster(creatureId)
    monster:setMaster(player)
    monster:registerEvent("barrelbomb")

    addEvent(function(cid)
        local creature = Creature(cid)
        if creature ~= nil then
            local player = creature:getMaster()
            if player then
                combat:execute(player, numberToVariant(cid))
            else
                combat:execute(creature, numberToVariant(cid))
            end
            local creaturePos = creature:getPosition()
            creaturePos.x = creaturePos.x +1
            creaturePos.y = creaturePos.y +1
            creaturePos:sendMagicEffect(122)
            creature:remove()
        end
    end, 5000, creatureId)

    monster:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    playerPos:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    return true
end

creaturescript.lua:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setArea(createCombatArea(AREA_SQUARE1X1))
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, true)

function onGetFormulaValues(player, skill, attack, skill, factor)
    local maxHealth = player:getMaxHealth()
    local maxMana = player:getMaxMana()
    local playlvl = player:getLevel()
    
    local min = ((playlvl < 300 and playlvl or 300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 0,55
    local max = ((playlvl < 300 and playlvl or 300) + ((maxHealth + maxMana) / 16) + (attack * 4) + (skill * 2)) * 1,1
    
    return -min, -max   
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onDeath(creature, variant, cid, ...)
    local creature = Creature(cid)
    local master = creature:getMaster()
    if master then
        combat:execute(master, numberToVariant(cid))
    else
        combat:setFormula(COMBAT_FORMULA_DAMAGE, -10, 0, -20, 0)
        local creaturePos = creature:getPosition()
        creaturePos.x = creaturePos.x +1
        creaturePos.y = creaturePos.y +1
        creaturePos:sendMagicEffect(122)
        combat:execute(creature, numberToVariant(cid))
    end
    return true
end
 
Back
Top