zetake Posted July 19, 2019 Share Posted July 19, 2019 Hi, how can I get out of nowhere HUD size and equip slots number? Or, How can I do backpack that will be like inventory bar, but on top of it. I have done it manually, because I don't know nothing about scaling... But it doesn't fit in width when other mods add equipable slots. And it doesn't match in height when HUD size is changed... Link to comment Share on other sites More sharing options...
zetake Posted July 24, 2019 Author Share Posted July 24, 2019 HUD size out of nowhere: 20*TheFrontEnd:GetHUDScale()-15 But container widget isn't updated after HUD size change... -.- EDIT: Corrected code for HUD size out of nowhere: (TheFrontEnd:GetHUDScale()-0.75)/0.035 -- From 0 to 10. I thought scale was from 0.75 to 1.25, but it is from 0.75 to 1.1 Link to comment Share on other sites More sharing options...
zetake Posted July 24, 2019 Author Share Posted July 24, 2019 This works after pause. inst:ListenForEvent("continuefrompause", function() print("---------------") print("HELLLLLLLLOOO") end, GetWorld()) But I don't know how can I get container out of nowhere or how to update widget from there... Because isnt from there is the map... -.- not my container... Link to comment Share on other sites More sharing options...
zetake Posted July 25, 2019 Author Share Posted July 25, 2019 Correction... It gets container inst if it is in fn() and not function(inst) But, I didn't know about it, because to update container widget, container must be open again... With this code now it works... Spoiler local con = inst.components.container inst:ListenForEvent("continuefrompause", function() local hs = (TheFrontEnd:GetHUDScale()-0.75)/0.035 if hs ~= con.hsize then con.widgetpos = Vector3(xpos, n*hs-ypos, 0) if con:IsOpen() then local owner = inst.components.inventoryitem.owner con:Close(owner) con:Open(owner) end con.hsize = hs end end, GetWorld()) Back to sesond problem, how to get number of equip slots out of nowhere? Link to comment Share on other sites More sharing options...
Ultroman Posted July 25, 2019 Share Posted July 25, 2019 Try this: print("Num of equipslots: "..#GLOBAL.EQUIPSLOT) Link to comment Share on other sites More sharing options...
zetake Posted July 25, 2019 Author Share Posted July 25, 2019 After all day of scaling, this seems to be most correct... ypos = ((22.4-(0.7*hs))*hs)-394+(0.14*hs*(hs-10)) Am I missing something? Why HUD size is twisting size so much? LEL Numbers to be show in print needs tostring(), and your variable wasn't correct... This one return number of equip slots out of mods! LOL print("Num of equipslots: "..tostring(#EQUIPSLOTS)) Now only problem is if these extra slots will be next to vanilla or not... But I don't think I want to tweak anymore.. Link to comment Share on other sites More sharing options...
Ultroman Posted July 25, 2019 Share Posted July 25, 2019 Just now, zetake said: Numbers to be show in print needs tostring(), and your variable wasn't correct... This one return number of equip slots out of mods! LOL print("Num of equipslots: "..tostring(#EQUIPSLOTS)) Yeah, it was just an idea off the top of my head to point you in a direction, and you got there Just now, zetake said: After all day of scaling, this seems to be most correct... ypos = ((22.4-(0.7*hs))*hs)-394+(0.14*hs*(hs-10)) Am I missing something? Why HUD size is twisting size so much? LEL Resolutions and aspect ratios would be my guess. Usually you design for one main resolution, and then code a UI system which automatically positions and resizes everything for all the other resolutions and aspect ratios. Link to comment Share on other sites More sharing options...
zetake Posted July 25, 2019 Author Share Posted July 25, 2019 For xpos it was 25 per slot... And it was perfect match on the first try... >.< (Eh, that ypos) I think some exponents were involved... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.