Creating a Blinding Grenade which impairs a player's vision?

Hello, I need help creating a Flash Grenade for Cassidy. It would be like in other video games where your screen turns white because a Flash Grenade blinded you. I’ve tried to research it a bit and attempted to create it myself but I didn’t get far and scrapped the ideas.

Any help is appreciated, thank you!

I made this rule that activates when Cassidy deals damage with his Grenade (Ability 2). For 2 seconds, a white sphere (well, 10 spheres) is created around the player, so they can’t see anything. Also, nameplates and outlines are disabled for the duration:

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

	conditions
	{
		Hero Of(Attacker) == Hero(Cassidy);
		Event Ability == Button(Ability 2);
	}

	actions
	{
		For Player Variable(Event Player, IndexVar, 0, 10, 1);
			Create Effect(Event Player, Sphere, Color(White), Event Player, 2, Visible To Position and Radius);
			Event Player.EntityVar[Event Player.IndexVar] = Last Created Entity;
		End;
		Start Forcing Player Outlines(All Players(All Teams), Event Player, False, Color(White), Default);
		Disable Nameplates(All Players(All Teams), Event Player);
		Wait(2, Ignorar condición);
		For Player Variable(Event Player, IndexVar, 0, 10, 1);
			Destroy Effect(Event Player.EntityVar[Event Player.IndexVar]);
		End;
		Stop Forcing Player Outlines(All Players(All Teams), Event Player);
		Enable Nameplates(All Players(All Teams), Event Player);
	}
}

A For Loop creates the spheres and stores them in an array to destroy them later.

Thank you! Unfortunately, I’m having trouble translating your code to the Workshop. Would you mind guiding me through how?

I am currently stuck on this area:

		Event Player.EntityVar[Event Player.IndexVar] = Last Created Entity;
	End;

That’s Set Player Variable At Index. The Player Variable is EntityVar and the index is a Player Variable, IndexVar. These variables are the usual A, B… But renamed.

Thank you, but I’m not having trouble understanding what they do, I’m having trouble understanding how to implement it through the Workshop block-based coding.

OK, I made a screenshot. If you need the rest, just tell me.

https://imgur.com/a/DKsynGD

You do realize you can just copy code and then click paste within Workshop to have it imported if it’s written correctly, right?

If it is not in the same language, it won’t work. I forgot to translate the Wait action from Spanish to English, so the code can’t be pasted (in any language :persevere:).

Thank you so much! I’m new to Workshop and need a lot of information to understand how certain aspects of it work. Still researching certain phrases and stuff, but you helped a lot and I was very excited when it worked as I tried doing it myself for a while.

Thank you!

2 Likes

An good effect to block player view, is smoke effect.