Back to home

Duality Simulator / Reflection Fight

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

Category:
Custom game mode

Author:
puppetsquid

Rating:
2

Version:
1.3.0

Posted:
about 1 month ago

Tags:
mirror reflection ctf duality puppetsquid coop tdm pve symmetry dummy bot

Project Links

Share this workshop!

Options

Players control themselves and a bot on the enemy team. Points are awarded for Elims and Captures. The bot team only need half as many points as the player's team to win.

Video here: https://www.youtube.com/watch?v=omsCWRtz1u4

variables
{
	global:
		0: NextSwap
		1: MirrorOffset
		2: MapDirList
		3: CapturePoint
		4: PointLocations
		15: TeamScores

	player:
		12: Momenum
}

rule("Setup Mirror Axis (specific for some maps)")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Set Global Variable(NextSwap, Vector(1, 1, -1.000));
		Set Global Variable(MirrorOffset, Vector(0, 0, 0));
		Set Global Variable(MapDirList, Append To Array(Map(Oasis Gardens), Map(Ilios Ruins)));
		Modify Global Variable(MapDirList, Append To Array, Append To Array(Append To Array(Map(Lijiang Control Center), Map(
			Lijiang Control Center Lunar New Year)), Append To Array(Map(Lijiang Tower), Map(Lijiang Tower Lunar New Year))));
		Modify Global Variable(MapDirList, Append To Array, Append To Array(Append To Array(Map(Lijiang Night Market), Map(
			Lijiang Night Market Lunar New Year)), Append To Array(Map(Lijiang Garden), Map(Lijiang Garden Lunar New Year))));
		Skip If(Not(Array Contains(Global Variable(MapDirList), Current Map)), 1);
		Set Global Variable(NextSwap, Vector(-1.000, 1, 1));
		Skip If(Compare(Current Map, !=, Map(Ayutthaya)), 2);
		Set Global Variable(NextSwap, Vector(-1.000, 1, -1.000));
		Set Global Variable(MirrorOffset, Vector(34, 0, -14.000));
		Skip If(Compare(Current Map, ==, Map(Black Forest)), 1);
		Skip If(Compare(Current Map, !=, Map(Black Forest Winter)), 1);
		Set Global Variable(MirrorOffset, Vector(0, 0, 10));
		Skip If(Compare(Current Map, !=, Map(Oasis City Center)), 1);
		Set Global Variable(MirrorOffset, Vector(286, 0, 0));
		Skip If(Compare(Current Map, !=, Map(Ilios Ruins)), 1);
		Set Global Variable(MirrorOffset, Vector(57, 0, 0));
		Skip If(Compare(Current Map, !=, Map(Castillo)), 2);
		Set Global Variable(NextSwap, Vector(0.980, 1, -1.190));
		Set Global Variable(MirrorOffset, Vector(-1.810, 0, 122.710));
	}
}

rule("Create Mirror Bot")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
		Players In Slot(Slot Of(Event Player), Team 1) == Null;
	}

	actions
	{
		Create Dummy Bot(Hero(Ana), Team 1, Slot Of(Event Player), Multiply(Position Of(Event Player), Global Variable(NextSwap)), Vector(
			0, 0, 0));
		Start Facing(Players In Slot(Slot Of(Event Player), Team 1), Multiply(Facing Direction Of(Event Player), Global Variable(
			NextSwap)), 1000, To World, Direction and Turn Rate);
		Skip If(Compare(Global Variable(NextSwap), ==, Vector(-1.000, 1, -1.000)), 2);
		Start Throttle In Direction(Players In Slot(Slot Of(Event Player), Team 1), Multiply(Throttle Of(Event Player), Vector(-1.000, 1,
			1)), Multiply(Distance Between(Vector(0, 0, 0), Throttle Of(Event Player)), 1), To Player, Replace existing throttle,
			Direction and Magnitude);
		Skip(1);
		Start Throttle In Direction(Players In Slot(Slot Of(Event Player), Team 1), Throttle Of(Event Player), Multiply(Distance Between(
			Vector(0, 0, 0), Throttle Of(Event Player)), 1), To Player, Replace existing throttle, Direction and Magnitude);
	}
}

