• 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+ 1000 Id, unmovable

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,085
Solutions
15
Reaction score
379
Location
Sweden
YouTube
Joriku
Hello,
Kept looking for this but find nothing in the style i want to, might just be that i search wrong..
I am looking for something that makes every item with the unique id: 1000, ingame noone can move it.
 
Solution
In player.lua located in events.

You could add something like this inside the Player:eek:nMoveItem function.
Lua:
if item.uniqueid == 1000 then
    self:sendCancelMessage('You cannot move this object.')
    return false
end
In player.lua located in events.

You could add something like this inside the Player:eek:nMoveItem function.
Lua:
if item.uniqueid == 1000 then
    self:sendCancelMessage('You cannot move this object.')
    return false
end
 
Solution
As halfaway told you and don't forget that when you duplicate a unique id you will receive error in console , so i do prefer to use actionid
 
I will share my solution of this, I worked this out a while ago.
Both HalfAway and Shadow_ are right,

here is my code: add to the player.lua inside the scripts folders of events folder.
look for the function Player:OnMoveItem and add below the end of the first if (second end)
Code:
if item.actionId == "your action id" then
        self:sendCancelMessage('You cannot move this object.')
        return false
    end

for this to work each item has to have your action id, and an unique id aswell. (each unique id has to be different)
 
I will share my solution of this, I worked this out a while ago.
Both HalfAway and Shadow_ are right,

here is my code: add to the player.lua inside the scripts folders of events folder.
look for the function Player:OnMoveItem and add below the end of the first if (second end)
Code:
if item.actionId == "your action id" then
        self:sendCancelMessage('You cannot move this object.')
        return false
    end

for this to work each item has to have your action id, and an unique id aswell. (each unique id has to be different)
Getting this in my console
e91db57fb9c0e9afa2ffa343409e7f85.png
 
Yes, because unique id, as the name suggests, should remain UNIQUE.
If you want items with the same ID, use action instead on items instead.
 
Okay so that lua is incomplete. it has to be posted in the proper area of the Player.lua inside the scripts folder of events.

In that lua, look for the function Player:eek:nMoveItem
and add those lines you have inside your id1000.lua, that i posted earlier.

mine looks like this:

Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
    if blockTeleportTrashing and toPosition.x ~= CONTAINER_POSITION then
        local thing = Tile(toPosition):getItemByType(ITEM_TYPE_TELEPORT)
        if thing then
            self:sendCancelMessage('Sorry, not possible.')
            self:getPosition():sendMagicEffect(CONST_ME_POFF)
            return false
        end
    end

    if isInArray({1714, 1715, 1716, 1717, 1738, 1740, 1741, 1747, 1748, 1749}, item.itemid) and item.actionid > 0 or item.actionid == 5640 then
        self:sendCancelMessage('You cannot move this object.')
        return false
    elseif item.itemid == 7466 then
        self:sendCancelMessage('You cannot move this object.')
        return false
    end
 -- This is my line to make items unmovable.
    if item.actionId == 42099 then
        self:sendCancelMessage('You cannot move this object.')
        return false
    end

    if fromPosition.x == CONTAINER_POSITION and toPosition.x == CONTAINER_POSITION
            and item.itemid == 8710 and self:getItemCount(8710) == 2 and self:getStorageValue(Storage.RookgaardTutorialIsland.cockroachLegsMsgStorage) ~= 1 then
        self:sendTextMessage(MESSAGE_INFO_DESCR, 'Well done, you have enough cockroach legs! You should head back to Santiago with them. Climb the ladder to the north to exit.')
        self:setStorageValue(Storage.RookgaardTutorialIsland.cockroachLegsMsgStorage, 1)
        self:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 6)
    end
    return true
end

Please refrain from copying/pasting mine. It is for reference only and will/might disrupt your own.

Then, for each unmovable item you add your actionID. and a new UNIQUE uniqueID. (again, each different items NEEDS a new uniqueId, such as 1001, 1002, etc. If it says Duplicate, change it to another.
As I said, for some reason not having an uniqueID, and only the actionID, will not make it unmovable this way.
Hope that helps
 
Back
Top