|
When the first player enters an instance, you should set a temporary variable on other players in their party based on who enters the instance first. Let me make an example.
First, let's say we have 5 players.
Player 1 is partied with Player 3
Player 2 is partied with Player 4
Player 3 is partied with Player 1
Player 4 is partied with Player 2
Player 5 is going into the instance by himself.
Now, they all enter the dungeon through the same portal. But when the first person enters, there should first be a condition that checks for whether or not they have a temporary 'map ####' attached to them. If there isn't, they are transported to a new map, and that map's ID is assigned to that temporary variable.
At the same time, if other players in the same party do not have that ID assigned, it gets assigned to them. That way, when they enter the instance, they can be sent to the map based on the #### the first person received.
So:
Player 1 goes to Map 1. Map 1's number is simultaneously assigned to Player 3.
Player 2 goes to Map 2. Map 1's number is simultaneously assigned to Player 4.
Player 3 goes to Map 1, based on the number assigned upon Player 1's entry.
Player 4 goes to Map 2, based on the number assigned upon Player 2's entry.
Player 5 goes to Map 3. Since he is not partied, nobody else is assigned the map number.
This essentially sets up an automatic routing system that will always transport other players to the same map that the first party member entered.
But, there's something else that needs to be done. Should the player log off, get kicked from the party, or get into any situation that should prohibit them from re-entering the instance their party is currently in, the 'map ####' variable should be reset to 0, so that when they try to re-enter the instance, a new 'map ####' is assigned to them. This prevents them from re-entering the same instance over and over.
If you look below, I've got a diagram that shows what you are trying to do. If you notice, players in the party are sent to the same map. It doesn't matter who enters the instance first, because the ID number of that instance or map is 'given' to other players when the first person enters. Then it's cleared when they exit or complete the map so that it may be re-assigned later. |