rule("Update hero")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Has Spawned(Players In Slot(Slot Of(Event Player), Team 1)) == True;
		Hero Of(Event Player) != Hero Of(Players In Slot(Slot Of(Event Player), Team 1));
		Is Alive(Event Player) == True;
		Is Dummy Bot(Players In Slot(Slot Of(Event Player), Team 1)) == True;
	}

	actions
	{
		Start Forcing Player To Be Hero(Players In Slot(Slot Of(Event Player), Team 1), Hero Of(Event Player));
	}
}

rule("Remove Bot")
{
	event
	{
		Ongoing - Each Player;
		Team 1;
		All;
	}

	conditions
	{
		Players In Slot(Slot Of(Event Player), Team 2) == Null;
	}

	actions
	{
		Destroy Dummy Bot(Team 1, Slot Of(Event Player));
	}
}

rule("Failsafe positioning every second")
{
	event
	{
		Ongoing - Each Player;
		Team 1;
		All;
	}

	conditions
	{
		Has Spawned(Event Player) == True;
		Is Alive(Event Player) == True;
		Is Alive(Players In Slot(Slot Of(Event Player), Team 2)) == True;
		Has Status(Event Player, Asleep) != True;
		Has Status(Event Player, Frozen) != True;
		Has Status(Event Player, Knocked Down) != True;
		Has Status(Event Player, Rooted) != True;
		Has Status(Event Player, Stunned) != True;
	}

	actions
	{
		Wait(0.150, Ignore Condition);
		Set Player Variable(Event Player, C, Add(Multiply(Position Of(Players In Slot(Slot Of(Event Player), Team 2)), Global Variable(
			NextSwap)), Global Variable(MirrorOffset)));
		Set Player Variable(Event Player, D, Distance Between(Position Of(Event Player), Player Variable(Event Player, C)));
		Skip If(Compare(Player Variable(Event Player, D), <, 0.200), 3);
		Apply Impulse(Event Player, Direction Towards(Position Of(Event Player), Add(Player Variable(Event Player, C), Up)), Multiply(
			Distance Between(Add(Up, Player Variable(Event Player, C)), Position Of(Event Player)), 3.500), To World,
			Cancel Contrary Motion);
		Apply Impulse(Event Player, Direction Towards(Position Of(Event Player), Add(Player Variable(Event Player, C), Down)), Multiply(
			Distance Between(Add(Down, Player Variable(Event Player, C)), Position Of(Event Player)), 3.500), To World,
			Cancel Contrary Motion);
		Apply Impulse(Event Player, Direction Towards(Position Of(Event Player), Player Variable(Event Player, C)), Multiply(
			Player Variable(Event Player, D), 3.500), To World, Cancel Contrary Motion);
		Skip If(Compare(Player Variable(Event Player, D), <, 0.200), 1);
		Skip If(Array Contains(Players Within Radius(Add(Up, Player Variable(Event Player, C)), 30, Team 1, Surfaces), Event Player), 3);
		Set Player Variable(Global Variable(NextSwap), Momenum, Vector(Speed Of In Direction(Global Variable(NextSwap), Vector(1, 0, 0)),
			Speed Of In Direction(Global Variable(NextSwap), Up), Speed Of In Direction(Global Variable(NextSwap), Forward)));
		Teleport(Event Player, Player Variable(Event Player, C));
		Apply Impulse(Event Player, Direction Towards(Vector(0, 0, 0), Player Variable(Event Player, Momenum)), Multiply(Distance Between(
			Vector(0, 0, 0), Player Variable(Event Player, Momenum)), 1), To World, Cancel Contrary Motion);
		Loop If Condition Is True;
		Small Message(Null, Custom String("Mode by puppetsquid", Null, Null, Null));
	}
}

rule("Do Shoot")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Primary Fire) == True;
	}

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Primary Fire);
	}
}

rule("Stop Shoot")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Firing Primary(Event Player) == False;
		Is Button Held(Event Player, Primary Fire) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Primary Fire);
	}
}

rule("Do Jump")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Jump) == True;
	}

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Jump);
	}
}

rule("Stop Jump")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Jump) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Jump);
	}
}

rule("Do Secondary Fire")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Secondary Fire) == True;
	}

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Secondary Fire);
	}
}

rule("Stop Secondary Fire")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Firing Secondary(Event Player) == False;
		Is Button Held(Event Player, Secondary Fire) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Secondary Fire);
	}
}

