[EclipseVB 2.2.1] UpdateMapLogic Fix

Sekaru put in a server loop optimization when he was working on the engine. However, he made a small mistake which led to UpdateMapLogic only being called for the first map. Because of this, NPC’s didn’t attack back, resources didn’t respawn etc.

THIS FIX IS FOR v2.2.1 ONLY

Open up your server in VB6, and find```

Public Sub ServerLoop()


Replace this

Dim i As Long, x As Long

Dim Tick As Long, TickCPS As Long, CPS As Long, FrameTime As Long

Dim tmr25 As Long, tmr500 As Long, tmr1000 As Long

Dim LastUpdateSavePlayers, LastUpdateMapSpawnItems As Long, LastUpdatePlayerVitals As Long

Dim MapNum As Long, LastUpdateMapLogic As Long


With this.

Dim i As Long, x As Long

Dim Tick As Long, TickCPS As Long, CPS As Long, FrameTime As Long

Dim tmr25 As Long, tmr500 As Long, tmr1000 As Long

Dim LastUpdateSavePlayers, LastUpdateMapSpawnItems(1 To MAX_MAPS) As Long, LastUpdatePlayerVitals As Long

Dim MapNum As Long, LastUpdateMapLogic(1 To MAX_MAPS) As Long


Now look for this

 For MapNum = 1 To MAX_MAPS

	 ' Checks to spawn map items every 5 minutes - Can be tweaked

	 If Tick > LastUpdateMapSpawnItems Then

		 UpdateMapSpawnItems MapNum

		 LastUpdateMapSpawnItems = timeGetTime + 300000

	 End If

	 ' update map logic

	 If Tick > LastUpdateMapLogic Then

		 UpdateMapLogic MapNum

		 LastUpdateMapLogic = timeGetTime + 500

	 End I

And replace it with this

 For MapNum = 1 To MAX_MAPS

	 ' Checks to spawn map items every 5 minutes - Can be tweaked

	 If Tick > LastUpdateMapSpawnItems(MapNum) Then

		 UpdateMapSpawnItems MapNum

		 LastUpdateMapSpawnItems(MapNum) = timeGetTime + 300000

	 End If

	 ' update map logic

	 If Tick > LastUpdateMapLogic(MapNum) Then

		 UpdateMapLogic MapNum

		 LastUpdateMapLogic(MapNum) = timeGetTime + 500

	 End I

Save, and compile.

Darn, I have Eclipse VB 2.2.1, so I’m assuming it won’t work?

Darn, I have Eclipse VB 2.2.1, so I’m assuming it won’t work?

Gah ._. You’re right. The most recent engine is 2.2.1. I’ll fix it now.

I’m afraid to say that it isn’t working. I attack the NPC and he still stands there, I have no clue what to do, I did exactly this.

Are you sure you saved and compiled it? Because I was getting the same problem, and this fixed it.

The if statement doesn’t have a matching End If. (It is a typo. :P)


' update map logic

Log in to reply