• 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+ TFS 1.5 setCustomAttribute crash

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,338
Solutions
68
Reaction score
1,022
Whenever I try to use the setCustomAttribute lua method the server crashes. I created a talkaction that works like /attr but will just set item rarity to whatever I want.

Lua:
local talkaction = TalkAction("/rarity")

function talkaction.onSay(player, words, param)
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end
  
    local position = player:getPosition()
    position:getNextPosition(player:getDirection())

    local tile = Tile(position)
    if not tile then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is no tile in front of you.")
        return false
    end

    local thing = tile:getTopVisibleThing(player)
    if not thing then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "There is an empty tile in front of you.")
        return false
    end

    if thing:isItem() then
        thing:setCustomAttribute("Rarity", param)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format("Attribute Rarity set to: %s", param))
        position:sendMagicEffect(CONST_ME_MAGIC_GREEN)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Thing in front of you is not supported.")
        return false
    end
  
    return false
end

talkaction:separator(" ")
talkaction:register()

I upgraded my server from 1.4.2 but have made sure all source code related to custom attributes is up to date. Anyone got any ideas?

Side note the crash has to do with the hashing function.

1713545946572.png
 
Sugar boom boom bump. I have tried a bunch of different methods to use the custom attributes. Can't figure this one out.
 
Back
Top