Jump to content
  • 0

Dungeon Player Limit


MrValenza

Question

Hello,

 

 Is there any way for me to create something that allows a Dungeon event to de-spawn if more than # of allowed players are at a Dungeon Entrance?

 

Ex:  My party of 4 (including myself) are about to use a key to enter the dungeon but if another player enters the map, the Event de-spawns/closes.

Or as soon as 4 people are in the dungeon itself, the Dungeon entrance Event de-spawns for other players?

 

Thank you =)

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1
7 hours ago, Joyce said:

I suppose you could keep a count of every time the event warps a player and disable it after the count reaches a certain amount. 

 

You'd have to find a way to reset this without getting it permanently closed though.. Like if the players leave before the dungeon is cleared what will happen? What if someone logs out in said dungeon? 

I did everything you said, and what he said above through events.
 

I will not say step by step why it is too long, or send images of how it is done, I will say it in a simple way and then if you can understand it you can reproduce it perfectly.

 

1 - Count how many players are inside the dungeon.

Spoiler

Let's say that this dungeon everyone can go, you will need a global variable to count how many players are inside. Every time someone talks to the npc, or uses commands to enter, add 1 to the variable in that counter. When you reach the limit the event that allows players to enter will have a second page, when the total reaches, saying that the event is full.

 

2 - Know who is inside the dungeon.

Spoiler

Then you need a local boolean variable, to check if the player is in the event, in a valid way. Every time someone talks to the npc to enter the event, in addition to adding 1 to the global variable, you must set the local boolean variable to on.

 

3 - Dungeon stages.

Spoiler

This step is important to match what @Joyce said. In my game the dungeons have stages, so that I know when the dungeon started and when it is still waiting for players to enter. You must do the same. These steps will be 1 global int variable. Because if it waits = 1 and Start = 2, the next item below will make sense.


4 - If a player leaves the dungeon before starting.

Spoiler

In this phase of the dungeon wait for the players, sometimes the player will have the chance to leave if he wants to, to return in time. In this case

 

If
"Variable local boolean that I mentioned above" = True
"Global variable that checks the stages of the dungeon" = 1
"Global variable that checks the players"> 0 (this condition is optional, I let you know that there is a player inside and I do not, therefore, leave the value of this negative variable)

 

Then it will decrease 1 of the "Global variable that checks the dungeon steps" and turn off the "Local boolean variable that I mentioned above".

 

Because when he returns, steps 1 and 2 above will be repeated.

Just be aware, the player should leave the event through some / command to return to the city or death. If he uses "teleport to map" magic, it doesn't work. You would have to exchange this spell for an event spell that teleports him to the city.

 

5 - If the player leaves the game.

Spoiler

We have 2 occasions.
If "Global variable that checks players" is greater than 0.
Then decrease 1 and turn off the "Variable local boolean I mentioned above" and teleport the player to the city.
If "Global variable that checks the players" is = 0.
Then turn off the "Variable local boolean that I quoted above" and teleport the player to the city.
This is an event that should be "common event" and the trigger is "login"

 

6 - If the player dies in the dungeon.

Spoiler

Just repeat step 4. However, it should be in a common event and the trigger is Respawn.


Failures:

Spoiler

There is no way to know when the player leaves the game, or to activate events at that time, so if the player leaves the game during the dungeon, after entering, and then joins the game at another time when the dungeon is happening and not there is nobody there. Step 5 helps to prevent. Many strange occasions can happen, but the failure in dungeons of this type is if "Global variable that checks the players" is negative.

Because when the dungeon starts, and the players are entering, this variable will not show the real number inside. For security reasons I always reset the variables to 0 when the dungeon opens and when it closes (either by success or failure).

 

If you are a novice and do not know how to handle events, you will not understand anything I said. But I left a good example of how it works, it is not an easy question, especially if you want more dungeons. If you are a novice, focus on your game on simpler things, and then develop your ability to handle events, conditions and variables. Then return here and you will see that you will be able to understand. If you understood, reproduced perfectly, good, just apply in the same way for other dungeons and NEVER let two dungeons run at the same time IF you are going to use the same player counting variable for both events. How I do.

Link to comment
Share on other sites

  • 0

I suppose you could keep a count of every time the event warps a player and disable it after the count reaches a certain amount. 

 

You'd have to find a way to reset this without getting it permanently closed though.. Like if the players leave before the dungeon is cleared what will happen? What if someone logs out in said dungeon? 

