• 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 Utevo res infinite and killeable loot exp monster tfs 1.2

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i have tfs 1.2 and i have a problem with utevo res
i have this script:
Lua:
function onCastSpell(creature, variant)
    local monsterName = variant:getString()
    local monsterType = MonsterType(monsterName)

    if not monsterType then
        creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not getPlayerFlagValue(creature, PlayerFlag_CanSummonAll) then
        if not monsterType:isSummonable() then
            creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

        if #creature:getSummons() >= 2 then
            creature:sendCancelMessage("You cannot summon more creatures.")
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    local manaCost = monsterType:getManaCost()
    if creature:getMana() < manaCost and not getPlayerFlagValue(creature, PlayerFlag_HasInfiniteMana) then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local position = creature:getPosition()
    local summon = Game.createMonster(monsterName, position, true)
    if not summon then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    creature:addMana(-manaCost)
    creature:addManaSpent(manaCost)
    creature:addSummon(summon)
    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    summon:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    return true
end


and people can do utevo res and summon an infinite number of summons, and also they are not summons, theu summon normal monsters, that give exp, loot and attack you :/

plz help with this
 
Try this one

Code:
function onCastSpell(creature, variant)
    local monsterName = variant:getString()
    local monsterType = MonsterType(monsterName)

    if not monsterType then
        creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not getPlayerFlagValue(creature, PlayerFlag_CanSummonAll) then
        if not monsterType:isSummonable() then
            creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

        if #creature:getSummons() >= 2 then
            creature:sendCancelMessage("You cannot summon more creatures.")
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    local manaCost = monsterType:getManaCost()
    if creature:getMana() < manaCost and not getPlayerFlagValue(creature, PlayerFlag_HasInfiniteMana) then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local position = creature:getPosition()
    local summon = Game.createMonster(monsterName, position, true)
    if not summon then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    creature:addMana(-manaCost)
    creature:addManaSpent(manaCost)

    summon:setMaster(creature)
    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    summon:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    return true
end

You need the summon:setMaster() line to make the monster a summon
 
Try this one

Code:
function onCastSpell(creature, variant)
    local monsterName = variant:getString()
    local monsterType = MonsterType(monsterName)

    if not monsterType then
        creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    if not getPlayerFlagValue(creature, PlayerFlag_CanSummonAll) then
        if not monsterType:isSummonable() then
            creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end

        if #creature:getSummons() >= 2 then
            creature:sendCancelMessage("You cannot summon more creatures.")
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    local manaCost = monsterType:getManaCost()
    if creature:getMana() < manaCost and not getPlayerFlagValue(creature, PlayerFlag_HasInfiniteMana) then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end

    local position = creature:getPosition()
    local summon = Game.createMonster(monsterName, position, true)
    if not summon then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM)
        position:sendMagicEffect(CONST_ME_POFF)
        return false
    end

    creature:addMana(-manaCost)
    creature:addManaSpent(manaCost)

    summon:setMaster(creature)
    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
    summon:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    return true
end

You need the summon:setMaster() line to make the monster a summon

thanks, now they obey me, but i still can summon infinite and they give exp and loot :/
 
Just use this in your spells.xml

Code:
    <instant group="support" spellid="9" name="Summon Creature" words="utevo res" lvl="25" params="1" cooldown="2000" groupcooldown="2000" needlearn="0" function="summonMonster">
        <vocation name="Sorcerer" />
        <vocation name="Druid" />
        <vocation name="Master Sorcerer" />
        <vocation name="Elder Druid" />
    </instant>
 
just replace
summon:setMaster(creature)
to
creature:addSummon(summon)
 
just replace
summon:setMaster(creature)
to
creature:addSummon(summon)
sorry didnt work, im still able to summon infinite numbers and they give loot and exp :(
oh, and they attack me and can't contrle them
 
Last edited:
just replace
summon:setMaster(creature)
to
creature:addSummon(summon)

the creature:addSummon(summon) command was added after tfs 1.2 release. I've downloaded tfs 1.2 release and it creates summon with

Lua:
                local monster = Game.createMonster("Skeleton", position)
                if monster then
                    monster:setMaster(creature)
                    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                    return true
                end

and the spell "utevo res" does not have a script. It is done through a function (which I don't know how to edit - maybe direct on sources), as I mentioned before.
 
Add before 'if not getPlayerFlagValue':
Lua:
      if not monsterType:isConvinceable() then
            creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
            creature:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
Monster has to be convinceable due to have a Master.


Also you have to use setMaster().
1.2 doesn't use addSummon()
 
Back
Top