- Joined
- Jun 26, 2020
- Messages
- 1,927
Hello, I'm creating a save-load system, also a menu for that, it shows what items have, for the charged items I wanna also show how many charges have, the thing is I don't know how to get if a item is charged only with the type-id so I opted to create the item for get that information, the thing is (I just notice it now) where I create the item is in a
if player == GetLocalPlayer() then
block causing a desync, and it would be a mess put it outside, unless you have a better solution, this is the function:
Lua:
-- This function always should be in a "if player == GetLocalPlayer() then" block
local function UpdateInformation()
local data = PlayerDatas[LocalPlayer][Pressed[LocalPlayer]]
if data then
BlzFrameSetText(TooltipName, "|cffff6600Information|r")
BlzFrameSetText(TooltipGold, "|cffFFCC00Gold: |r" .. data.gold)
BlzFrameSetText(TooltipLumber, "|cff20bc20Lumber: |r" .. data.lumber)
for i = 1, #data.digimons do
local s = ""
local inv = data.inventories[i]
for j = 0, 5 do
if inv.items[j] then
local m = CreateItem(inv.items[j], 0, 0) -- I don't know how to get the name and the class with only the type id
s = s .. GetItemName(m)
if GetItemType(m) == ITEM_TYPE_CHARGED then
s = s .. "(" .. inv.charges[j] .. ")"
end
RemoveItem(m)
if j ~= 5 then
s = s .. ", "
end
end
end
BlzFrameSetText(TooltipDigimonItemsT[i-1], "|cff00ffffItems: |r" .. s)
BlzFrameSetTexture(TooltipDigimonIconT[i-1], BlzGetAbilityIcon(data.digimons[i]), 0, true)
BlzFrameSetText(TextTooltipLevelT[i-1], "|cffFFCC00Level " .. data.levels[i] .. "|r")
end
else
BlzFrameSetText(TooltipName, "|cffff6600Empty|r")
BlzFrameSetText(TooltipGold, "|cffFFCC00Gold:|r")
BlzFrameSetText(TooltipLumber, "|cff20bc20Lumber:|r")
for i = 0, 5 do
BlzFrameSetText(TooltipDigimonItemsT[i], "|cff00ffffItems:|r")
BlzFrameSetTexture(TooltipDigimonIconT[i], "ReplaceableTextures\\CommandButtons\\BTNCancel.blp", 0, true)
BlzFrameSetText(TextTooltipLevelT[i], "|cffFFCC00Level 0|r")
end
end
end
Last edited: