Skip to main content

Making a PVP health system

note

These guides assume that you know how to navigate menus, wire chips, ect. If this is not the case, please look up another tutorial.

First you will need a Player Definition Board.

Next, you will need to edit into the board and add the following chips:

  1. int Variable
  2. Event Receiver
  3. Subtract

We will be using the Projectile Hit Player event to register when the player is hit. This is a built-in event.

Next, configure the Event Receiver's event to Projectile Hit Player.

Configure the int Variable and rename it to Health, hit submit and set the value to whatever you want (this should be the max health). You can change the name to something else, but to make it clear that it's a health variable, we will be using Health.

Next, we will take away health every time the player is hit. To do this, first wire the Circuits as shown below:

Then wire the Exec ports as so:

Now every time you hit a player with a projectile, it will deal the appropriate amount of damage.

tip

You can add math chips to modify the damage coming in!

Now let's make it so the players die when they reach 0 health.

Add a Less or Equal and an If chip and wire it like so:

Next, add a Respawn Point Respawn Player chip and wire the then output of the If to the Respawn Point Respawn Player input.

Now back over here, add a Self chip

Now wire the Self output to the Player port on the Respawn Point Respawn Player chip.

Now to reset the player heath, clone the health variable we created earlier and set the input port to 100 (or your desired max health).

info

Variables with the same name and datatype will sync with each other.

Then, drag the variable next to the Respawn Point Respawn Player

Now wire the Exec port on the Respawn Point Respawn Player to the health variable input. Now when your health gets to 0, you respawn! The Circuits should look similar to this:

Congrats! You made a PVP health system!

tip

A guide on how to use the Player World UI Constant will come soon. This will be useful for displaying the player's health!