Unique O2 tank help

So I need an O2 system that lets you stay underwater for 75 seconds, but once you craft a specific item, it’ll be upgraded to 135 seconds. It automatically refills when you reach the surface, and a game overlay needs to show you how much you have left. It should also reset when you enter underwater structures.

I did check to find guides on this, and non of them fit my request

4 Likes

Basically you’ll have a property that holds your seconds left. There will also be another property that holds the starting seconds (or your upgrading level). When the players enters the water, block code will run that starts a trigger loop with a delay of 1 that broadcasts to a game overlay where it subtracts 1 from seconds left. There will also be a checker that checks if the seconds left property is equal to zero, and it’ll run every time the property value changes (found in the property device’s settings).
If you need any clarifications or have any questions, feel free to ask!

6 Likes

Would you use counters that update the properties, or is there a way to decrease them without that? (for future purposes)

Could you screenshot the block code and share it with me?

I mean you’re already going to need to use code for updating the overlay so using counters would be a waste since you can just update the property in the same code.

And I’m on mobile right now @Reaper_leviathan, but I’ll get you those as soon as I can!

1 Like

I don’t think there’s block code for this… I think it’s just smth like this


(just forgot about the game overlay)

–edit–
Didn’t see your latest post HtH, but you probably know I suck at block code lol. So I just used counters instead…

2 Likes

You need block code to set the original amount of the property based on your upgrades and you need code to update the game overlay.

1 Like

I FORGOT ABOUT THE OVERLA-ohhhhhhhh now I see why you need block code…

Thank you! Ima be back later, I’m going to try these

Maybe not mine, since you need to see how many seconds you have left :sweat_smile:

But for the code, it’d be pretty simple, right?

1 Like

Pretty much, just make sure to have spaces at the end of your first string and the beginning of your second string so that the number has space between the two strings. And the subtraction part is just setting the property to itself -1, and at the beginning just add an if block to see if the property =0, if it does then set it to the upgrade property. For this, make sure to have the seconds default value be 0.

Oh yeah… and also have to set it to broadcast on a channel that resets the seconds left and and the seconds underwater… (so it doesn’t keep decreasing once you’ve left the water)

This is why I just use the counters for only 50 more memory :sweat_smile:

I tried using yours, this is what it looks like so far


I used channels instead of wires for the most part, but whenever I enter the water I immediatly respawn

2 Likes

You have to wire the checker to the repeater, then the checker to the respawner.

and how would I configure the wires?

(repeater runs task > run check)
Then
(Check passes > respawn player)

I gtg but if you have questions I’ll respond tomorrow (wish I could sooner but idk my schedule’s a bit screwed up)

2 Likes

I’ve never used blocks before, can you screenshot the code?

Bro’s still got the santa hat lol

I don’t think HtH can for a bit…

1 Like

Sorry for taking so long, I had to go to bed early last night and I’ve been at a track meet all day. But here is the code for you:

4 Likes

Oop! Nevermind. I was wrong.