Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NPC and player leaving map


Snoozey
 Share

Recommended Posts

Lets say 3 monsters are attack on site. Player A runs through and they all start attacking him. He knows he is going to die so he runs out of the map.  The monsters will sit and wait at the exit

Player B walks in. Player B is stuck because npcs are waiting.

Anyways to make the monsters go back if a player leaves a map?
Link to comment
Share on other sites

@Gamzee:

> My idea is to respawn a map everytime when a player attracts more than two NPCs and another player wants to enter this map.

Problem with that is lets say player A is kill npc A. Then NPC B sees player A. Player A is ok with fighting 2 npcs. Player B walks in, map resets.
Link to comment
Share on other sites

Respawning the map as a solution for this will result in a broken as fuck game. Imagine 3 elite NPC"s that can only be killed once every 24 hours. (Or once every hour, i dont care). You kill one, leave the map, all 3 respawn, you go back in, kill one, go out, all respawn.

Or in examples where there are items on the map that are supposed to spawn every X minutes/hours you can just force the items to respawn.

Making the monsters walk back would also require a lot of work.
Link to comment
Share on other sites

@Joost:

> Respawning the map as a solution for this will result in a broken as duck game. Imagine 3 elite NPC"s that can only be killed once every 24 hours. (Or once every hour, i dont care). You kill one, leave the map, all 3 respawn, you go back in, kill one, go out, all respawn.
>
> Or in examples where there are items on the map that are supposed to spawn every X minutes/hours you can just force the items to respawn.
>
> Making the monsters walk back would also require a lot of work.

I was afraid of that, well it is out of my hands then. There is no way I could tweak AI :/
Link to comment
Share on other sites

Currently, NPC movement is only done if there are players on the map (makes sense, don't waste memory calculating what players won't see!)

I guess one solution would be similar to the above, but you wouldn't "respawn the map". Rather, when a player leaves the map, you could "respawn" _alive_ NPCs (the server already sets their HP to full, so this wouldn't change game mechanics a lot).

* * *

Here's an example. I'm not sure if it works, but even if it doesn't, you get the gist.

Find:
```
' Now we check if there were any players left on the map the player just left, and if not stop processing npcs

```
and replace:
```
            If MapNpc(OldMap).Npc(i).Num > 0 Then
                MapNpc(OldMap).Npc(i).Vital(Vitals.HP) = GetNpcMaxVital(MapNpc(OldMap).Npc(i).Num, Vitals.HP)
            End If

```
with:
```
            If MapNpc(OldMap).Npc(i).Num > 0 Then
                Call SpawnNpc(i, OldMap)
            End If

```
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
 Share

×
×
  • Create New...