• 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.3] Creature:SetMaster(Creature) crash

Homeslice

-anoyn/Rage the Mage
Joined
May 9, 2010
Messages
112
Solutions
2
Reaction score
66
Location
Canada
Title wrong: 1.2 not 1.3

Hello everyone

I am trying to convert the summon spells from this monsterpack from TFS 1.1 to 1.2.

Here is the 1.1 code (data\spells\scripts\monster\white pale summon.lua):
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GROUNDSHAKER)

arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
combat:setArea(area)

local maxsummons = 2

function onCastSpell(creature, var)
    local summoncount = creature:getSummons()
    if #summoncount < 2 then
        for i = 1, maxsummons - #summoncount do
            local mid = Game.createMonster("Carrion Worm", creature:getPosition())
             if not mid then
                return
            end
            mid:setMaster(creature)
        end
    end
    return combat:execute(creature, var)
end

Here is where the spell is started in "White pale.xml"
Lua:
    <defenses armor="8" defense="11">
        <defense name="white pale summon" interval="2000" chance="80"/>
    </defenses>


The spell is called from:

When it hits "mid:setMaster(creature)" the server crashes.

I've checked the luascript.cpp and it shows the parameters are still the same as in 1.1 (creature:setMaster(master)).

When i comment out setMaster the server does not crash and the summon monster is created.

Does anyone know why this is crashing?

Edit: Was a mistake in my TFS 1.2 source changes.
 
Last edited:
in 1.3 there were changes with how summons work, try creature:addSummon(mid)
this will ofc only work if you have the latest 1.3 i think, plus the creature.lua lib file from the github since it was moved to lua
 
Back
Top