Please elaborate. (What do you mean by lives? The health bar? A set number of lives?)
Also, welcome to the forums, dhyey1! Don’t forget to read the TOS and FAQ!
(ah, nevermind, I got it…)
You would want to use a property that decreases every time the player gets knocked out through block code. When it reaches 0, set the player to spectator mode.
If you want to let a player have infinite lives, you have to set the property to the number infinity. You can do this through block code by setting the property to 1/0. Read more here:
i am not new but thanks for welcome. i mean a set number of lives as listed in the text
infinite for that i dont have to set a number, its automatic. but wdym by the other thing as theres options a player can select
I would recommend that you have counters that set a Property called “Lives”, and have the starting value of the counter set to the number of lives that each button will give. When you press the button, it should reset the counter, which will set the Property to the counter value.
Then there should be a Knockout Manager that checks when the player gets knocked out. When it does, it should run a block that will decrease the Property value by 1. It should also check if the property is equal to 0 after it is decreased. If it is equal to 0, then the player should either be set to the spectator team or respawned in the menu to select their lives again.
If you want infinite lives, setting the Property to infinity will work best for the current system, or you could set the Property to a negative value with the counter system. If you want to display the lives on a Game Overlay using the negative system, you could check if the Property is less than 0, then set the Game Overlay accordingly. Using the negative value system would actually be more memory efficient since you wouldn’t have to set the property with another block.
If you would like pictures of an example, I’d be happy to provide some.
Here is the system I made. When the buttons are pressed, they reset the Counter. Each counter sets the Property “Lives,” which is player scoped at a starting value of 0. The starting value of the Counters is set to however many lives you want, and the -1 Counter gives the player infinite lives.
When the “Lives” Property changes, it broadcasts on the channel “Show lives,” which runs a block in the Game Overlay, which is set to not be visible on game start, show when receiving on “Show lives,” and hide when receiving on “Hide lives”. Both scopes are set to player. Here is the code for that block:
I decided to use a Lifecycle that checks for when the player is knocked out instead of a Knockout Manager, so that the system will work if you are knocked out by a Sentry. It is wired to an Item Granter, which runs a block on a wire pulse that updates the property. Here is the code for that:
Lastly, there is a Team Switcher device that switches to a specific team (spectator) when receiving on “Set spectator”.
I hope this helps! If you need any clarification, lmk!
thanks this really helped
This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.



