Two separate health pools for a character

Basically, what I’m trying to do is make Ramattra’s health function as if he’s two different characters.

In his first form, I want to have 2250, and in the 2nd, 3000. I’m attempting to make it so that whatever health he had before he transformed is the heath he has when he goes back to that form.

So, instead of Nemesis form giving him X amount of Armor, I want it to have a separate health pool of 50% health and 50% armor.

What I want to do as well, have a slow heal over time for the form he’s not using. This should be the easy part, which I haven’t tried implementing yet, because I can’t get the first part of this thing working yet.

Its seems to currently not working properly for Ramattra, cause the detection of Is In Alternate Form or Is Using Ability 1 fails, you can check it only if he is using ultimate or not. So very limitted as of right now. Here is an example working with if Ramattra uses Ultimate:

variables
{
	player:
		0: FirstFormHealthTuple
		1: NemesisFormHealthTuple
		2: RecentFirstFormHealth
		3: RecentNemesisFormHealth
		4: TemporaryHealthID
		5: TemporaryTuple
		6: FormFlag
}

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

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

	actions
	{
		Event Player.FirstFormHealthTuple = Array(900, 900);
		Event Player.NemesisFormHealthTuple = Array(1162.500, 1162.500);
		Event Player.RecentFirstFormHealth = 0;
		Event Player.RecentNemesisFormHealth = 0;
		Event Player.TemporaryTuple = Array(Null, Null);
		Event Player.FormFlag = Null;
	}
}

rule("First Form")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ramattra;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		!Is Using Ultimate(Event Player) == True;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
		Event Player.TemporaryTuple = Event Player.FirstFormHealthTuple;
		Add Health Pool To Player(Event Player, Health, Event Player.TemporaryTuple[0], True, True);
		Event Player.TemporaryHealthID[0] = Last Created Health Pool;
		Add Health Pool To Player(Event Player, Armor, Event Player.TemporaryTuple[1], True, True);
		Event Player.TemporaryHealthID[1] = Last Created Health Pool;
		Wait(0.016, Ignore Condition);
		Set Player Health(Event Player, Event Player.RecentFirstFormHealth == Null ? Max Health(Event Player)
			: Event Player.RecentFirstFormHealth);
		Event Player.FormFlag = False;
	}
}

rule("Register Recent First form health after damage")
{
	event
	{
		Player Took Damage;
		All;
		Ramattra;
	}

	conditions
	{
		!Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentFirstFormHealth = Health(Event Player);
	}
}

rule("Register Recent First form health after healing")
{
	event
	{
		Player Received Healing;
		All;
		Ramattra;
	}

	conditions
	{
		!Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentFirstFormHealth = Health(Event Player);
	}
}

rule("Nemesis Form")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ramattra;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		Is Using Ultimate(Event Player) == True;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
		Event Player.TemporaryTuple = Event Player.NemesisFormHealthTuple;
		Add Health Pool To Player(Event Player, Health, Event Player.TemporaryTuple[0], True, True);
		Event Player.TemporaryHealthID[0] = Last Created Health Pool;
		Add Health Pool To Player(Event Player, Armor, Event Player.TemporaryTuple[1], True, True);
		Event Player.TemporaryHealthID[1] = Last Created Health Pool;
		Wait(0.016, Ignore Condition);
		Set Player Health(Event Player, Event Player.RecentNemesisFormHealth == Null ? Max Health(Event Player)
			: Event Player.RecentNemesisFormHealth);
		Event Player.FormFlag = True;
	}
}

rule("Register Recent Nemesis form health after damage")
{
	event
	{
		Player Took Damage;
		All;
		Ramattra;
	}

	conditions
	{
		Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentNemesisFormHealth = Health(Event Player);
	}
}

rule("Register Recent Nemesis form health after healing")
{
	event
	{
		Player Received Healing;
		All;
		Ramattra;
	}

	conditions
	{
		Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentNemesisFormHealth = Health(Event Player);
	}
}

rule("Deinitialize if Not Ramattra")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

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

	actions
	{
		Event Player.FirstFormHealthTuple = Null;
		Event Player.NemesisFormHealthTuple = Null;
		Event Player.RecentFirstFormHealth = 0;
		Event Player.RecentNemesisFormHealth = 0;
		Event Player.TemporaryTuple = Null;
		Event Player.FormFlag = Null;
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
	}
}

EDIT
For your case i found a workaround:

