• 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.2 Crash because of spell?

The error occurred when addMagicEffect() was called with an invalid argument. Based on the stack trace, it appears that the invalid argument was passed to luaPositionSendMagicEffect() from LuaScriptInterface, which in turn called playerCastInstant() in Spells, and eventually led to the error in addMagicEffect().

Could u send here the code of the spell that crash your server?
 
The error occurred when addMagicEffect() was called with an invalid argument. Based on the stack trace, it appears that the invalid argument was passed to luaPositionSendMagicEffect() from LuaScriptInterface, which in turn called playerCastInstant() in Spells, and eventually led to the error in addMagicEffect().

Could u send here the code of the spell that crash your server?
Lua:
function onCastSpell(creature, variant)
   local player = Player(creature)
   local amount = creature:getMana()
   player:addManaSpentMultiplier(amount)
   player:addMana(-amount)
   player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
   return true
end
 
@Tbol the power down script full and spells.xml full pls

C++:
    player->sendTextMessage(MESSAGE_INFO_DESCR, ss.str());
    g_game.addMagicEffect(player->getPosition(), CONST_ME_MAGIC_BLUE);
    return true;
It is full script i sent you
Code:
<instant group="support" spellid="243" name="power down" words="power down" aggressive="0" params="0" lvl="1" maglv="0" soul="0" mana="0" exhaustion="1000" prem="0" enabled="1" script="power_down.lua"></instant>
 
here you go

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

function onCastSpell(player, variant)
    local manaAmount = player:getMana()
    local effectPosition = Position(player:getPosition().x, player:getPosition().y, player:getPosition().z)
   
    if manaAmount > 0 then
        player:addManaSpent(manaAmount)
        player:addMana(-manaAmount)
    else
        player:sendCancelMessage("You have 0 mana.")
        effectPosition:sendMagicEffect(13)
    end
   
    return combat:execute(player, variant)
end
this is what I was using.
 
here you go

Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)

function onCastSpell(player, variant)
    local manaAmount = player:getMana()
    local effectPosition = Position(player:getPosition().x, player:getPosition().y, player:getPosition().z)
  
    if manaAmount > 0 then
        player:addManaSpent(manaAmount)
        player:addMana(-manaAmount)
    else
        player:sendCancelMessage("You have 0 mana.")
        effectPosition:sendMagicEffect(13)
    end
  
    return combat:execute(player, variant)
end
this is what I was using.
Thanks just gonna replace
player:addManaSpent(manaAmount)
with player:addManaSpentMultiplier(manaAmount)
 
Back
Top