• 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 Something sparkling problem

cykor119

New Member
Joined
Aug 8, 2010
Messages
151
Solutions
1
Reaction score
4
Hello
I got problem in 10.9+, when want use item with ActionID.
When I'm have item set actionId and on him have "something sparkling" (8047 and next 8046), the TFS smack the set actions (lack of reaction in the script).

eBierd1.png


https://imgur.com/a/h2xfw
Is the same code... green - react, red - no react

In tfs 8.X and 9.X the sparkling block item, but if the item have set actionId, You can be used... now no.
I have second ask.. becouse when I got some items below spark and using "browse field" i can put out items below sparking... (its wrong, becouse before sparking blocking all items on the floor).
 
try this?
events/scripts/player.lua
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
    if fromPosition.z ~= 0 and isInArray({8046, 8047}, Tile(fromPosition):getTopDownItem():getId()) then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, 'You may not take this item.')
        return false
    end
    return true
end
 
@Summ

It too doesn't work

@Xeraphus

When i pick items from "browse field", then fromPosition is (x65535,y76,z0) so that is why your script doesn't work :E
 
Last edited:
Tile(fromPosition):getTopDownItem():getId()
its wrong, becouse fromPosition have always (x65535,y76,z0) when want put out "browse field". Items ID can't be check from "getTopDownItems" with this x,y,z.
 
Code:
fieldPos = {}
function Player:onBrowseField(position)
    fieldPos[self:getId()] = position
    return true
end
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
    local pos = fieldPos[self:getId()]
    if pos then
        if isInArray({8046, 8047}, pos:getTopDownItem():getId()) then
            self:sendTextMessage(MESSAGE_STATUS_SMALL, 'You may not take this item.')
            return false
        end
    end
    return true
end
 
I would put the action id on the sparklings.
And unique id on the items under sparklings to not move them.
you could just put the same actionid for each item and make a script to not be able to move them, this is a bad solution though
every time you wanted to put something under a sparkle you would have to put the action id on it through map editor, this would just waste your time mapping instead of having a script work for items under sparkle as top item

Code:
fieldPos = {}
function Player:onBrowseField(position)
    fieldPos[self:getId()] = position
    return true
end
Code:
function Player:onMoveItem(item, count, fromPosition, toPosition)
    local pos = fieldPos[self:getId()]
    if pos then
        if isInArray({8047, 8046}, Tile(pos):getTopDownItem():getId()) then
            self:sendTextMessage(MESSAGE_STATUS_SMALL, 'You may not take this item.')
            return false
        end
    end
    return true
end
tested, works
 
Last edited by a moderator:
@Xeraphus

Its great idea... but its avaiable to bugged.
Why?
Becouse if you use twice or more "browsing field" and old browsing still take open... then Your fieldPos table have new positions. Then allowing move items from all browsing fields with you have actually open (with sparkling too), becouse you check only one newest position.
But than you, becouse you give me idea: "If you browse field allow to that, if you don't browsing example sparkle".

So:
Code:
function Player:onBrowseField(position)
    local tile = Tile(position)
    if not tile then
        return false
    end

    local tileItems = tile:getItems()
    for k, item in ipairs(tileItems) do
        if isInArray(blockBrowseFields, item:getId()) then
            return false
        end
    end

    return true
end

and in example lib:
blockBrowseFields = {8046, 8047, 1512, 1513}



So... One of the questions was explained :)
But i have main Questions... Why can not I use the action item's Id, which is a sparkling. (if i set action in sparking its too not done).

eBierd1.png


The same action ID(800) in x3 gems.
Green is without spark = it done.
Red is with spark = it not done.

Its very simple to think why: becouse if you stack example one box with aid X, and second box with aid X on the same position, then if you click "use" on the stack items, then you use only "Top" action id.
In 0.4 you been allow using when sparking is above him, now not. Its bugged in tfs source maybe?
 
Last edited:
@Xeraphus

Its great idea... but its avaiable to bugged.
Why?
Becouse if you use twice or more "browsing field" and old browsing still take open... then Your fieldPos table have new positions. Then allowing move items from all browsing fields with you have actually open (with sparkling too), becouse you check only one newest position.
But than you, becouse you give me idea: "If you browse field allow to that, if you don't browsing example sparkle".

So:
Code:
function Player:onBrowseField(position)
    local tile = Tile(position)
    if not tile then
        return false
    end

    local tileItems = tile:getItems()
    for k, item in ipairs(tileItems) do
        if isInArray(blockBrowseFields, item:getId()) then
            return false
        end
    end

    return true
end

and in example lib:
blockBrowseFields = {8046, 8047, 1512, 1513}



So... One of the questions was explained :)
But i have main Questions... Why can not I use the action item's Id, which is a sparkling. (if i set action in sparking its too not done).

eBierd1.png


The same action ID(800) in x3 gems.
Green is without spark = it done.
Red is with spark = it not done.

Its very simple to think why: becouse if you stack example one box with aid X, and second box with aid X on the same position, then if you click "use" on the stack items, then you use only "Top" action id.
In 0.4 you been allow using when sparking is above him, now not. Its bugged in tfs source maybe?
just do it with actionid way for now i guess
 
Back
Top