Summary
variables
{
	player:
		0: FirstFormHealthTuple
		1: NemesisFormHealthTuple
		2: RecentFirstFormHealth
		3: RecentNemesisFormHealth
		4: TemporaryHealthID
		5: TemporaryTuple
		6: FormFlag
}

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

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

	actions
	{
		Event Player.FirstFormHealthTuple = Array(900, 900);
		Event Player.NemesisFormHealthTuple = Array(1162.500, 1162.500);
		Event Player.RecentFirstFormHealth = 0;
		Event Player.RecentNemesisFormHealth = 0;
		Event Player.TemporaryTuple = Array(Null, Null);
		Event Player.FormFlag = Null;
	}
}

rule("First Form")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ramattra;
	}

	conditions
	{
		Is Alive(Event Player) == True;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
		Event Player.TemporaryTuple = Event Player.FirstFormHealthTuple;
		Add Health Pool To Player(Event Player, Health, Event Player.TemporaryTuple[0], True, True);
		Event Player.TemporaryHealthID[0] = Last Created Health Pool;
		Add Health Pool To Player(Event Player, Armor, Event Player.TemporaryTuple[1], True, True);
		Event Player.TemporaryHealthID[1] = Last Created Health Pool;
		Wait(0.016, Ignore Condition);
		Set Player Health(Event Player, Event Player.RecentFirstFormHealth == Null ? Max Health(Event Player)
			: Event Player.RecentFirstFormHealth);
		Event Player.FormFlag = False;
	}
}

rule("Register Recent First form health after damage")
{
	event
	{
		Player Took Damage;
		All;
		Ramattra;
	}

	conditions
	{
		!Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentFirstFormHealth = Health(Event Player);
	}
}

rule("Register Recent First form health after healing")
{
	event
	{
		Player Received Healing;
		All;
		Ramattra;
	}

	conditions
	{
		!Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentFirstFormHealth = Health(Event Player);
	}
}

rule("Nemesis Form")
{
	event
	{
		Ongoing - Each Player;
		All;
		Ramattra;
	}

	conditions
	{
		Is Alive(Event Player) == True;
		(Is Button Held(Event Player, Button(Ability 1)) || Is Using Ultimate(Event Player)) == True;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
		Event Player.TemporaryTuple = Event Player.NemesisFormHealthTuple;
		Add Health Pool To Player(Event Player, Health, Event Player.TemporaryTuple[0], True, True);
		Event Player.TemporaryHealthID[0] = Last Created Health Pool;
		Add Health Pool To Player(Event Player, Armor, Event Player.TemporaryTuple[1], True, True);
		Event Player.TemporaryHealthID[1] = Last Created Health Pool;
		Wait(0.016, Ignore Condition);
		Set Player Health(Event Player, Event Player.RecentNemesisFormHealth == Null ? Max Health(Event Player)
			: Event Player.RecentNemesisFormHealth);
		Event Player.FormFlag = True;
	}
}

rule("Register Recent Nemesis form health after damage")
{
	event
	{
		Player Took Damage;
		All;
		Ramattra;
	}

	conditions
	{
		Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentNemesisFormHealth = Health(Event Player);
	}
}

rule("Register Recent Nemesis form health after healing")
{
	event
	{
		Player Received Healing;
		All;
		Ramattra;
	}

	conditions
	{
		Event Player.FormFlag == True;
	}

	actions
	{
		Event Player.RecentNemesisFormHealth = Health(Event Player);
	}
}

rule("Deinitialize if Not Ramattra")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

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

	actions
	{
		Event Player.FirstFormHealthTuple = Null;
		Event Player.NemesisFormHealthTuple = Null;
		Event Player.RecentFirstFormHealth = 0;
		Event Player.RecentNemesisFormHealth = 0;
		Event Player.TemporaryTuple = Null;
		Event Player.FormFlag = Null;
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
	}
}

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

	conditions
	{
		Is Alive(Event Player) == True;
		Event Player.FormFlag == True;
		(Max Health(Event Player) > 2250 && Max Health(Event Player) < 3000) == True;
	}

	actions
	{
		Remove All Health Pools From Player(Event Player);
		Event Player.TemporaryHealthID = Null;
		Event Player.TemporaryTuple = Event Player.FirstFormHealthTuple;
		Add Health Pool To Player(Event Player, Health, Event Player.TemporaryTuple[0], True, True);
		Event Player.TemporaryHealthID[0] = Last Created Health Pool;
		Add Health Pool To Player(Event Player, Armor, Event Player.TemporaryTuple[1], True, True);
		Event Player.TemporaryHealthID[1] = Last Created Health Pool;
		Wait(0.016, Ignore Condition);
		Set Player Health(Event Player, Event Player.RecentFirstFormHealth == Null ? Max Health(Event Player)
			: Event Player.RecentFirstFormHealth);
		Event Player.FormFlag = False;
	}
}
1 Like

