• 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+ Summons with different names - TFS 1.3

GOD Half

Member
Joined
May 9, 2010
Messages
179
Reaction score
15
Hello everyone, I'm trying to develop a system to summon different types of summons. It is working, but when I have another summoned summon, it identifies as the same, and blocks how much I need each of them. Can someone help me?
Lua:
function onCastSpell(creature, var)

local player = Player(creature)
if not player then
    return false
end

local summonName = "Carrion Worm"
local maxsummons = 2
local summonsPlayer = creature:getSummons()
local summon = true

if (#summonsPlayer >= 1) then
    for _, SummonID in ipairs(summonsPlayer) do
        if (string.lower(getCreatureName(SummonID)) == string.lower(summonName)) then
            nameSummon = getCreatureName(SummonID)
            summon = false
        end
    end
end

if (#summonsPlayer < maxsummons) and (summon == true) then
    for i = 1, maxsummons - #summonsPlayer do
    local mid = Game.createMonster(summonName, creature:getPosition())
        if not mid then
            return
        end
    creature:addSummon(mid)
    end
    doCreatureSay(creature, "Go "..nameSummon.."!", TALKTYPE_ORANGE_1)
elseif (#summonsPlayer >= 1) and (nameSummon == summonName) then
    doPlayerSendCancel(creature, "You already have summoned "..summonName..".")
    summon = false
return doSendMagicEffect(getThingPos(player), 2) and false
end

return
end
 
I didn't got your problem, can you try to explain better what do you want and what is happening?
The script looks okay for me
 
Back
Top