• 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+ TFS 1.3 downgraded to 7.72 spell bug

Vantoria

www.ClassicOT.us
Joined
Jun 6, 2014
Messages
186
Reaction score
16
Location
USA
hello recently i have update my engine from othire to tfs 1.3 for 7.72 and im having some trouble with summon spell since im using the official ones that come in server files @Nekiro sorry for tag you but maybe u know or @Znote please guys
Code:
Mar 30 13:15:06 ClassicOT tfs[21861]: Lua Script Error: [Spell Interface]
Mar 30 13:15:06 ClassicOT tfs[21861]: data/spells/scripts/support/summon_creature.lua:onCastSpell
Mar 30 13:15:06 ClassicOT tfs[21861]: data/spells/scripts/support/summon_creature.lua:30: attempt to call method 'getManaCost' (a nil value)
Mar 30 13:15:06 ClassicOT tfs[21861]: stack traceback:
Mar 30 13:15:06 ClassicOT tfs[21861]:         [C]: in function 'getManaCost'
Mar 30 13:15:06 ClassicOT tfs[21861]:         data/spells/scripts/support/summon_creature.lua:30: in function <data/spells/scripts/support/summon_creature.lua:1>
 
Post full data/spells/scripts/support/summon_creature.lua script?

Be sure opening tag is [CODE=lua] too please, so it has correct syntax highlighting.
 
Post full data/spells/scripts/support/summon_creature.lua script?

Be sure opening tag is [CODE=lua] too please, so it has correct syntax highlighting.
temporaly fix i dont know if this is wrong but removed this line and works
Code:
    local manaCost = monsterType:getManaCost()
    if creature:getMana() < manaCost and not creature:hasFlag(PlayerFlag_HasInfiniteMana) then
        creature:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
        creature:getPosition():sendMagicEffect(CONST_ME_POFF)
        return false
    end
 
Last edited:
Alright, I checked the sources you say you are running.

The member field exists and is part of a public structure which the Lua env can access and the method is registered. There is no reason your script shouldn't work, unless what is contained in the variable at that point isn't actually a MonsterType.

(also note: Even if you don't have manaCost set in the monster's xml file, the class set's it's default to 0. Your invocation should give you 0 at worst. It's saying MonsterType::getManaCost is nil, not that the returned manacost value is nil)

🤷‍♂️
 
Last edited:
Back
Top