Jump to content

Possible to add a new stat bar?


Recommended Posts

I modded wetness in so I'm gonna go with yes.

AddClassPostConstruct("widgets/statusdisplays", function(self)	local MoistureMeter = GLOBAL.require "widgets/moisturemeter"	self.moisturemeter = self:AddChild(MoistureMeter(self.owner))	self.moisturemeter:SetPosition(0,-115,0)end)
Link to comment
Share on other sites

is this mod for DST and on the workshop? I'd love to download it and see more about it!

 

It is not on the workshop. It is a bit of a mess because there are many wetness related things.

 

But what I did was add the MoistureMeter as it is in RoG and added moisture as a component to players.

 

MoistureMeter reacts on each computer using GetMoisture and GetDelta and getting rates from the player, so if the clients and the host had these values for themselves, no extra changes are needed.

 

I wasn't sure of what I was doing by the time so it's probably not optimized. (For example, in the number round ups for moisture and delta values I did, and in the string netvars I used because I had no idea about netvars.)

AddPlayerPostInit(function(player)	player:AddComponent("moisture")end)

And I attach the moisture component. It's the RoG one with host/client separations, like in Peter's The Hunt mode mod.

 

And read netvars.lua to know what netvars to use.

moisture.lua

Link to comment
Share on other sites

It's entirely possible, and from what I understand, does not require re-purposing the Moisture meter from RoG and possibly breaking all compatibility when that comes to DST.

 

Go search the workshop for "Wunk the Punk". It's single-player only as far as I remember. To make a long story short, the authors added a "drug meter" that decreases over time, and causes a sanity drain when it gets below a certain threshold as a sort of anti-drug statement. (The mod's page explains this way better than I do. x.x...)

 

Considering he's not available on DST, you'll still need DarkXero's code to make it work here.

Link to comment
Share on other sites

No repurposing needed, I just posted the moisture thing as an example. The logic is:

1) put a widget on everybody,

2) make the widget request some values when updating,

3) give these values to both host and client.

 

Host calculates, client just stores. No replicas needed.

Link to comment
Share on other sites

Would anyone be willing to share a little lesson about custom widgets? I sort of get ideas from other mods that do stuff that I want to, the only problem is I don't always know what they are doing or if what they are doing is something that I need to do, or just something that their doing for their specific purpose.

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...