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

Lua Lua question TFS 1.2

gubbo123

New Member
Joined
Aug 15, 2017
Messages
151
Solutions
1
Reaction score
3
Is possible add player storage using onAdditem function on movements? Any example?
 
LUA:
local storageKey = 30002
local transformations = {
    [2693] = {id = 2689},
    [6277] = {id = 2687, count = 12},
}

function onAddItem(moveitem, tileitem, position)
    local transformation = transformations[moveitem:getId()]
    if transformation then
        moveitem:transform(transformation.id, transformation.count or 1)
        position:sendMagicEffect(CONST_ME_HITBYFIRE)
        player:setStorageValue(storageKey, 1)
    end
    return true
end

Edit: forget the code above, didn't pay proper attention and didn't notice that the actor parameter has been removed from onAddItem, not sure why. Has been gone since TFS 1.0, and it looks like it's currently not possible to perform any operations on the acting creature.
 
Last edited:
Back
Top