# How can I change the maximum health of the player?(using verse)

**URL:** <https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, player, question, fortnite\
**Created:** [October 14, 2023, 7:51am UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071 "2023-10-14T07:51:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Messiah4213](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/messiah4213/32/764721_2.png) [@Messiah4213](https://forums.unrealengine.com/u/Messiah4213)\
**Post date:** [October 14, 2023, 7:51am UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071/1 "2023-10-14T07:51:03Z")

</div>

Hello!  
I want to ask how can I change the maximum health of the player.  
For example , if you pay 100 coin your health changes 100 to 120.

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [October 14, 2023, 11:48am UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071/2 "2023-10-14T11:48:03Z")

</div>

You can use `fort_character.SetMaxHealth(:float)` for that, you’d need to retrieve the fort\_character of the player before of course

---

<div class="post-metadata">

**Author:** ![SeedohFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seedohfn/32/720959_2.png) [@SeedohFN](https://forums.unrealengine.com/u/SeedohFN)\
**Post date:** [October 14, 2023, 11:55am UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071/3 "2023-10-14T11:55:19Z")

</div>

You can use `.SetMaxHealth()` to change the max health of a player. Here is an example:

```auto
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }

# A Verse-authored creative device that can be placed in a level
Test := class(creative_device):
    # I used button in this example. But any device that accept 'agent' can be used
    @editable Button: button_device = button_device{}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        # When interacting with the button, your max health will be set to 150
        Button.InteractedWithEvent.Subscribe(OnInteracted)

    # Set max health of the instigator to 150 
    OnInteracted(Agent: agent): void=
        if (FortChar:= Agent.GetFortCharacter[]):
            FortChar.SetMaxHealth(150.0) # Or any other value. It must be float!

```

---

<div class="post-metadata">

**Author:** ![LordTor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lordtor/32/762643_2.png) [@LordTor](https://forums.unrealengine.com/u/LordTor)\
**Post date:** [October 14, 2023, 1:12pm UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071/4 "2023-10-14T13:12:49Z")

</div>

Hello

You have access to the health of players via the `fort_character`

```auto
# Get the player list
AllPlayers := GetPlayspace().GetPlayers()

# Find the actual player
if (FortPlayer := AllPlayers[0].GetFortCharacter[]):
    Print("Player has {FortPlayer.GetMaxHealth()} HP")

    # Get the current total health of the player and increase it by 100
    Health : float = FortPlayer.GetMaxHealth() + 100.0
    FortPlayer.SetMaxHealth(Health)

    Print("New HP set to {FortPlayer.GetMaxHealth()}")

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 13, 2023, 1:13pm UTC](https://forums.unrealengine.com/t/how-can-i-change-the-maximum-health-of-the-player-using-verse/1332071/5 "2023-11-13T13:13:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
