Jump to content
  • 0

NPCs multiply on Event per Player (Help)


Push

Question

I am in the process of making an Instanced dungeon run via Events to share with the community.
It works very well at the moment besides one 'flaw' (which could be a feature)
 

Problem: The NPCs spawned during the event multiply with every player in the party that warps to the map.

Event Details:

~ Player checks a Map Event 'Runic Circle' - If player has a 'Runic Shard' item, the player is warped to an instanced dungeon called 'Runic Run'.

~ Any party members are also are warped. (This does not effect outside players)

~ A timer is started and 4 NPCs are spawned.

~ After a set duration, the Boss is spawned.
~The instance ends when either: Timer runs out, or Boss is defeated.
~Players are warped back to original Map.
~Players who log out and reenter the map will be warped to original map (to stop greifing)

~Defeating the Boss rewards an item. +Text.
~The Instance is Locked while it is active to outside players.

 

I've been testing this for the past 2 days and everything works wonderful besides the NPCs multiplying.

I could keep this as a 'feature' but id like to know how to prevent this.

Map Event Trigger:
c6dfbfe89e996638a5f1048683a37c7f.png

Common Event - NPC Trigger:

a5fb861fa41a74dfca3aaca8644a7d4b.png

Common Event - Player(s) Warp Trigger:

1715afa3c8d60fff6088774e0f9f91c4.png

Common event - Timer Trigger:
2f3ec2085564ec2c24f24991ab03b4dd.png

Common event - Player Kick (on Login):

ad69ac68243260f41b7de6c9fe871dcb.png

 

Link to comment
Share on other sites

Recommended Posts

  • 1

Curious question, but could you not set a variable on the first player to enter the map, then set a variable that this value has been given (which resets when the dungeon resets) and then only spawn the npcs for the player with this variable?

 

The main issue you're fighting here is that events simply run for every player. So you have to come up with something to stop it from doing so.

Link to comment
Share on other sites

  • 0

I spent about 5 min writing, but it didn't work, it got a bug and I lost what I was writing. Then go again, it will be more summarized then and simple than I said the first time.

 

1 - Creates a global variable

2 - creates a conditional branch within '' runic = 1 '' - if this variable is equal to or less than 4.

3 - under each lost imp spawn, add 1 to this global variable and place a 500ms or 1000ms wait

4 - creates another branch for when this global variable is equal to 5 - to spawn npc zei, add 1 too

 

In my mind and from what has already happened to me, from the moment that the variable is no longer in the condition, the event must stop spawning, it must be global variable because it is something common for everyone.

I believe that if it does, it can work.

70e143a212548c127f300493ad8c2afd.png

Although the editor is translated my way, you can understand. Let me know if it works @CosakiGames

Edited by Weylon Santana
edited
Link to comment
Share on other sites

  • 0
11 hours ago, AisenArvalis said:

The reason to why it's multiplying is because an event is tied to the player entity. So if 4 players are there, it'll run 4 times.

I'll see if I can find a solution

Yeah, this is what I thought, I just dont know how to work around it.

Link to comment
Share on other sites

  • 0
2 hours ago, Uranochos said:

@CosakiGames

The event Runic Run1 is started by command in the event Runic Run, so you mustn't set the trigger Autorun.

Yes, if I set it to trigger: none, The event would stop at the next conditional branch.

But you and @AisenArvalis sparked my thoughts again, I might have a solution. (testing now)



EDIT: Nope, even working around the autorun trigger caused the same problem.

Link to comment
Share on other sites

  • 0

This is a very interesting problem and I am learning a lot from this, thank you very much!

 

If I had to do this, I would first seperate the things that have to be done only once in Runic Run1 (If the global variable Runic Run Active =1, spawn the NPCs and the boss, wait, despawn the NPcs, finally set the global variable =0) from the part that has to be done for every single player (Next conditional, warp players etc).

You have done this before:

Your master event Runic Run starts the event Runic Run Timer in this way, once, I suppose, trigger set to "none".

The event Runic Run 1 Warp, however, is startet in the same way but runs for every player, trigger set to "autorun" (meaning as long as there is a player with the player variable Start RUNIC RUN =1).

Link to comment
Share on other sites

  • 0
18 minutes ago, Uranochos said:

This is a very interesting problem and I am learning a lot from this, thank you very much!

 

If I had to do this, I would first seperate the things that have to be done only once in Runic Run1 (If the global variable Runic Run Active =1, spawn the NPCs and the boss, wait, despawn the NPcs, finally set the global variable =0) from the part that has to be done for every single player (Next conditional, warp players etc).

You have done this before:

Your master event Runic Run starts the event Runic Run Timer in this way, once, I suppose, trigger set to "none".

The event Runic Run 1 Warp, however, is startet in the same way but runs for every player, trigger set to "autorun" (meaning as long as there is a player with the player variable Start RUNIC RUN =1).

I took out the entire 'timer' function as it was redundant to the main event 'Runic Run 1', same thing happened.

If i set the trigger to none, it wont run at all.

I've changed things around to not have 'Runic Run 1' start with a conditional branch, same thing happened.

I also had the main event rigger a timer that would then trigger the 'Runic Run 1' - same problem.

I will keep working on it. I appreciate the help!

 

Link to comment
Share on other sites

  • 0
20 hours ago, Weylon Santana said:

I spent about 5 min writing, but it didn't work, it got a bug and I lost what I was writing. Then go again, it will be more summarized then and simple than I said the first time.

 