Link to comment
Share on other sites

  • 0
10 hours ago, Weylon Santana said:

I did everything you said, and what he said above through events.
 

I will not say step by step why it is too long, or send images of how it is done, I will say it in a simple way and then if you can understand it you can reproduce it perfectly.

 

1 - Count how many players are inside the dungeon.

  Reveal hidden contents

Let's say that this dungeon everyone can go, you will need a global variable to count how many players are inside. Every time someone talks to the npc, or uses commands to enter, add 1 to the variable in that counter. When you reach the limit the event that allows players to enter will have a second page, when the total reaches, saying that the event is full.

 

2 - Know who is inside the dungeon.

  Reveal hidden contents

Then you need a local boolean variable, to check if the player is in the event, in a valid way. Every time someone talks to the npc to enter the event, in addition to adding 1 to the global variable, you must set the local boolean variable to on.

 

3 - Dungeon stages.

  Reveal hidden contents

This step is important to match what @Joyce said. In my game the dungeons have stages, so that I know when the dungeon started and when it is still waiting for players to enter. You must do the same. These steps will be 1 global int variable. Because if it waits = 1 and Start = 2, the next item below will make sense.


4 - If a player leaves the dungeon before starting.

  Reveal hidden contents

In this phase of the dungeon wait for the players, sometimes the player will have the chance to leave if he wants to, to return in time. In this case

 

If
"Variable local boolean that I mentioned above" = True
"Global variable that checks the stages of the dungeon" = 1
"Global variable that checks the players"> 0 (this condition is optional, I let you know that there is a player inside and I do not, therefore, leave the value of this negative variable)

 

Then it will decrease 1 of the "Global variable that checks the dungeon steps" and turn off the "Local boolean variable that I mentioned above".

 

Because when he returns, steps 1 and 2 above will be repeated.

Just be aware, the player should leave the event through some / command to return to the city or death. If he uses "teleport to map" magic, it doesn't work. You would have to exchange this spell for an event spell that teleports him to the city.

 

5 - If the player leaves the game.

  Reveal hidden contents

We have 2 occasions.
If "Global variable that checks players" is greater than 0.
Then decrease 1 and turn off the "Variable local boolean I mentioned above" and teleport the player to the city.
If "Global variable that checks the players" is = 0.
Then turn off the "Variable local boolean that I quoted above" and teleport the player to the city.
This is an event that should be "common event" and the trigger is "login"

 

6 - If the player dies in the dungeon.

  Reveal hidden contents

Just repeat step 4. However, it should be in a common event and the trigger is Respawn.


Failures:

  Reveal hidden contents

There is no way to know when the player leaves the game, or to activate events at that time, so if the player leaves the game during the dungeon, after entering, and then joins the game at another time when the dungeon is happening and not there is nobody there. Step 5 helps to prevent. Many strange occasions can happen, but the failure in dungeons of this type is if "Global variable that checks the players" is negative.

Because when the dungeon starts, and the players are entering, this variable will not show the real number inside. For security reasons I always reset the variables to 0 when the dungeon opens and when it closes (either by success or failure).

 

If you are a novice and do not know how to handle events, you will not understand anything I said. But I left a good example of how it works, it is not an easy question, especially if you want more dungeons. If you are a novice, focus on your game on simpler things, and then develop your ability to handle events, conditions and variables. Then return here and you will see that you will be able to understand. If you understood, reproduced perfectly, good, just apply in the same way for other dungeons and NEVER let two dungeons run at the same time IF you are going to use the same player counting variable for both events. How I do.

 

 

Thank you so much for taking your time for all of this. I will study it and once I understand it, try to get something working by trial and error. Again, thank you!

Link to comment
Share on other sites

  • 0
33 minutes ago, MrValenza said:

 

 

Thank you so much for taking your time for all of this. I will study it and once I understand it, try to get something working by trial and error. Again, thank you!

Let me know if you don't understand anything, or if you have problems, if you want, I can show you how it works in my game (this whole part is already translated into English, so you can understand)

Link to comment
Share on other sites

  • 0

I am not that point yet in my game where I should add these as it is in very early alpha stages. I may release a test and see how players do in the 2 dungeons and see if when each dungeon gets stacked if it makes it so easy that I may need to add it. Nonetheless, it is very useful but I am completely new to this so i'd have to take time to understand it so I have an "okay" foundation from my own knowledge thanks to your breakdown of the examples above. Cheers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...