• 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!

Windows RME Map editor, how to make item unmovable?

Nekiro

Legendary OT User
TFS Developer
Joined
Sep 7, 2015
Messages
2,677
Solutions
126
Reaction score
2,112
How to make item not movable?

I have many items on my new island so i need to make it unmovable, because people will steal XD
I dont want to put uniqueid on every item.
 
1. if you use client without "browse field" feature you may try putting id 1548 on them
2. if you use TFS 1.x there is event player: onMoveItem() in data\events, enabling it and returning false in some cases should do the trick
 
1. if you use client without "browse field" feature you may try putting id 1548 on them
2. if you use TFS 1.x there is event player: onMoveItem() in data\events, enabling it and returning false in some cases should do the trick
search for 'something sparkling' put it on any item and it wont be movable in-game anymore :)

Pretty sure you can add a AID/UID to it to make it unmovable.
 
Pretty sure you can add a AID/UID to it to make it unmovable.
if the item is "useable" like a rune/potion, you can move it by use it a few sqms away.. the character will pick up the item and walk to the position to move it. (unless you have a protection against this in sources)
 
What does that mean? I dont really get it.
I've been using it for ages and no one was able to take anything.
If any item is under this item "something special" is movable when u look at it thru browse field.
 
Well just set up Unique ID (so that no one take it from browse field).
Then put itemid ( 8046 or 8047) if you want so. (if you use client that don't support browse field this is better solution.)
 
For TFS 1.x
Search at you data\events\scripts\player.lua for function Player: onMoveItem(item, count, fromPosition, toPosition) change for the one bellow.
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
   if item.actionid == 101 then
     self:sendCancelMessage('You cannot move this object.')
     return false
   end
   return true
end

Enable it <event class="Player" method="onBrowseField" enabled="1" /> at data\events\events.xml

Now just add actionid 101 to any item you don't want players to move. Notice that people could still hack it, they can use browse field to trade the item with other player, it will still be unable to be moved while inside the container though.
 
For TFS 1.x
Search at you data\events\scripts\player.lua for function Player: onMoveItem(item, count, fromPosition, toPosition) change for the one bellow.
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
   if item.actionid == 101 then
     self:sendCancelMessage('You cannot move this object.')
     return false
   end
   return true
end

Enable it <event class="Player" method="onBrowseField" enabled="1" /> at data\events\events.xml

Now just add actionid 101 to any item you don't want players to move. Notice that people could still hack it, they can use browse field to trade the item with other player, it will still be unable to be moved while inside the container though.
it does work, but you can trade the item i have tested it. is there a way to disable trade in items with this aid?
 
The laziest way I could think of would just be to stuff an area check in onMoveItem(), and if it passes just deny any kind of item moving period.

But god knows how much CPU time that is going to waste doing a check every single time someone moves any item anywhere.

With that in mind... if the way to that island is a specific limited path, you could just put two "onWalkOn()" tiles on the floor, that turns off and on the players ability to move any floor items, when they walk to and from the island respectively. That might be a cheaper check, since you're effectively just checking a single storage value.

For flavor you could add some message to the player saying something like... "The presence of God in this place seems to hinder your hand." or something along those lines.
 
How about blocking a square area with isInRange?

data/scripts/example.lua
Lua:
local protectedArea = {
    from = Position(3197, 1807, 7),
    to = Position(3198, 1811, 7)
}

local ec = EventCallback

function ec.onMoveItem(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if fromPosition.x == CONTAINER_POSITION then
        fromPosition = item:getTopParent():getPosition()
    end

    if fromPosition:isInRange(protectedArea.from, protectedArea.to) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "iwi")
        return false
    end
    return true
end

ec:register(-666)

-- Prevent that can be taken with trade
local ec = EventCallback

function ec.onTradeRequest(player, target, item)
    local position
    local topParent = item:getTopParent()
    if not topParent then
        position = item:getPosition()
    elseif getmetatable(topParent) == Container then
        position = topParent:getPosition()
    end

    if position and position:isInRange(protectedArea.from, protectedArea.to) then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "iwi")
        return false
    end
    return true
end

ec:register(-666)
 
Last edited:
Back
Top