I’m making a hide and seek custom game, and I am trying to set it up for every map to have something like a sphere that blocks them off.
I cannot find anything about this for OW2 Workshop, everything I find is OW1 which I think worked differently. I know how to get coordinates for each map, and make the sphere visual to block the door, but I don’t know how to make the actual functional code that blocks it.
I don’t know if you can physically block them, but you can apply an impulse that pushes them away from the spawn door (or room) if they get too close.
Summary
settings
{
lobby
{
Max Team 1 Players: 6
Max Team 2 Players: 6
}
modes
{
disabled Assault
{
Limit Roles: 2 Of Each Role Per Team
}
disabled Control
{
Limit Roles: 2 Of Each Role Per Team
}
disabled Escort
{
Limit Roles: 2 Of Each Role Per Team
}
disabled Hybrid
{
Limit Roles: 2 Of Each Role Per Team
}
Skirmish
{
enabled maps
{
Workshop Chamber 0
}
}
}
}
rule("Rule 1")
{
event
{
Ongoing - Global;
}
actions
{
Create Effect(All Players(All Teams), Sphere, Color(Yellow), Vector(0, 0, 0), 10, Visible To Position and Radius);
}
}
rule("Rule 2")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
Distance Between(Event Player, Vector(0, 0, 0)) < 10;
}
actions
{
Apply Impulse(Event Player, Vector Towards(Vector(0, 0, 0), Event Player), 1, To World, Cancel Contrary Motion);
Wait(0.016, Ignore Condition);
Loop If Condition Is True;
}
}
The problem is that, like I said, it doesn’t physically block them. Characters like Sombra and Tracer can still teleport through.
You could make a second rule that creates a second zone behind the door barrier that kills or teleports the player if they manage to slip through. Sombra can throw her translocator pretty far though, you would need a lot of small kill zones to fill the whole room. Alternatively, you could make a larger kill zone that requires line-of-sight so it doesn’t accidentally kill players who are close to the spawn room but are outside of its walls.
I’m a really casual workshopper, so maybe somebody has a better solution.
Or you could do a look at trigger, when a special hero like Sombra or Tracer look at that pseudo-barrier and that barrier is in LOS with a view angle around the size of the barriers radius, disable the appropiate abilities before hand, and enable them again when they don’t look at anymore. Contra point is Tracer’s blinks can be execute in any input direction regardlesss of the facing direction, so she could blink through while turning her back to the barrier
.
1 Like
I don’t use characters that could get in, I just don’t know how to make a functional impulse at a location
edit: I noticed the summary could be opened up for me to see code to use
It just occurred to me that you could probably define a rectangular area with vectors.
This little snippet creates a 4x4x4 cube at the center of the map that teleports players away when they enter it. Try it out in one of the Workshop test maps.
rule("Rule 1")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
X Component Of(Position Of(Event Player)) > -2;
X Component Of(Position Of(Event Player)) < 2;
Y Component Of(Position Of(Event Player)) >= 0;
Y Component Of(Position Of(Event Player)) < 4;
Z Component Of(Position Of(Event Player)) > -2;
Z Component Of(Position Of(Event Player)) < 2;
}
actions
{
Teleport(Event Player, Vector(20, 0, 0));
}
}
There’s probably a cleaner way to do this, but this works at least.