How to retrieve a player's information in Verse?

Hello everyone,
I would like to recover the life and shield of a player in a variable in Verse, but I don’t know how to do it. Could you help me please? Thanks in advance!

if(FortChar:=Agent.GetFortCharacter[]:
      FortChar.GetShield()
      FortChar.GetHealth()
2 Likes

Thank you so much !

1 Like

No problem, good luck on whatever you’re making that utilizes the fort character and don’t forget to read documentation for more functions regarding the fort character fort_character interface | Unreal Editor for Fortnite Documentation | Epic Developer Community

1 Like

Thanks again, you helped me out a lot. And thanks for the Epic documentation as well.

1 Like

Sorry to bother you, but my Agent is of type ?agent and no agent. So it gives me an error. Here is my code:

@editable TriggerHealth_Add1 : trigger_device = trigger_device{}

OnBegin<override>()<suspends>:void=
    TriggerHealth_Add1.TriggeredEvent.Subscribe(Health_Add1)

Health_Add1(A:?agent):void=
    if (FortChar:=A.GetFortCharacter[]):
        FortChar.GetShield()
        FortChar.GetHealth()

My mistake is at the level of the expression: if (FortChar:=A.GetFortCharacter[]): Could you help me again?

if(Agent:=Agent?,FortChar:=Agent.GetFortCharacter[]):

2 Likes

Thanks! One more question: how can you change the parameters of a class designer (maximum life, invincibility, etc …)

You can’t change a class designer at runtime, the values set in them are static you can have many class designers for each thing you want different

1 Like

Ah! The goal of my device was to change a player’s life to fully customize it. For example, when a trigger is triggered, it decreases life by 1 HP; another, it increases it by 1 HP each time they are triggered… I don’t know if I was clear in my explanations, but I can’t find a solution to this problem…

You can use Fort_Character.SetMaxHealth() etc etc as mentioned in the documentation pages to change their health accordingly

1 Like

Thank you so much !

thank you gis,

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