Closed Blast1113 closed 4 years ago
Your PreInit has to look like this:
function HUDELEMENT:PreInitialize()
BaseClass.PreInitialize(self)
local hud = huds.GetStored("octagonal")
if hud then
hud:ForceElement(self.id)
end
-- set as NOT fallback default
self.disabledUnlessForced = true
end
BUt looking at your addon... why did you add so may convars for the size? You have seen our HUD editor?
I probably should use the HUD editor (I might do that later). It currently doesn't because a lot of the code is directly copied from my older HUD.
That PreInit code worked perfectly! Thank you very much.
take a look at our documentation: https://docs.ttt2.neoxult.de/developers/content-creation/creating-a-hud-theme/ (still WIP)
If you derive from the scaleable HUD
all things needed for the dynamic scaling are already done
Another FYI: I don't know what you're doing with your addon, but it breaks all my HUDs
It may need some other roles installed, but it seems to work fine for me with just the jester.
Another question: You know about this addon, don't you?
https://steamcommunity.com/sharedfiles/filedetails/?id=1795267605
I know mine looks very similar to that one (and was originally based off it) but there are a lot of things I don't like about it.
Plus, there were some extra features I wanted.
TTT2 v0.6.3b
When using my custom HUD, Elements from other addons do not draw unless I use
self:ForceElement(element name)
incl_init.lua
. The other addon.It does run the
PreInitialize
,Initialize
, andGetDefaults
functions, but never runs theDraw
function.This may not be a bug and could just be a mistake I made, but I can't find anything different about my HUD than the default ones, including the element defined in the original vampire HUD.