Back to home

[Module] Hitscan sphere without raycast updated

FD7V2
click to copy
This game is archived.
If you with to unarchive it, click the "restore" button in the options menu.

Category:
Other

Author:
Bonkorn

Rating:
8

Version:
1.0.0

Posted:
15 days ago

Last updated:
13 days ago

Project Links

Share this workshop!

Options

[Module] Hitscan sphere without raycast updated

Original by Corrade, Updated by Bonkorn.

HUD and condition templates are included! Snippet available in this post!

This module was originally from here but the import code and github link doesn't seem to be working but i found it somewhere so i updating here.

https://workshop.elohell.gg/IxHpDyHDL/[Module]+Hitscan+detection+of+spheres+w/o+raymarch/

Visit the link above for more details!

rule("create effect")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Create Effect(All Players(All Teams), Sphere, Green, Global Variable(A), 1.250, Visible To Position and Radius);
		Set Global Variable(A, Vector(-75.729, 2.290, 97.035));
	}
}

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

	actions
	{
		Create HUD Text(Event Player, And(Is In Line of Sight(Add(Eye Position(Event Player), Multiply(Absolute Value(Dot Product(Subtract(
			Global Variable(A), Eye Position(Event Player)), Facing Direction Of(Event Player))), Facing Direction Of(Event Player))),
			Eye Position(Event Player), Enemy Barriers Block LOS), Compare(Distance Between(Vector(0, 0, 0), Subtract(Global Variable(A),
			Add(Eye Position(Event Player), Multiply(Absolute Value(Dot Product(Subtract(Global Variable(A), Eye Position(Event Player)),
			Facing Direction Of(Event Player))), Facing Direction Of(Event Player))))), <=, 1.250)), Null, Null, Top, 1, White, White,
			White, Visible To and String, Default Visibility);
	}
}

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

	conditions
	{
		Is In Line of Sight(Add(Eye Position(Event Player), Multiply(Absolute Value(Dot Product(Subtract(Global Variable(A), Eye Position(
			Event Player)), Facing Direction Of(Event Player))), Facing Direction Of(Event Player))), Eye Position(Event Player),
			Enemy Barriers Block LOS) == True;
		Distance Between(Vector(0, 0, 0), Subtract(Global Variable(A), Add(Eye Position(Event Player), Multiply(Absolute Value(Dot Product(
			Subtract(Global Variable(A), Eye Position(Event Player)), Facing Direction Of(Event Player))), Facing Direction Of(
			Event Player))))) <= 1.250;
	}

	actions
	{
		Small Message(All Players(All Teams), Custom String(".", Null, Null, Null));
	}
}