Before the alt form was ossible, I did the same thing for dva. it worked, but was a nuisance.

I had to chech for if she was getting a health pack why demeching, using ultimates, etc.

All that old code has since been scrapped but I’ll give this code a try when i get to my pc.

I checked for height positions and if the character existed before, as well.
Thanks.

No problem, maybe the workaround edit will make at least function better, i forgot we can also check for Health differences by comparing the healths in any form. That workaround does not change the fact that some actions or issues around workshop solely still apply and needs to be fixed. And no problem enjoy :smiley:

1 Like

Well, this was much better than I was able to do, since it’s actually working, lol.

But now I’m curious if it’s possible to give infinite time to Nemesis form.

The one glitch I found was, if he uses nemesis form at the instance he comes out of it, the health is incorrect. I’ll put the cooldown timer back on since it’s only available for 8 seconds.

After pasting it into the game mode, it’s suddenly not functioning properly.

Share code: M6BQ4

Hm…, i will look deeper into it, cause if i use it plain with my default workshop/custom game setup it works fine with your new values, your code somehow overrides Ramattras Max Health in a rule, somewhere at some time, so it distorts the health value.

Keep in mind
Base Form Additional Health Pool = (Desired Max Health - 450 if base health percentage is 100%) / 2
Base Form Additional Amor Pool = Base Form Additional Health Pool;

and for Nemesis
Nemesis Form Additional Health Pool = (Desired Max Health - 675 if base health percentage is 100%) / 2
Nemesis Form Additional Amor Pool = Nemesis Form Additional Health Pool

I corrected your values, but still somewhere Ramattras base max health gets altered via Set Max Health action so its not 100% accurate anymore. If i have time i try to fix it, maybe you can search for the issue in paralell by your own too 4 or more eyes see better sometimes.^^

1 Like

Thanks. Ill look out for it. May have to wait til after work tomorrow.

When you say you fixed it, do you mean you edited the values within the share code? I thought that was only possible by the original author.

If you start a game mode fresh as the first hoster with any preset or shared code import, you can change all values freely, the other case is when you’ll become the next host as the second, you won’t be able to edit the original’s values while the game instance is running you can only add new rules etc. and edit those if i remember or use if provided by the former hosted workshop script change the so called workshop settings to alter the modes behaviour.

1 Like

After the first instance, it’s 2325 in nemesis form. The first usage is correct, but im not sure why it’s specifically only correct the first time.

The issue may even arise from not taking damage?

It’s probably something to do with the tank health modifiers. I loosely remember doing something to dva’s health. Maybe it’s causing problems for ramattra.

Yeah, in this case i would recommened a clean up and start from zero, due the update to OW2 could probably messed up some transition setups regarding overwritting hero setings. I can help on that just give me the relevant parameters for specific heroes, info about how the mode should function, like game mechanics, objective goals and etc., so we can pull out a prototype considering the tracking form changes of Ramattra and any other similar heroes at this start point.

That’s actually a pretty tall order. I’ve gotten pretty rusty with this whole thing and someone offered ton clean it up once before.

I’d rather locate the issue, but here goes:

All heroes have numerical 300 HP except Tracer (20) Soldier (76) and tanks.q

Each hero gives a unique amount of ult charges to the boss. Mercy and healers giving the most, and DPS heros with healing abilities and roadhog also giving a lot of ult charge.

TBH, i think that part of the code can just be copied over since its labled and set properly anyway.

Dva has 300HP outside of mech. The mech has 3000 visual HP, 1500 health and armor.

She has a passive: When her on-fire meter is active, the mech causes AOE burning damage to herself and enemies. (two conditions must be met. on fire and health below 1500)

Dva also only gets one possible remech per life.

Characters who spawn with ult: Ashe, Hanzo, all support heroes.

The in-game scoring is a cusstom. Suicides and all deaths from team players add points to the bosses score.

Bosses that jump off the map or commit suicide awards 5 point to the other team, or 7 points if dva does it in her mech.

Destroying the mech awards 2 points, or 1 point if the team has 10 points, or 0 if they have 11 points. The reason for this is demeching dva should never end the game.

If dva ults as her mech is destroyed, any awarded points are refunded.

And that’s a large portion of things.

The other big thing is that any non-boss character that gets killed, they cannot be selected again. Mercy can resurrect, but not the same character more than once, and she has a limit of three resurrects.

That’s all the important details that come to mind.

Pharah has a unique health pool. As does moira when she ults.

Sigma has extra defense when he has overhealth.

That’s all the important stuff for now. Im not at my PC atm.

1 Like

Thanks for the informations, i will look into it if i am in my days off of work.