• 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 runes on invisible monsters

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
931
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
how to make invisible monsters appear, if I use a rune while it is invisible and it appears for example
an invisible monster receives damage or appears for target shooting runes, for example an SD where the target is only in a single area
TFS. 1.5 772
 

here we can see that players hit invisible warlock with target runes like sd. how to make this work?


Lua:
local spell = Spell(SPELL_INSTANT)

spell:needLearn(true)
spell:mana(220)
spell:magicLevel(25)
spell:soul(0)
spell:isAggressive(false)
spell:name("Sudden Death Rune")
spell:vocation("Sorcerer", "Master Sorcerer")
spell:words("ad,ori, vita, vis")

function spell.onCastSpell(creature, variant)
    return creature:conjureItem(220, 2260, 2268, 1)
end

spell:register()

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, true)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, false)
combat:setArea(createCombatArea(AREA_SINGLE))



function onGetFormulaValues(player, level, magicLevel)
    return player:computeDamage(150, 20)
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local rune = Spell(SPELL_RUNE)

function rune.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

rune:cooldown(1800)
rune:runeMagicLevel(15)
rune:runeId(2268)
rune:charges(1)
rune:allowFarUse(true)
rune:blockWalls(true)
rune:checkFloor(true)
rune:isBlocking(true)
rune:needTarget(true)
rune:isAggressive(true)
rune:register()
 
add on top in onCastSpell:
Lua:
if target then
        if Tile(target:getPosition()):getTopCreature() then
            return doCombat(cid, combat, var)
        else
            cid:sendCancelMessage("You can only use this rune on creatures.")
            cid:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false -- Przerwij wykonanie funkcji, jeśli warunek nie jest spełniony
        end
    end
 
my spells were implemented from ezz's tvp... they are not original, they are even in the script folder....
so I adapted it, but there was a line that was blocking it all this time and when I removed it it worked

1710247888084.png

The adaptation I made and it worked correctly now looks like this.

Lua:
local spell = Spell(SPELL_INSTANT)

spell:needLearn(true)
spell:mana(220)
spell:magicLevel(25)
spell:soul(5)
spell:isAggressive(false)
spell:name("Sudden Death Rune")
spell:vocation("Sorcerer", "Master Sorcerer")
spell:words("ad,ori, vita, vis")

function spell.onCastSpell(creature, variant)
    return creature:conjureItem(220, 2260, 2268, 1)
end

spell:register()

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, true)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_BLOCKSHIELD, false)
combat:setArea(createCombatArea(AREA_SINGLE))



function onGetFormulaValues(player, level, magicLevel)
    return player:computeDamage(150, 20)
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local rune = Spell(SPELL_RUNE)

function rune.onCastSpell(cid, var, isHotkey)
    if Tile(var:getPosition()):getTopCreature() then
        return doCombat(cid, combat, var)
    end
    doPlayerSendCancel(cid,"You can only use this rune on creatures.")
    getCreaturePosition(cid):sendMagicEffect(CONST_ME_POFF)
    return false
end

rune:cooldown(1800)
rune:runeMagicLevel(15)
rune:runeId(2268)
rune:charges(1)
rune:allowFarUse(true)
rune:blockWalls(true)
rune:checkFloor(true)
rune:isBlocking(true)
-- rune:needTarget(true)
rune:isAggressive(true)
rune:register()

before she was like this

Code:
function rune.onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

Code:
rune:runeMagicLevel(15)
rune:runeId(2268)
rune:charges(1)
rune:allowFarUse(true)
rune:blockWalls(true)
rune:checkFloor(true)
rune:isBlocking(true)
rune:needTarget(true)
rune:isAggressive(true)
rune:register()

now with the removal of the need target + this friend's information, it works 100% correct.. because the need target did not allow it to hit an invisible monster, but also without it it was possible to hit the Floor.
 
have tried this but this is not working
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(player, level, magicLevel)
    local min = (level / 5) + (magicLevel * 4.3) + 32
    local max = (level / 5) + (magicLevel * 7.4) + 48
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant, isHotkey)
    if target then
        if Tile(target:getPosition()):getTopCreature() then
            return doCombat(cid, combat, var)
        else
            cid:sendCancelMessage("You can only use this rune on creatures.")
            cid:getPosition():sendMagicEffect(CONST_ME_POFF)
            return true -- Przerwij wykonanie funkcji, jeśli warunek nie jest spełniony
        end
    end
    return combat:execute(creature, variant)
end
no errors in console
 
Back
Top