1 - Creates a global variable

2 - creates a conditional branch within '' runic = 1 '' - if this variable is equal to or less than 4.

3 - under each lost imp spawn, add 1 to this global variable and place a 500ms or 1000ms wait

4 - creates another branch for when this global variable is equal to 5 - to spawn npc zei, add 1 too

 

In my mind and from what has already happened to me, from the moment that the variable is no longer in the condition, the event must stop spawning, it must be global variable because it is something common for everyone.

I believe that if it does, it can work.

70e143a212548c127f300493ad8c2afd.png

Although the editor is translated my way, you can understand. Let me know if it works @CosakiGames

Wow! I think that may have been the solution!

Changing the variable to '2' after the first NPC spawn seems to have stopped the multiplier.
I will do some testing and post the results.

 

Link to comment
Share on other sites

  • 0
9 minutes ago, CosakiGames said:

Wow! I think that may have been the solution!

Changing the variable to '2' after the first NPC spawn seems to have stopped the multiplier.
I will do some testing and post the results.

 

If you change the variable to 2 and 1 player go to the event. 1 monster will be summoned. If 2 players are, 2 monsters will be summoned. As Aisen said, the event runs for each player on the map. So one more variable could be better in this situation to stop multiplication per player. Test my way, if it works you will already have the solution, if not, from there then, start making changes. Let me know if it works, this case is looking like a soap opera where we can participate hahaha

Link to comment
Share on other sites

  • 0
1 minute ago, CosakiGames said:

Solved:
 

Common Event" 'Runic Run 1' needs a wait timer + change to 'Runic Active' variable to 2.
I put this after the 1st NPC spawns. I will make a tutorial for this event soon after final testing is done.

Thank you @Weylon Santana for coming up with a solution!

 

There was a sparkle in my eyes already

Just now, CosakiGames said:

actually it just multiplied again... wtf

but reality is cruel ahah

 

send photos of the events currently

Link to comment
Share on other sites

  • 0
13 minutes ago, Weylon Santana said:

There was a sparkle in my eyes already

but reality is cruel ahah

 

send photos of the events currently

hahaha right?

 

I did what you said, and it worked 1 time. but on the second try it did the same thing.
Ill try to post my results tomorrow. Still working on it.

Link to comment
Share on other sites

  • 0
9 hours ago, Joyce said:

Curious question, but could you not set a variable on the first player to enter the map, then set a variable that this value has been given (which resets when the dungeon resets) and then only spawn the npcs for the player with this variable?

 

The main issue you're fighting here is that events simply run for every player. So you have to come up with something to stop it from doing so.

Good idea. I will try that.

The event system seems to be pretty strange when it comes to NPC spawning. Setting variables always works, but spawning NPCs doesnt. Nor does the 'release player' function.

Link to comment
Share on other sites

  • 0
17 hours ago, CosakiGames said:

hahaha right?

 

I did what you said, and it worked 1 time. but on the second try it did the same thing.
Ill try to post my results tomorrow. Still working on it.

 

If it did run perfectly for one time, and now you have the same problem as before, did you forget to reset a critical variable?

Link to comment
Share on other sites

  • 0
7 minutes ago, Uranochos said:

 

If it did run perfectly for one time, and now you have the same problem as before, did you forget to reset a critical variable?

I tried it with resetting the variable. It did not work still.

 

Though I have the solution now thanks to @Joyce

Testing now, has worked multiple times. Just going to make sure its 100%

 

Link to comment
Share on other sites

  • 0
11 hours ago, Joyce said:

Curious question, but could you not set a variable on the first player to enter the map, then set a variable that this value has been given (which resets when the dungeon resets) and then only spawn the npcs for the player with this variable?

 

The main issue you're fighting here is that events simply run for every player. So you have to come up with something to stop it from doing so.

So far, this is working well.
I am testing with a party on the same PC with multiple clients - do you think there will be different outcome with other clients connected over a server? or should be the same?

Not sure if the latency would effect things.

Link to comment
Share on other sites

  • 0
2 minutes ago, CosakiGames said:

So far, this is working well.
I am testing with a party on the same PC with multiple clients - do you think there will be different outcome with other clients connected over a server? or should be the same?

Not sure if the latency would effect things.

I'm not 100% sure, there is a possibility.

But it's the fastest way I could think to fix this particular problem within the current limitations of the Event system.

Link to comment
Share on other sites

  • 0

@CosakiGames

I am experiencing a very similar problem, that's why I am so interested in a solution.

The event system does not always recognize a global variable as truly global, it seems...

 

On 5/30/2020 at 8:01 PM, CosakiGames said:

So far, this is working well.
I am testing with a party on the same PC with multiple clients - do you think there will be different outcome with other clients connected over a server? or should be the same?

Not sure if the latency would effect things.

 

I have tested multiplayer with multiple PCs and with multiple clients on the same PC, it did not make a difference.

 

Link to comment
Share on other sites

  • 0
3 hours ago, Uranochos said:

@CosakiGames

I am experiencing a very similar problem, that's why I am so interested in a solution.

The event system does not always recognize a global variable as truly global, it seems...

 

 

I have tested multiplayer with multiple PCs and with multiple clients on the same PC, it did not make a difference.

 

Thank you, that is good to know!

 

I upgraded to 6.2, but the event still keeps breaking.

There seems to be some issues with events that get too complex or has too long of a 'wait' time.

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...