• 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+ Moving onto TFS 1.4 lost functions

Mjmackan

Mapper ~ Writer
Premium User
Joined
Jul 18, 2009
Messages
1,424
Solutions
15
Reaction score
177
Location
Sweden
When I updated my sources to TFS 1.4 from 1.3 i lost a function to make object unmoveable through events.

This is the code im using:
Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if item:getActionId() == 9999 then
        print("yeloo")
    return false
    end
    if hasEventCallback(EVENT_CALLBACK_ONMOVEITEM) then
        return EventCallback(EVENT_CALLBACK_ONMOVEITEM, self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    end
    return RETURNVALUE_NOERROR
end

It prints "yeloo" but the item is still getting moved even with my return false.
 
I thought TFS 1.4 was a finished version without issues, that was the reason I changed from 1.3 to 1.4.
Or am i the only one who had this issue?
 
onMoveItem is activated in events.xml?
It should work
try this script?

Lua:
local ids = {9999, 6000}

local ec = EventCallback

ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)

    if table.contains(ids, item:getActionId()) then
        --self:sendTextMessage(MESSAGE_STATUS_DEFAULT, 'Sorry but you can not move this object.')
        return false
    end

    return true
end

ec:register()
 
it should work 🤷‍♂️
It does not, it seems to read the code and all but seems like it may return the onmove somewhere else..
What if you return something like "RETURNVALUE_NOTPOSSIBLE"? Did you tried it?
Tried, no change.
onMoveItem is activated in events.xml?
It should work
try this script?

Lua:
local ids = {9999, 6000}

local ec = EventCallback

ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)

    if table.contains(ids, item:getActionId()) then
        --self:sendTextMessage(MESSAGE_STATUS_DEFAULT, 'Sorry but you can not move this object.')
        return false
    end

    return true
end

ec:register()
Not working either.

Sorry for bumping this so late, just got back working on Gamefate again.
Even when removing every lua script related to onmoveitem everything works as normal so should be a sources issue.
 
It does not, it seems to read the code and all but seems like it may return the onmove somewhere else..

Tried, no change.

Not working either.

Sorry for bumping this so late, just got back working on Gamefate again.
Even when removing every lua script related to onmoveitem everything works as normal so should be a sources issue.

Make sure u enabled the function in events.xml
I have just tested the script right now and its working
TFS 1.5 ( Nekiro Downgrade )
 
Make sure u enabled the function in events.xml
I have just tested the script right now and its working
TFS 1.5 ( Nekiro Downgrade )
Its enabled, it just recently worked til' i updated the sources from 1.3 to 1.4. : ( )
 
Change return false to RETURNVALUE_NOTPOSSIBLE
Change return true to RETURNVALUE_NOERROR
 
Back
Top