• 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!

Solved [TFS 1.0] Applying Invisible to summons (Spell)

TheChaos

Member
Joined
Sep 10, 2014
Messages
17
Reaction score
19
Is there anyway of doing this? I try to add it as a condition but it doesn't work although haste does.
 
You could do something like this, basically, it's a spell that a monster would cast on its summons.

Code:
local condition = Condition(CONDITION_INVISIBLE)
condition:setParameter(CONDITION_PARAM_TICKS, 2000)

function onCastSpell(creature, var)
local summons = creature:getSummons()

    if not summons then
        return true
    end
   
    for i = 1, #summons do
        local summon = summons[i]
   
        summon:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        summon:addCondition(condition)
    end
   
    return true
end

Then in the monster file, you could do something like this, obviously, you can make it a defense spell too:

Code:
<attack script="monster/summon_invisible.lua" interval="5000" chance="50"/>
 
Yeah I'll try that, I was looking to get the player cast it on his summons? is this possible? i can cast haste on summons but not invisible?
 
Yeah I'll try that, I was looking to get the player cast it on his summons? is this possible? i can cast haste on summons but not invisible?

Just make it a spell for players then. Just need to add a new thing in spells.xml, like this one (obviously can be changed):
Code:
    <instant group="support" spellid="45" name="Summons Invisibility" words="utana vid ina" lvl="35" mana="440" aggressive="0" selftarget="1" exhaustion="2000" groupcooldown="2000" needlearn="0" script="support/summon_invisible.lua">
        <vocation name="Sorcerer"/>
        <vocation name="Druid"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Elder Druid"/>
    </instant>

Also, the code has been changed a little bit:
Code:
local condition = Condition(CONDITION_INVISIBLE)
condition:setParameter(CONDITION_PARAM_TICKS, 2000)

function onCastSpell(creature, var)
    local summons = creature:getSummons()

    if not next(summons) then
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        creature:sendTextMessage(MESSAGE_STATUS_SMALL, "You have no summons")
        return false
    end
  
    for i = 1, #summons do
        local summon = summons[i]
        summon:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        summon:addCondition(condition)
    end
  
    return true
end

GIF in action:
8NxJtCC.gif
 
Back
Top Bottom