Jump to content

Removing an on-screen widget


Recommended Posts

Hello! I'm trying to get rid of the widget that displays a character's head & name when they are off-screen. If I'm correct, the widget in question is "TargetIndicator". The problem I'm having is that I can't seem to override the widget. In my mod, I have scripts > widgets > targetindicator.lua with what is essentially a husk of a widget, with the inside of all the functions removed. I would assume this would get rid of the widget but it doesn't seem to! 

To the best of my knowledge you're able to override widgets in the same manner as prefabs & "TargetIndicator" is the widget i should be looking to override, so I'm puzzled as to why this isnt working. 

Also this is for a server mod, so it should work for every player.

Link to comment
Share on other sites

> I would assume this would get rid of the widget

You should be able to.

Especially with "hooking"

> Also this is for a server mod, so it should work for every player.

Only if you set "all clients require"

The 2 settings are:

- Client-only

- All-clients-require
 

if:

Client only = true.

Then:

only runs on client (not server)
if:

Client only = false

and

all clients require = false

Then:

Only runs on server (not any clients)

 

if:

Client only = false

and

all clients require = true

Then:

Runs on server and ALL clients (but must be downloaded, or available on Steam Workshop)

 

Tbh, I think this might be the issue.

Get back to me if it's something else.

Link to comment
Share on other sites

To override a widget(which is class) you have to use AddClassPostConstruct(). I'm assuming you want the widget completely gone. In that case you could easily just Kill() the widget. Something like this:

AddClassPostConstruct("widgets/targetindicator", function(self)
	self:Kill()
end)

 

  • Like 2
Link to comment
Share on other sites

3 hours ago, -t- said:

To override a widget(which is class) you have to use AddClassPostConstruct(). I'm assuming you want the widget completely gone. In that case you could easily just Kill() the widget. Something like this:


AddClassPostConstruct("widgets/targetindicator", function(self)
	self:Kill()
end)

 

Worked, thanks man! I will utilize this information well

Link to comment
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
 Share

×
  • Create New...