rule("Do Ability 1")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

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

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ability 1);
	}
}

rule("Stop Ability 1")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Ability 1) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ability 1);
	}
}

rule("Do Ability 2")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Ability 2) == True;
	}

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ability 2);
	}
}

rule("Stop Ability 2")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Ability 2) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ability 2);
	}
}

rule("Do Ultimate")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

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

	actions
	{
		Set Ultimate Charge(Players In Slot(Slot Of(Event Player), Team 1), 100);
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ultimate);
	}
}

rule("Stop Ultimate")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Ultimate) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Ultimate);
	}
}

rule("Do Crouch")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Crouch) == True;
	}

	actions
	{
		Start Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Crouch);
	}
}

rule("Stop Crouch")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Button Held(Event Player, Crouch) == False;
	}

	actions
	{
		Stop Holding Button(Players In Slot(Slot Of(Event Player), Team 1), Crouch);
	}
}

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

	conditions
	{
		Distance Between(Position Of(Event Player), Multiply(Position Of(Event Player), Global Variable(NextSwap))) < 1;
	}

	actions
	{
		Set Status(Event Player, Null, Phased Out, 1);
	}
}

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

	actions
	{
		Enable Death Spectate All Players(Event Player);
	}
}

rule("Wave Hello")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

	conditions
	{
		Is Communicating(Event Player, Hello) == True;
		Ray Cast Hit Player(Eye Position(Event Player), Add(Multiply(Facing Direction Of(Event Player), 50), Eye Position(Event Player)),
			All Players(Team 1), Event Player, True) == True;
	}

	actions
	{
		Wait(0.250, Ignore Condition);
		Communicate(Player Closest To Reticle(Event Player, Team 1), Hello);
	}
}

rule("On Player Dead")
{
	event
	{
		Player Died;
		Team 2;
		All;
	}

	actions
	{
		disabled Set Status(Players In Slot(Slot Of(Event Player), Team 1), Null, Phased Out, 9999);
		disabled Set Invisible(Players In Slot(Slot Of(Event Player), Team 1), All);
		disabled Teleport(Players In Slot(Slot Of(Event Player), Team 1), Nearest Walkable Position(Event Player));
		Kill(Players In Slot(Slot Of(Event Player), Team 1), Null);
	}
}

rule("On Player Alive")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		All;
	}

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

	actions
	{
		Heal(Players In Slot(0, Team 1), Null, Max Health(Event Player));
		Set Invisible(Players In Slot(Slot Of(Event Player), Team 1), None);
		Clear Status(Players In Slot(Slot Of(Event Player), Team 1), Phased Out);
	}
}

rule("CTF additions")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Current Game Mode == Game Mode(Capture the Flag);
		Is Game In Progress == True;
	}

	actions
	{
		Disable Built-In Game Mode Completion;
		Create HUD Text(All Players(All Teams), String("{0} / {1}", Value In Array(Global Variable(TeamScores), 1), 15, Null), Null,
			Custom String("DEATHS TO LOSE", Null, Null, Null), Top, 0, Team 1, White, White, String, Default Visibility);
		Create HUD Text(All Players(All Teams), String("{0} / {1}", Value In Array(Global Variable(TeamScores), 0), 30, Null), Null,
			Custom String("ELIMS TO WIN", Team Score(Team 1), Null, Null), Top, 0, Team 2, White, White, String, Default Visibility);
		Create HUD Text(Filtered Array(All Players(Team 2), Is In Spawn Room(Current Array Element)), Null, Null, Custom String(
			"Score Elims or Captures to win. Enemy team needs half as many to win.", Null, Null, Null), Top, 10, White, White, White,
			Visible To and String, Default Visibility);
	}
}

rule("CTF score override")
{
	event
	{
		Player Dealt Final Blow;
		All;
		All;
	}

	conditions
	{
		Current Game Mode == Game Mode(Capture the Flag);
	}

	actions
	{
		Skip If(Compare(Victim, ==, Event Player), 2);
		Modify Team Score(Team Of(Event Player), 1);
		Skip(1);
		Modify Team Score(Team Of(Event Player), -1.000);
	}
}

