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

  • 0

I made a rather simple event which works splendid in singleplayer. It is an NPC SPAWNER. With each NPC spawned, it adds +1 to a gobal variable (COUNTER). To each NPC killed by the player is tied a common event that subtracts -1 to the COUNTER. This variable can never be higher than 4; if it gets lower than 4, another NPC is spawned.

If the SPAWNER detects that the player has equipped a special amulet, all NPCs are despawned and the global variable COUNTER is reset to 0.

In multiplayer, if two players are on the map, the flaw in the engine is that from now on there exist two versions of the global variable COUNTER, which should be impossible.

I made a chatbox command to show the current value of the variable, this is what it shows:

Player one's COUNTER changes between 0-4, just like it was intended, having the amulet.

With player two it remains 0, and the SPAWNER does not stop to create new NPCs, since the player does not possess the amulet, hence cannot equip it. Player one's event cannot kill these NPCs by equipping and unequipping the amulet.

Ingame the players can shuffle the amulet between each other as a kind of workaround to get rid of the abundance of monsters.

 

So either I am going to rework my quest so that it will become singleplayer only, or I will have to add another layer of autorun events that provide each player on the map with the special amulet (which would not be very realistic).

 

For what I have seen until now, the events that spawn and despawn NPCs are always connected to a player - and this can not be overruled by the "global" tag, e.g., by a global variable. It does not help if you create a common event, as this will always need a trigger on the map which will again be connected to the first player who triggers it. This gets even worse when this player leaves the map as it will render the respective event completely non-reactive. And I get the impression, if you keep tinkering around long enough, you can break the event editor alltogether and have to reinstall.

 

@CosakiGames Keep it as a feature, as long as the engine does not provide more options regarding true multiplayer.;)

 

 

 

 

 

Link to comment
Share on other sites

  • 0
1 hour ago, Uranochos said:

I made a rather simple event which works splendid in singleplayer. It is an NPC SPAWNER. With each NPC spawned, it adds +1 to a gobal variable (COUNTER). To each NPC killed by the player is tied a common event that subtracts -1 to the COUNTER. This variable can never be higher than 4; if it gets lower than 4, another NPC is spawned.

If the SPAWNER detects that the player has equipped a special amulet, all NPCs are despawned and the global variable COUNTER is reset to 0.

In multiplayer, if two players are on the map, the flaw in the engine is that from now on there exist two versions of the global variable COUNTER, which should be impossible.

I made a chatbox command to show the current value of the variable, this is what it shows:

Player one's COUNTER changes between 0-4, just like it was intended, having the amulet.

With player two it remains 0, and the SPAWNER does not stop to create new NPCs, since the player does not possess the amulet, hence cannot equip it. Player one's event cannot kill these NPCs by equipping and unequipping the amulet.

Ingame the players can shuffle the amulet between each other as a kind of workaround to get rid of the abundance of monsters.

 

So either I am going to rework my quest so that it will become singleplayer only, or I will have to add another layer of autorun events that provide each player on the map with the special amulet (which would not be very realistic).

 

For what I have seen until now, the events that spawn and despawn NPCs are always connected to a player - and this can not be overruled by the "global" tag, e.g., by a global variable. It does not help if you create a common event, as this will always need a trigger on the map which will again be connected to the first player who triggers it. This gets even worse when this player leaves the map as it will render the respective event completely non-reactive. And I get the impression, if you keep tinkering around long enough, you can break the event editor alltogether and have to reinstall.

 

@CosakiGames Keep it as a feature, as long as the engine does not provide more options regarding true multiplayer.;)

 

 

 

 

 

Thanks for the feedback.

 

I do believe I have finally figured out a work-around.

 

I made the player warp event add +1 to a variable which has a string of conditional branches; each conditional branch has a timer based on the variable (1-4) which is reset to 0 at the end of the Instanced Map. Each branch also adds to another Global Variable that the 'Spawn NPC' main event checks is '1',  which +1 is added for each player that is warped (1 second after each other). These seems to have stopped the NPC doubling.

The only problem with the event now is the 'NPC event on death (for party) doesnt seem to be working [after upgrading to 6.2]. and I use that function to warp the players after the boss is defeated and give them loot.

Link to comment
Share on other sites

  • 0

Sorry if I'm just missing it, but I don't see anywhere the runic run timer variable is even actually used.. it gets set to 1 when timer starts and set to 0 when it ends, but don't see any logic keying off of that variable?

Is it intended that players relog are kicked out, even if it's still active? Not sure if that's a limitation of the event system or not

Link to comment
Share on other sites

  • 0
1 hour ago, Vaiku said:

Sorry if I'm just missing it, but I don't see anywhere the runic run timer variable is even actually used.. it gets set to 1 when timer starts and set to 0 when it ends, but don't see any logic keying off of that variable?

Is it intended that players relog are kicked out, even if it's still active? Not sure if that's a limitation of the event system or not

The timer was to kick players out if they stayed too long.

This system went through many versions after this, but in essence this is not a feasible way to make an instanced party event.
 

Link to comment
Share on other sites

  • 0
4 minutes ago, CosakiGames said:

The timer was to kick players out if they stayed too long.

This system went through many versions after this, but in essence this is not a feasible way to make an instanced party event.
 

That's unfortunate! What did you run into that stopped this from working? seemed like you were on the right track!

Link to comment
Share on other sites

  • 0
13 hours ago, Vaiku said:

That's unfortunate! What did you run into that stopped this from working? seemed like you were on the right track!

It requires 'Auto-run' triggers to warp party members, which is a killer on the server.
There are also issues with global timers if you have a server crash, and I think a few other things that just make it not worth the trouble. (at least for me since it is not important to my game)

There is someone working on adding a Map Instance feature to the engine - but that may be a long time before its ready.

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