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

script modification tfs1.2

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
itemid="3482"
when i move this item 3482 transform on item 3481, right... if i move this item 3482 on a stack of items 3482, how to tranform all on item 3481? not only one.

my movement script
Lua:
function onRemoveItem(item, tileitem, position)
    if item:getPosition():getDistance(position) > 0 then
        item:transform(3481, 1)
        item:decay()
        item:getPosition():sendMagicEffect(3)
    end
    return true
end
 
Code:
local pos = {x = 0, y = 0, z = 0}
local tile = Tile(pos)
local amount = tile:getItems()

for i = 1, #amount do
    if amount[i].itemid == 3481 then
    amount[i]:transform(3482)
    end
end

I am not exactly understanding what you want, but this should help you i guess? :D

Animera
 
no work ;/
I'm looking for a way to not let players stack open traps in the same sqm...
my trap open is id 3482 and closed 3481, i want when a player move a open trap under others open traps, all traps of sqm close instantly
 
test now:
Code:
if toPosition.x ~= CONTAINER_POSITION then
        local tile = toPosition:getTile()
        local traps = tile:getItems() or {}
        for _, trap in pairs(traps) do
            if trap.itemid == 3482 then
                trap:transform(3481)
            end
        end
    end
 
Back
Top