zetake Posted July 19, 2019 Share Posted July 19, 2019 (edited) 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... Edited July 25, 2019 by zetake Link to comment https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/ Share on other sites More sharing options...
zetake Posted July 24, 2019 Author Share Posted July 24, 2019 (edited) 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 Edited July 24, 2019 by zetake Link to comment https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1231096 Share on other sites More sharing options...
zetake Posted July 24, 2019 Author Share Posted July 24, 2019 (edited) 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... Edited July 24, 2019 by zetake Link to comment https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1231373 Share on other sites More sharing options...
zetake Posted July 25, 2019 Author Share Posted July 25, 2019 (edited) 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? Edited July 25, 2019 by zetake Link to comment https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1232032 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 https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1232184 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 https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1232488 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 https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1232497 Share on other sites More sharing options...
zetake Posted July 25, 2019 Author Share Posted July 25, 2019 (edited) 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... Edited July 25, 2019 by zetake Link to comment https://forums.kleientertainment.com/forums/topic/109069-solved-inventory-bar/#findComment-1232508 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now