Jump to content

Recommended Posts

I'm not sure what happened, My widget USED to work before but now it doesn't! All I did was some extra code. I have no reverted to my original code but it's still not working! I'm not sure what to do anymore and im smashing my head on the keyboard at this point. Any help is deeply appreciated.

Quote

local Widget = require "widgets/widget"
local UIAnim = require "widgets/uianim"

local NearSighted = Class(Widget, function(self, owner)
    self.owner = owner
    Widget._ctor(self, "NearSighted")
    self:SetClickable(false)
    
    self.bg2 = self:AddChild(Image("images/fx5.xml", "fog_over.tex"))
    self.bg2:SetVRegPoint(ANCHOR_MIDDLE)
    self.bg2:SetHRegPoint(ANCHOR_MIDDLE)
    self.bg2:SetVAnchor(ANCHOR_MIDDLE)
    self.bg2:SetHAnchor(ANCHOR_MIDDLE)
    self.bg2:SetScaleMode(SCALEMODE_FILLSCREEN)
    
    self.inst:DoPeriodicTask(0.1, function() return self:CheckPlayerStatus() end)

    self.alpha = 0
    self.alphagoal = 0
    self.transitiontime = 2.0
    self.time = self.transitiontime

    self:Hide()
end)

function NearSighted:CheckPlayerStatus(data)
    local hat = self.owner.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
    if self.inst:HasTag("nearsighted") then
        self:Show()
    --else
        --self:Hide()
        --if hat and hat:HasTag("nearsighted_glasses") then
            --self:Hide()
        end
    end
--end

return NearSighted

Quote

--Modmain

Assets = {

    Asset("IMAGE", "images/fx5.tex"),
    Asset("ATLAS", "images/fx5.xml"),

}


AddClassPostConstruct( "widgets/controls", function(self)
    local ownr = self.owner
    if ownr == nil then return end
    local NearSighted = require "widgets/nearsighted"
    self.nearsighted = self:AddChild( NearSighted(ownr) )
end)

Note: Yes my character has the tag "nearsighted"

Link to comment
https://forums.kleientertainment.com/forums/topic/105365-widget-not-appearing/
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...