Add Health Pool to Player Problem

Wondering if I can stop adding health to player after a specific amount of times. For example, I made it so every time an enemy is damaged by Roadhog hook his max health will increase by 30. I want to stop when he would get 450 max health but it keeps continuing to increase the max health. I’ve tried multiple options but nothing seems to be working. Anyone got an idea on how to solve this?

whats your current way of handleing this?
personally I would just make it a variable and increase it everytime he gets a hook and the variable is under 450

I have 2 attempts you may can check out first one:

variables
{
	player:
		0: HealthToAdd
		1: MaxHealthToAdd
		2: HealthPoolID
}

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

	conditions
	{
		Hero Of(Event Player) == Hero(Roadhog);
	}

	actions
	{
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
		Event Player.HealthPoolID = Null;
	}
}

rule("Swapped Hero")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Hero Of(Event Player) != Hero(Roadhog);
	}

	actions
	{
		Remove Health Pool From Player(Event Player.HealthPoolID);
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 0;
		Event Player.HealthPoolID = Null;
	}
}

rule("Roadhog died")
{
	event
	{
		Player Died;
		All;
		Roadhog;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.HealthPoolID = Null;
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
	}
}

rule("Roadhog left game")
{
	event
	{
		Player Left Match;
		All;
		Roadhog;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.HealthPoolID = Null;
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
	}
}

rule("Add healthpool to Roadhog")
{
	event
	{
		Player Dealt Damage;
		All;
		Roadhog;
	}

	conditions
	{
		Event Ability == Button(Ability 1);
	}

	actions
	{
		Skip If(Event Player.HealthPoolID != Null, 2);
		Add Health Pool To Player(Event Player, Health, Event Player.HealthToAdd, True, True);
		Event Player.HealthPoolID = Last Created Health Pool;
		Event Player.HealthToAdd += 30;
	}
}

rule("Additional healthpool reaches 450 eg. 600 base HP + 450 HP = 1050 HP")
{
	event
	{
		Ongoing - Each Player;
		All;
		Roadhog;
	}

	conditions
	{
		Event Player.HealthToAdd > Event Player.MaxHealthToAdd;
	}

	actions
	{
		Event Player.HealthToAdd = Event Player.MaxHealthToAdd;
	}
}

second:

variables
{
	player:
		0: HealthToAdd
		1: MaxHealthToAdd
		2: HealthPoolID
}

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

	conditions
	{
		Hero Of(Event Player) == Hero(Roadhog);
	}

	actions
	{
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
		Event Player.HealthPoolID = Null;
	}
}

rule("Swapped Hero")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Hero Of(Event Player) != Hero(Roadhog);
	}

	actions
	{
		Remove Health Pool From Player(Event Player.HealthPoolID);
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 0;
		Event Player.HealthPoolID = Null;
	}
}

rule("Roadhog died")
{
	event
	{
		Player Died;
		All;
		Roadhog;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.HealthPoolID = Null;
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
	}
}

rule("Roadhog left game")
{
	event
	{
		Player Left Match;
		All;
		Roadhog;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.HealthPoolID = Null;
		Event Player.HealthToAdd = 0;
		Event Player.MaxHealthToAdd = 450;
	}
}

rule("Add healthpool to Roadhog")
{
	event
	{
		Player Dealt Damage;
		All;
		Roadhog;
	}

	conditions
	{
		Event Ability == Button(Ability 1);
		Event Player.HealthToAdd < Event Player.MaxHealthToAdd;
	}

	actions
	{
		Skip If(Event Player.HealthPoolID != Null, 2);
		Add Health Pool To Player(Event Player, Health, Event Player.HealthToAdd, True, True);
		Event Player.HealthPoolID = Last Created Health Pool;
		Event Player.HealthToAdd += 30;
	}
}
1 Like

Damn been a while. Appreciate that I’ll see if it will work

No problem, if there are any issues feel free to share them here. The one thing i see contextually problematic after i reread the code snippets i provided, is that within the Damage Event rule section Event Player may need to be switched and replaced with Attacker, i thought i resolved it that time ago seems i forgot.

1 Like