© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
9 replies
Light of the World

Struggling with a passive regeneration

Hello, uhm... I'm working with a mod for a game which is not really my own, I've "owned" the mod for a couple years now but the mod was not originally my own, I mention that because I don't really understand how everything in here actually works? Anyways, what I'm currently struggling to do is add a little bit of passive regneration to a dome shield. In the screenshot are two bits of code, the top half is unrelated to passive regenration but you can see the bottom half is heavily based off the top half. What the top half does is check to see if the shield is at or above 40% health while the shield is off, in which case it will turn itself back on (and set the
CurrentDamageSustained
CurrentDamageSustained
to 40% of
ShieldStats.MaxEnergy
ShieldStats.MaxEnergy
. The bottom half is my attempt to add a passive regeneration. What I'm wanting to do is, if the shield is on and not at full health, regenerate
ShieldStats.PassiveRegen
ShieldStats.PassiveRegen
amount of health every 2 seconds (the 2 seconds bit, as you can see, is not added yet.)) Admittedly, I am working with a very complex mod while not having any C# coding experience outside of this mod, so I've been able to do a couple small things before, but only with guidance from other people. Now that I'm in this server, I want to try asking in here.

This is my first time posting here so let me know if I did something wrong in terms of any rules here 😅
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Struggling with JSON
C#CC# / help
16mo ago
Struggling with constructor
C#CC# / help
2y ago
✅ Struggling with c#
C#CC# / help
3y ago
❔ struggling with classes again
C#CC# / help
3y ago