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

Client Crashes with Warps


troglodite
 Share

Recommended Posts

 Ok so… sometimes, when I enter to a house (with a warp tile), the client crashes!

And gives me that line of code:

```

If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then
```
I searched into this site forum and there are other people with the same problem, and I only saw 1 solution to it, [in that thread](http://www.eclipseorigins.com/community/index.php?/topic/132706-engine-crashes-on-warpoccasionally/?hl=%2Bisdirblocked%28map.tile%28getplayerx%28myindex%29%2C+%2Bgetplayery%28myindex%29%29.dirblock%2C+%2Bdirection+%2Bthen), the last post made by **escfoe2**

And I added it, and when I run the client with VB, my client do not crashes; BUT when I simply run the client.exe with double click… CRASHES!

So I think that this solution does not work at all...

Can somebody help me with that?? PLEASE

I am really frustrated about this error! Its VERY annoying :(

This is my actual CheckDirection function

```

Function CheckDirection(ByVal Direction As Byte) As Boolean
Dim x As Long
Dim y As Long
Dim i As Long

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

CheckDirection = False

' check directional blocking
If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then
CheckDirection = True
Exit Function
End If

Select Case Direction
Case DIR_UP
x = GetPlayerX(MyIndex)
y = GetPlayerY(MyIndex) - 1
Case DIR_DOWN
x = GetPlayerX(MyIndex)
y = GetPlayerY(MyIndex) + 1
Case DIR_LEFT
x = GetPlayerX(MyIndex) - 1
y = GetPlayerY(MyIndex)
Case DIR_RIGHT
x = GetPlayerX(MyIndex) + 1
y = GetPlayerY(MyIndex)
End Select

' Check to see if the map tile is blocked or not
If Map.Tile(x, y).Type = TILE_TYPE_BLOCKED Then
CheckDirection = True
Exit Function
End If

' Check to see if the map tile is tree or not
If Map.Tile(x, y).Type = TILE_TYPE_RESOURCE Then
CheckDirection = True
Exit Function
End If

' Check to see if the key door is open or not
If Map.Tile(x, y).Type = TILE_TYPE_KEY Then

' This actually checks if its open or not
If TempTile(x, y).DoorOpen = NO Then
CheckDirection = True
Exit Function
End If
End If

' Check to see if a player is already on that tile
For i = 1 To Player_HighIndex
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
If GetPlayerX(i) = x Then
If GetPlayerY(i) = y Then
CheckDirection = True
Exit Function
End If
End If
End If
Next i

' Check to see if a npc is already on that tile
For i = 1 To Npc_HighIndex
If MapNpc(i).num > 0 Then
If MapNpc(i).x = x Then
If MapNpc(i).y = y Then
CheckDirection = True
Exit Function
End If
End If
End If
Next

' Error handler
Exit Function
errorhandler:
HandleError "checkDirection", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Function
End Function

```
Thx for reading anyway :)
Link to comment
Share on other sites

> The name of the error? The error number? The value of the variables?

Run Time Error 9 - Subscript out of range

MyIndex = 1

Direction = 2

**CheckDirection**
= False

Where must be True
I think:

    If isDirBlocked(Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).DirBlock, Direction + 1) Then

        **CheckDirection** = True

        Exit Function

    End If

In the map where I enter there are some blocks, but far away from the entry… like 10 tiles far away

thx for collaboration Abhi :)
Link to comment
Share on other sites

I found that!

MapNpc(i).num = MapNpc(i).x = MapNpc(i).y = From:

```

' Check to see if a npc is already on that tile
For i = 1 To Npc_HighIndex
If MapNpc(i).num > 0 Then
If MapNpc(i).x = x Then
If MapNpc(i).y = y Then
CheckDirection = True
Exit Function
End If
End If
End If
Next

```
Link to comment
Share on other sites

A friend made a fix and I think it works, because I get no more this bug using warps

I paste this

```

If Map.MaxX < GetPlayerX(MyIndex) Or Map.MaxY < GetPlayerY(MyIndex) Then
Exit Function
End If

```
Just below this

```

Function CheckDirection(ByVal Direction As Byte) As Boolean
Dim x As Long
Dim y As Long
Dim i As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    CheckDirection = False
```
If somebody have this problem, try this fix :)

credits goes to my friend Joan!
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...