I'm implementing a rarity system on my server, but for that, it seems I need to do everything from 0 (since I can't find it anywhere around)
One of the things in the rarity system that I want to do, is also to put the item description for when I hover over it. I'm doing it based on what @Fresh commented on
:
Item stats on Hover-Mouse (https://otland.net/threads/item-stats-on-hover-mouse.272007/)
However, I would like to humbly ask someone to teach me how I would create a new tooltip (you can only create 1, everything else I do based on the example)
I wanted something like this:
~(Hover over the helmet)~
Kaguya Helmet <img.png>
Attack +10
Defense +60
protection all +20%
reflect +10%
drop chance +20%
~ALL GOLD COLOR~
actually my code is like that:
One of the things in the rarity system that I want to do, is also to put the item description for when I hover over it. I'm doing it based on what @Fresh commented on
:
Item stats on Hover-Mouse (https://otland.net/threads/item-stats-on-hover-mouse.272007/)
However, I would like to humbly ask someone to teach me how I would create a new tooltip (you can only create 1, everything else I do based on the example)
I wanted something like this:
~(Hover over the helmet)~
Kaguya Helmet <img.png>
Attack +10
Defense +60
protection all +20%
reflect +10%
drop chance +20%
~ALL GOLD COLOR~
actually my code is like that:
Lua:
local item = self:getItem()
if item and not self:getTooltip() then
local itemsList = {
[10842] = {name = "Kaguya Helmet", attack = 20, defense = 0, protection_all = 20, reflect = 10, drop_chance = 20}
}
local data = itemsList[item:getId()]
if data then
local description = 'This is ' .. item:getCount() .. 'x ' .. data.name .. ', Raridade ' .. data.raridade
if data.attack then
description = description .. ' Attack: ' .. data.attack .. '.'
end
if data.defense then
description = description .. ' Defense: ' .. data.defense .. '.'
end
self:setTooltip('Description: ' .. description)
else
print(item:getId())
self:setTooltip('No description')
end
end