• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Pathing Blocked for Just One Player

Status
Not open for further replies.
Level 9
Joined
Jul 8, 2013
Messages
249
I am trying to create a room in which one player's units cannot leave, but other players can walk in and out.


My only idea so far has been to create some regions which order the entering unit to turn back if it belongs to a particular player. Is there a better approach?
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,241
There is no perfect/good solution for this.
The region idea works but only works in certain locations where a square can perfectly cover the terrain.

Another idea is to track orders and cancel if the destination is not permitted.
Still not perfect, I think there are some rare cases where this might not work.


Bottom line is, I would use this sparingly as its a pain to design around.
 
Level 24
Joined
Jun 26, 2020
Messages
1,928
You can save every location of every cell of the map that matches with that pathing and also the location of the nearest "good cell" and everytime check if there is a unit that mustn't be there and move it to that point, or disable the pathing of that point and enable it later.
 
Level 9
Joined
Jul 8, 2013
Messages
249
Bottom line is, I would use this sparingly as its a pain to design around.
Yeah, I can agree with that. Luckily there is only going to be 1 place where this applies.


There's an entry hallway to a temple which one player's forces walk into at the beginning and then are not allowed to leave by that hallway.

So on the plus side, it's only a single narrow, rectangular region which needs to be blocked off this way.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
I think a simpler solution might just be to block off the exit to the room with pathing blockers. then "instantly move" the units that are able to pass through with triggers when they enter the "doormat" region.

this is very easy to implement but will have two slight issues -

1. the natural pathing of the units will be a little thrown off. (prop shouldn't be a big deal)

2. the units will "blip" over the pathing blockers. if this bothers you, you can temporarily remove the unit's collision and "knockback" them through the pathing blockers.

I guess you could also just use only pathing blockers and removing the unit's collision. you just have to be careful you set it up that there is no way for the unit to get away with no collision.
 
Level 9
Joined
Jul 8, 2013
Messages
249
I guess you could also just use only pathing blockers and removing the unit's collision. you just have to be careful you set it up that there is no way for the unit to get away with no collision.

Yeah, I was thinking about that. What would be the best method to remove collision and then be certain it is restored at the right point? I'd also like to avoid having the people without collision either blipping around or running right through each other.
 
Last edited:

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,241
You can use invisible dummy units and a knockback system to knock units back if they come within a certain range of the invisible dummy units. Place the dummy units at the locations you wish to prevent others from entering.
This is a quite flexible solution in terms of shape but it does not solve the main problem. (in my opinion).

Let's say you have a multiplayer map, at some point you need to bring a magical item to summon a bridge and cross a river.
Player 1 has this item and uses it to summon a bridge and walk across.
Player 2 does not.
With getlocalplayer you can hide things for specific players, but you cannot remove the pathing for one player only.
So since player 1 has walked across the bridge needs to be spawned. this means player 2 can walk across an invisible bridge.
But if you put an invis knockback wall it will look weird, you walk close to the edge where you don't see anything and get thrown back.

Wc3 limit sadly.

You can design around it, maybe its a squad of guards push you back if you haven't payed a fee, this way you can have the bridge visible all the time.
As I said before, workable but a pain in the ass.
 
Level 9
Joined
Jul 8, 2013
Messages
249
I tried a few approaches. Ultimately the one that looked most natural while not being exploitable was this:

I set up a 'No Exit' Region to mark the boundary, and a 'Return To' region just north of it.

When a unit belonging to the player who is not allowed to leave enters the forbidden region, they are added to a 'no exiting' unit group. The unit is instantly moved north by 25 and then ordered to move north even further.

When it reaches the Return To region is gets a stop order

The instant movement amount is small enough that if the unit is immediately given an order to turn around and keep moving, it doesn't look like a teleport. It looks like the unit just turned around.

However, I found that if a determined player gathered a giant mass of units, crowded them all in together, and ordered them to move out a thousand times, sometimes one unit would indeed slip out.

So I created a second 'no exit' region just south of the first one, doing basically the same thing. Now it is sealed tight and it is impossible to squeeze in enough units to get anyone to slip out all the way.
 
Status
Not open for further replies.
Top