• 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 sendMagicEffect error message TFS 1.2

knighters god

Active Member
Joined
Feb 14, 2009
Messages
166
Solutions
1
Reaction score
40
TFS 1.2
CLIENT 10.77

So I am playing around with scripts for a quest I'm doing, and I want to send magic effects when you teleport using a lever.
Everything but the magic effects work.

Code:
            _config._TeleportPOS.FROM:sendMagicEffect(CONST_ME_POFF)
            _config._TeleportPOS.TO:sendMagicEffect(CONST_ME_TELEPORT)
njnr4Hw.png


Full script in case that could help.
Code:
local _config =
{
    _Lever = 
    {
        FirstID = 9825,
        SecondID = 9826,
        UniqueID = 16003
    },
    _MagicRock =
    {
        RockID = 1353,
        SecondRockID = 1354,
        UniqueID = 16002,
    },
    _TeleportPOS =
    {
        FROM = {x = 1056, y = 1220, z = 11},
        TO = {x = 1063, y = 1220, z = 11}
    },
    _LevelRequirment =
    {
        PhaseOne = 80,
        PhaseTwo = 90,
        PhaseThree = 100
    },
    _Storages =
    {
        MagicRockStorageID = 17306,
        RewardStorageID = 17307
    }
}

local function ROLLBACKrockEVENT()
    doTransformItem(_config._MagicRock.UniqueID, _config._MagicRock.RockID)
end

local function ROLLBACKleverEVENT()
    doTransformItem(_config._Lever.UniqueID, _config._Lever.FirstID)
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if (item.itemid == _config._MagicRock.RockID or item.itemid == _config._MagicRock.SecondRockID) and item.uid == _config._MagicRock.UniqueID then    -- From here is only about the magic rock
        if item.itemid == _config._MagicRock.RockID and player:getLevel() >= _config._LevelRequirment.PhaseOne then
            doTransformItem(_config._MagicRock.UniqueID, _config._MagicRock.SecondRockID)
            addEvent(ROLLBACKrockEVENT, 5 * 1000)
            setPlayerStorageValue(player, _config._Storages.MagicRockStorageID, 5)
        elseif item.itemid == _config._MagicRock.SecondRockID and player:getLevel() >= _config._LevelRequirment.PhaseOne then
            setPlayerStorageValue(player, _config._Storages.MagicRockStorageID, 5)
        else
            doPlayerSendCancel(player, "You cannot use this object!")
        end
    end                                                                                                                                                    -- To here is only about the magic rock
    ----------------------------------------
    if item.itemid == _config._Lever.FirstID and item.uid == _config._Lever.UniqueID then
        if getPlayerStorageValue(player, _config._Storages.MagicRockStorageID) > 1 then
            doTransformItem(_config._Lever.UniqueID, _config._Lever.SecondID)
            doTeleportThing(player, _config._TeleportPOS.TO)
            player:setDirection(DIRECTION_EAST)
            addEvent(ROLLBACKleverEVENT, 2 * 1000)
           
            _config._TeleportPOS.FROM:sendMagicEffect(CONST_ME_POFF)
            _config._TeleportPOS.TO:sendMagicEffect(CONST_ME_TELEPORT)
        else
            doPlayerSendCancel(player, "The lever is stuck in place!")
        end
    end
    return true
end

Help would be greatly appreciated!
 
Solution
Try to change to:

Lua:
Position( _config._TeleportPOS.FROM):sendMagicEffect(CONST_ME_POFF)
Position(_config._TeleportPOS.TO):sendMagicEffect(CONST_ME_TELEPORT)

or in config:
Lua:
{FROM = Position(1056, 1220, 11),
TO = Position(1063, 1220, 11)}

I actually tried the first one. But then it yelled on me for global variable.
But I fixed it by using.

Code:
doSendMagicEffect(pos, effect)

But still, thank you ^^
Try to change to:

Lua:
Position( _config._TeleportPOS.FROM):sendMagicEffect(CONST_ME_POFF)
Position(_config._TeleportPOS.TO):sendMagicEffect(CONST_ME_TELEPORT)

or in config:
Lua:
{FROM = Position(1056, 1220, 11),
TO = Position(1063, 1220, 11)}
 
Try to change to:

Lua:
Position( _config._TeleportPOS.FROM):sendMagicEffect(CONST_ME_POFF)
Position(_config._TeleportPOS.TO):sendMagicEffect(CONST_ME_TELEPORT)

or in config:
Lua:
{FROM = Position(1056, 1220, 11),
TO = Position(1063, 1220, 11)}

I actually tried the first one. But then it yelled on me for global variable.
But I fixed it by using.

Code:
doSendMagicEffect(pos, effect)

But still, thank you ^^
 
Solution
Back
Top