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

[FIXED] Map convertor problem


erkro1
 Share

Recommended Posts

I have edited Eclipse Dawn's Map Convertor to convert the maps, and its working, but not everything, because after I converted and go to a map the whole map is black and all the attributes are gone too.

Here's my convertor:
http://www.freemmorpgmaker.com/files/imagehost/pics/ae333a2f5752472f4bba082b412cb169.rar

Thanks for reading.
Link to comment
Share on other sites

_Notation_: [project]:[module]:[line (or from_line - to_line)].

Each error is followed by a solution.

Error is on MapConvert:modLogic.bas:68.

```
    ReDim OldMap.Tile(0 To NewMap.MaxX, 0 To NewMap.MaxY)

```

>! ReDim deletes the entire array, and then resizes it. If you need to preserve the array contents, you must use ReDim Preserve.

One more error at MapConvert:modLogic.bas:32-40.

```
Private Sub LoadMap(ByVal SFileName As String)
    Dim filename As String
    Dim F As Long
    filename = App.Path & "\old\" & SFileName
    F = FreeFile
    Open filename For Binary As #F
    Get #F, , OldMap
    Close #F
End Sub

```

>! Your Sub LoadMap is incorrect. Eclipse uses a dynamic array for the tiles, to allow elastic x and y. Your Sub LoadMap attempts to shove in the data with no regards for the dynamic array. For a correct way to do so, look at server:modDatabase.bas:993-1038.
Link to comment
Share on other sites

When I now login server gets Subscript out of Range on:
```
If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_ATTACKONSIGHT Or NPC(npcNum).Behaviour = NPC_BEHAVIOUR_GUARD Then
```
npcNum = 196608

EDIT: I've uploaded the version with edits Soul told me to do:
http://www.freemmorpgmaker.com/files/imagehost/pics/d56bd09c4984b9725c0f7c02ca243878.rar
Link to comment
Share on other sites

@Erwin:

> **I have edited the Account Convertor** to convert the maps, and its working, but not everything, because after I converted and go to a map the whole map is black and all the attributes are gone too.
>
> Here's my convertor:
> http://www.freemmorpgmaker.com/files/imagehost/pics/ae333a2f5752472f4bba082b412cb169.rar
>
> Thanks for reading.
Link to comment
Share on other sites

You should fix the following:

@Soul:

> ```
> Private Sub LoadMap(ByVal SFileName As String)
>     Dim filename As String
>     Dim F As Long
>     filename = App.Path & "\old\" & SFileName
>     F = FreeFile
>     Open filename For Binary As #F
>     Get #F, , OldMap
>     Close #F
> End Sub
>
> ```
>
> >! Your Sub LoadMap is incorrect. Eclipse uses a dynamic array for the tiles, to allow elastic x and y. Your Sub LoadMap attempts to shove in the data with no regards for the dynamic array. For a correct way to do so, look at server:modDatabase.bas:993-1038.
> >! If you need further clarification, just ask.
Link to comment
Share on other sites

Well, my LoadMap now looks like this:
```
Private Sub LoadMap(ByVal SFileName As String)
    Dim filename As String
    Dim F, X, Y, Z, i As Long
    filename = App.Path & "\old\" & SFileName
    F = FreeFile
    Open filename For Binary As #F
        Get #F, , OldMap.Name
        Get #F, , OldMap.Music
        Get #F, , OldMap.Revision
        Get #F, , OldMap.Moral
        Get #F, , OldMap.Up
        Get #F, , OldMap.Down
        Get #F, , OldMap.Left
        Get #F, , OldMap.Right
        Get #F, , OldMap.BootMap
        Get #F, , OldMap.BootX
        Get #F, , OldMap.BootY
        Get #F, , OldMap.MaxX
        Get #F, , OldMap.MaxY

        ' have to set the tile()
        ReDim Preserve OldMap.Tile(0 To OldMap.MaxX, 0 To OldMap.MaxY)

        For X = 0 To OldMap.MaxX
            For Y = 0 To OldMap.MaxY
                For i = 1 To 5
                    Get #F, , OldMap.Tile(X, Y).Layer(i).X
                    Get #F, , OldMap.Tile(X, Y).Layer(i).Y
                    Get #F, , OldMap.Tile(X, Y).Layer(i).Tileset
                Next i

                Get #F, , OldMap.Tile(X, Y).Type
                Get #F, , OldMap.Tile(X, Y).Data1
                Get #F, , OldMap.Tile(X, Y).Data2
                Get #F, , OldMap.Tile(X, Y).Data3
                Get #F, , OldMap.Tile(X, Y).DirBlock
            Next Y
        Next X

        For Z = 1 To MAX_MAP_NPCS
            Get #F, , OldMap.NPC(Z)
        Next Z

        Get #F, , OldMap.Owner
        Get #F, , OldMap.BossNpc
        Get #F, , OldMap.Weather
        Get #F, , OldMap.Intensity

    Close #F
End Sub
```
But that makes my client crash, I think its because of all the Tile loading stuff, because when I make it Get #F, , OldMap.Tile(X, Y) then it works fine.
Link to comment
Share on other sites

Yeah Get #F, , OldMap.Tile(X, Y) should be fine.

Over in ConvertMap you seem to have a problem:
```
    For Z = 1 To MAX_MAP_NPCS
        NewMap.NPC(i) = OldMap.NPC(i)
    Next Z

```
it should be:
```
    For Z = 1 To MAX_MAP_NPCS
        NewMap.NPC(Z) = OldMap.NPC(Z)
    Next Z

```
Also you should save the map just like you load it, again, see Sub SaveMap in the server.

I'm not sure if these would cause the problem though. Try printing out information about the map as you are converting it (e.g., it's name, the music) and see where they start becoming different.
Link to comment
Share on other sites

@Soul:

> Yeah Get #F, , OldMap.Tile(X, Y) should be fine.
>
> Over in ConvertMap you seem to have a problem:
> ```
>     For Z = 1 To MAX_MAP_NPCS
>         NewMap.NPC(i) = OldMap.NPC(i)
>     Next Z
>
> ```
> it should be:
> ```
>     For Z = 1 To MAX_MAP_NPCS
>         NewMap.NPC(Z) = OldMap.NPC(Z)
>     Next Z
>
> ```
> Also you should save the map just like you load it, again, see Sub SaveMap in the server.
>
> I'm not sure if these would cause the problem though. Try printing out information about the map as you are converting it (e.g., it's name, the music) and see where they start becoming different.

Soul in action :P Again he helped solve problem :cheesy:
Link to comment
Share on other sites

@Deathbeam:

> Soul in action :P Again he helped solve problem :cheesy:

@Erwin:

> Haha, yep, he's a god, anyway, I think I'll make a topic for the Map Convertor in the Resource section so people can use it.

Glad to help. Thanks for releasing the converter as well, I'm sure people will get a lot of use out of it.
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...