How can i store someone’s health into a variable?

i wanna put it in a variable because i’m honestly tired of not being able to play in rounds with brigitte because her max health will double if it goes to a 2nd round, or you switch off her. can someone help me on this please?

Global.A = Health(*player*)

This sounds to me more like you got some buggy rules though.

1 Like

do you think you can look at my code? it works with symmetra too and i bet you that if you do this for example than it will do it too

Ongoing - Each Player
Team - All
Hero - Mercy

Set Max Health (1)
Wait 0.016
Add Health Pool (Health) 99.750
Add Health Pool (Shields) 98

then switch off, go to a next round, etc and it will double and change the max health to the hero you switched to

You could store the hero of the event player into a variable (Event Player.currentHero = Hero Of(Event Player))
Then have a rule:

rule - all Players, all heroes

condition:
 - or(is alive(event player), hero of(event player) != event player.currentHero) == true

action:
 - event player.currentHero = hero of(event player)
 - set max health(1)
 - wait
 - add health pool
 - add health pool

If the health pools start stacking somehow, remove the old ones before adding new health pools.

1 Like

yes it worked! however i ran into 2 problems

  1. i have brigs health at 240% to match a 599/600 shield health, when i followed your rule it did keep her max health at 250 but it put her shield health at 101/102

  2. when i switch to other heroes like mercy for example, mercys health is 202. is there anyway i could fix both of these?

I just copied your actions. Tbh I don’t have much experience with manipulating player max health. All I did so far was increasing it by percentage, wich worked well. I would have to play around with the values and see what happens.
So I can’t really help you with it, sorry.

1 Like

thanks, it’s alright. you helped a ton though!

rule("Rule 1")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
		Hero Of(Event Player) == Hero(Brigitte);
	}

	actions
	{
		Set Max Health(Event Player, 1);
		Wait(0.016, Ignore Condition);
		Add Health Pool To Player(Event Player, Shields, 99.750, True, True);
		Add Health Pool To Player(Event Player, Health, 98, True, True);
		Wait Until(!Has Spawned(Event Player) || Hero(Brigitte) != Hero Of(Event Player), 99999);
		Set Max Health(Event Player, 100);
		Remove All Health Pools From Player(Event Player);
	}}
1 Like