I use this code in all my maps to heal a player, use it like this or add to it if you want!
HealAgent<public>(Agent:agent, Amount:float):void={
if(FortCharacter := Agent.GetFortCharacter[]):
HP := FortCharacter.GetHealth()
Shield := FortCharacter.GetShield()
HPMissing := FortCharacter.GetMaxHealth() - HP
FortCharacter.SetHealth(Clamp(HP + Amount,0.0,FortCharacter.GetMaxHealth()))
FortCharacter.SetShield(Clamp(Shield + Clamp(Amount - HPMissing,0.0,Amount),0.0,FortCharacter.GetMaxShield()))
}
Example: Heal player for 3s, +10 healing per second, on elimination
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
example := class(creative_device):
@editable EliminationManager:elimination_manager_device = elimination_manager_device{}
OnBegin<override>()<suspends>:void={
EliminationManager.EliminationEvent.Subscribe(PlayerEliminatedHelper)
}
PlayerEliminatedHelper<private>(MaybeAgent:?agent):void={
if( Agent:= MaybeAgent?):
spawn{PlayerEliminated(Agent)}
}
PlayerEliminated<private>(Agent:agent)<suspends>:void={
for(I:=0..2):
HealAgent(Agent,10)
Sleep(1.0)
}