rule("Score display bypass fix")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Or(Compare(Value In Array(Global Variable(TeamScores), 0), !=, Team Score(Team 2)), Compare(Value In Array(Global Variable(
			TeamScores), 1), !=, Team Score(Team 1))) == True;
	}

	actions
	{
		Set Global Variable At Index(TeamScores, 0, Team Score(Team 2));
		Set Global Variable At Index(TeamScores, 1, Team Score(Team 1));
		Wait(0.250, Ignore Condition);
		Loop If Condition Is True;
	}
}

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

	conditions
	{
		Is Assembling Heroes == True;
	}

	actions
	{
		Set Match Time(1);
	}
}

disabled rule("Display server performance characteristics")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Create HUD Text(Host Player, String("{0}: {1}", String("Server Load", Null, Null, Null), String("{0}%", Server Load, Null, Null),
			Null), Null, Null, Left, 0, White, White, White, Visible To and String, Default Visibility);
		Create HUD Text(Host Player, String("{0}: {1}", String("Server Load Average", Null, Null, Null), String("{0}%",
			Server Load Average, Null, Null), Null), Null, Null, Left, 1, White, White, White, Visible To and String, Default Visibility);
		Create HUD Text(Host Player, String("{0}: {1}", String("Server Load Peak", Null, Null, Null), String("{0}%", Server Load Peak,
			Null, Null), Null), Null, Null, Left, 2, White, White, White, Visible To and String, Default Visibility);
	}
}

rule("Auto Resawpn Baddies")
{
	event
	{
		Player Died;
		Team 1;
		All;
	}

	actions
	{
		Wait(3, Ignore Condition);
		Respawn(Event Player);
	}
}

disabled rule("Custom TDM spots")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	conditions
	{
		Current Game Mode == Game Mode(Team Deathmatch);
		Has Spawned(Event Player) == True;
		Is Alive(Event Player) == True;
		Is Dummy Bot(Event Player) != True;
		Array Contains(Global Variable(PointLocations), Position Of(Event Player)) != True;
	}

	actions
	{
		Modify Global Variable(PointLocations, Append To Array, Position Of(Event Player));
		disabled Set Global Variable(F, Nearest Walkable Position(Add(Multiply(Global Variable(NextSwap), 20), Global Variable(MirrorOffset))));
		disabled Create Effect(All Players(All Teams), Light Shaft, Team 2, Global Variable(F), 5, Visible To Position and Radius);
		disabled Create Icon(All Players(All Teams), Global Variable(F), Arrow: Down, Visible To and Position, White, True);
	}
}

disabled rule("Change Places")
{
	event
	{
		Ongoing - Global;
	}

	actions
	{
		Wait(15, Ignore Condition);
		Set Global Variable(CapturePoint, Random Value In Array(Global Variable(PointLocations)));
	}
}

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

	actions
	{
		Set Match Time(1);
	}
}

rule("Hide in spawn")
{
	event
	{
		Ongoing - Each Player;
		Team 1;
		All;
	}

	conditions
	{
		Is In Spawn Room(Event Player) == True;
	}

	actions
	{
		Set Invisible(Event Player, All);
	}
}

rule("Reveal out of spawn")
{
	event
	{
		Ongoing - Each Player;
		Team 1;
		All;
	}

	conditions
	{
		Is In Spawn Room(Event Player) != True;
	}

	actions
	{
		Set Invisible(Event Player, None);
	}
}

rule("McCree Fix")
{
	event
	{
		Ongoing - Each Player;
		Team 2;
		McCree;
	}

	conditions
	{
		Is Firing Secondary(Event Player) != True;
	}

	actions
	{
		Set Status(Players In Slot(Slot Of(Event Player), Team 1), Null, Stunned, 0.250);
	}
}

rule("Team 1 win")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Team Score(Team 1) == 15;
	}

	actions
	{
		Declare Team Victory(Team 1);
	}
}

rule("Team 2 win")
{
	event
	{
		Ongoing - Global;
	}

	conditions
	{
		Team Score(Team 2) == 30;
	}

	actions
	{
		Declare Team Victory(Team 2);
	}
}

rule("Remove bot")
{
	event
	{
		Player Left Match;
		All;
		All;
	}

	actions
	{
		Destroy Dummy Bot(Team 1, Slot Of(Event Player));
	}
}