• 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 how make it work ?

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,484
Solutions
9
Reaction score
217
hello
my trouble is about a function setAttribute ...
see
Code:
local items = reward[math.random(3)].itemId, reward.count
    if items == 13529 then
        local mount = mounts[math.random(43)].name
        items:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'contains ' .. ItemType(mount):getName() .. '.')
    end
don't work this line
Code:
items:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'contains ' .. ItemType(mount):getName() .. '.')
why ? :S

tfs 1.2 !!!
 
Last edited:
I have a feeling that you can only set an attribute to an item once it exists as an object.
Meaning you first need to give the item to the player as a reward:
Code:
rewarditem = player:addItem(13592, reward.count)
rewarditem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "etc etc...")
On my phone so I can't test this 100%.
Had a similar issue when I was setting up a script with similar functionality.
 
I have a feeling that you can only set an attribute to an item once it exists as an object.
Meaning you first need to give the item to the player as a reward:
Code:
rewarditem = player:addItem(13592, reward.count)
rewarditem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "etc etc...")
On my phone so I can't test this 100%.
Had a similar issue when I was setting up a script with similar functionality.
I try it but not work properly
Code:
local items = reward[math.random(3)].itemId, reward.count
    winnerPlayer:addItem(items)
    if items == 13529 then
        local mount = mounts[math.random(43)].name
        items:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'contains' .. ItemType(items):getName() .. '.')
    end
I try it but not give the description
 
Code:
    local item = Game.createItem(2195, 1)
    if item then
        item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "contains ".. item:getName() ..".")
    end

    if player:addItemEx(item) ~= RETURNVALUE_NOERROR then
        return true
    end
 
Back
Top