Need help with the Workshop

I have just started to use the workshop for making stuff about a few weeks ago and it’s pretty fun, but several features are missing and/or not working as intended:

  • Hero created entities (Turrets and B.O.B.) cannot have their damage used as conditions as nothing will happen if they deal damage
  • Mei’s secondary fire cannot be used as condition unless it’s a critical hit. For some reason, it only works if it deals headshot damage
  • Brigitte’s Repair Pack is broken. If you use Repair Pack while Inspire is active, it will affect Brigitte herself instead of the target ally (let’s say you want it to give armor. It heals the target but gives armor to Brigitte herself instead). It works even worse if the intended target is Player Closest to The Reticle as it affects the enemies instead even if they are not intended to receive it
  • I don’t know if there’s a way for this, but since I couldn’t find any tutorials on it, I’ll ask it here. Is there a way to make sure hero stats (like health and damage taken) do NOT carry over to other heroes if those stats are only meant for a specific hero?

Overall, the workshop is really fun, but I feel like it hasn’t been updated since it got released

3 Likes

Let’s say you want Mei to have 150% HP and 70% damage taken:

Event:
Ongoing - Each Player
All
Mei

Conditions:
Has Spawned(Event Player) == True

Actions:
Set Max Health(Event Player, 150)
Set Damage Received(Event Player, 70)

This is enough, but it will carry over other heroes. If you want each hero to have different stats, you must create a rule for each hero. On the contrary, if only one or few heroes have custom stats, you can use this rule:

Event:
Ongoing - Each Player
All
All

Conditions:
Has Spawned(Event Player) == True
Hero Of(Event Player) != Hero(Mei)

Actions:
Set Max Health(Event Player, 100)
Set Damage Received(Event Player, 100)

This sets stats back to 100% when playing a different hero. If there are more than one, you must use Or in Conditions like this:

Or(Or(Compare(Hero Of(Event Player) != Hero(Mei)), Compare(Hero Of(Event Player) != Hero(Mercy))), Compare(Hero Of(Event Player) != Hero(Sombra)))


Or, you can create an array with heroes with custom stats:

Set Global Variable(A, Array(Hero(Mei), Hero(Mercy), Hero(Sombra))

Then, use this in Conditions:

Array Contains(Global Variable(A), Hero Of(Event Player)) == False


There is an unofficial wiki that may help you: https://workshop.codes/wiki

1 Like

It worked! Thank you so much

1 Like

Here is how you could recognize turret/B.O.B damage/hits. Import these settings to test it out. Turret/ B.O.B damage will be tracked when the game mode starts.

Notes:
I am unsure what the server load looks like when scaled to multiple players/bots.
You should not have multiple players with the ability to create Turrets/B.O.B.

settings
{
	modes
	{
		Deathmatch

		General
		{
			Game Mode Start: Immediately
			Limit Roles: 1 Tank 2 Offense 2 Support
			Score To Win: 5000
		}
	}
}

variables
{
	global:
		0: index
		1: valueOfIndex
		2: allPlayers
		3: heroesWithEntities

	player:
		0: weaponDamageDealt
		1: heroEntityDamageDealt
		2: currentHealth
		3: lastAttacker
		5: damageDealt
		6: lastDamageReceived
}

rule("[debug] createHUDValueTracking")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Game In Progress == True;
	}

	actions
	{
		Create HUD Text(Event Player, Custom String("Entity Damage Dealt {0}", Event Player.heroEntityDamageDealt), Custom String(
			"Weapon Damage Dealt {0}", Event Player.weaponDamageDealt), Custom String(
			"All Damage Dealt {0}. Player Stat All Damage Dealt {1}", Event Player.damageDealt, Player Stat(Event Player,
			All Damage Dealt)), Top, 0, Color(White), Color(White), Color(White), String, Default Visibility);
	}
}

rule("[debug] createBotForTesting")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Is Button Held(Host Player, Button(Interact)) == True;
		Has Spawned(Host Player) == True;
	}

	actions
	{
		Create Dummy Bot(Hero(Reinhardt), All Teams, -1, Position Of(Host Player), Vector(0, 0, 0));
		Set Ultimate Charge(Host Player, 100);
	}
}

rule("[debug] Display Server Stats")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Is Game In Progress == True;
	}

	actions
	{
		Create HUD Text(Filtered Array(All Players(All Teams), !Is Dummy Bot(Event Player)), Custom String("Serve Load {0}", Server Load),
			Custom String("Server Load Average {0}", Server Load Average), Custom String("Server Load Peak {0}", Server Load Peak), Right,
			0, Color(White), Color(White), Color(White), String, Default Visibility);
	}
}

rule("setGlobalVariables")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Global.allPlayers = Filtered Array(All Players(All Teams), !Is Dummy Bot(Current Array Element));
		Global.heroesWithEntities = Array(Hero(Ashe), Hero(Symmetra), Hero(Torbjörn));
	}
}

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

	actions
	{
		Event Player.lastAttacker = Null;
	}
}

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

	conditions
	{
		Has Spawned(Event Player) == True;
		Is Dead(Event Player) == False;
	}

	actions
	{
		Event Player.currentHealth = Max Health(Event Player);
	}
}

rule("updateAllPlayers")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Global.allPlayers != Filtered Array(All Players(All Teams), !Is Dummy Bot(Current Array Element));
	}

	actions
	{
		Global.allPlayers = Filtered Array(All Players(All Teams), !Is Dummy Bot(Current Array Element));
	}
}

rule("rememberAttacker")
{
	event
	{
		Player Took Damage;
		All;
		All;
	}

	actions
	{
		Event Player.lastAttacker = Attacker;
	}
}

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

	conditions
	{
		Is Game In Progress == True;
		Array Contains(Global.heroesWithEntities, Hero Of(Event Player)) == True;
		Global.heroesWithEntities == 0;
	}

	actions
	{
		If(Health(Event Player) < Event Player.currentHealth);
			Event Player.lastDamageReceived = Event Player.currentHealth - Health(Event Player);
			Event Player.currentHealth = Health(Event Player);
			If(Entity Exists(Event Player.lastAttacker) == True);
				Event Player.lastAttacker.damageDealt += Event Player.lastDamageReceived;
				Event Player.lastAttacker.weaponDamageDealt += Event Player.lastDamageReceived;
				Event Player.lastAttacker = Null;
			Else;
				For Global Variable(index, 0, Count Of(Global.allPlayers), 1);
					Global.valueOfIndex = Global.allPlayers[Global.index];
					Global.valueOfIndex.damageDealt += Event Player.lastDamageReceived;
					Global.valueOfIndex.heroEntityDamageDealt += Event Player.lastDamageReceived;
				End;
			End;
		End;
		Global.heroesWithEntities = 1;
		Chase Global Variable Over Time(heroesWithEntities, 0, 0.032, None);
	}
}

I suggest renaming this title to “Need Help With Workshop” as it may confuse the devs looking for bug reports or actual missing features such as Overhealth. Most of these things seem like they might be a problem with your code. But if you could provide more detail and evidence in separate posts for each problem, making each title specific to the problem, you might get better responses.

The problem is that you still have mixin damage sources from any entity, Turrets are neither a Bot nor a Player so your code doesn’t actually differentiate between these 3 types of entities, its too abritary. Also the use of HealthOfType makes no sense, what is with the case of heroes being played with amor?

Yeah fixed the title. Thanks for pointing it out