Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Idea for maps
#23
I looked and everything seems normal. It's quite strange.. If I am on the map when the server is first loaded the npcs don't appear, if I respawn it warp to it or move off the map and back again they still wont appear. Only if I click send again in the map editor. Possibly something to do with the revision I thought but I looked into it and I can't see anything wrong there either.

Also discovered if I send the map the npcs appear and I can log off of the client and back in and they will still be there as if everything were normal. But if I shut down the server and restart it then they won't be...

Just was testing some things. Clearing the maps client side creates an almost random appearance of a tile in the top left corner (0,0) of the map. Usually it's black but sometimes it's a different tile haha. Which is double strange because I don't have any black tiles in the tileset.. Hmm. Then in the map editor it now says there are no Npcs on the map even though they were. This is my saving sub. Maybe I am definitely screwing something up here.

Code:
Sub SaveMap(ByVal MapNum As Long)
Dim F As Long
Dim HeaderBitFlags As Integer
Dim MapNPCCount As Byte
Dim i As Long
Dim x As Long
Dim y As Long
Dim TileBitFlags As Byte

    F = FreeFile
    Open App.Path & "\Data\maps\map" & MapNum & ".dat" For Binary As #F
        With Map(MapNum)
      
            ' Static header
            Put #F, , .Name
            Put #F, , .Revision
          
            ' Dynamic header
            For i = 1 To MAX_MAP_NPCS
                If .Npc(i)  0 Then MapNPCCount = MapNPCCount + 1
            Next

            If .Moral  0 Then HeaderBitFlags = HeaderBitFlags Or 1
            If .TileSet  1 Then HeaderBitFlags = HeaderBitFlags Or 2
            If .Up  0 Then HeaderBitFlags = HeaderBitFlags Or 4
            If .Down  0 Then HeaderBitFlags = HeaderBitFlags Or 8
            If .Left  0 Then HeaderBitFlags = HeaderBitFlags Or 16
            If .Right  0 Then HeaderBitFlags = HeaderBitFlags Or 32
            If .Music  0 Then HeaderBitFlags = HeaderBitFlags Or 64
            If .BootMap  0 Then HeaderBitFlags = HeaderBitFlags Or 128
            If .BootX  0 Then HeaderBitFlags = HeaderBitFlags Or 256
            If .BootY  0 Then HeaderBitFlags = HeaderBitFlags Or 512
            If .Shop  0 Then HeaderBitFlags = HeaderBitFlags Or 1024
            If .MaxX  MAX_MAPX Then HeaderBitFlags = HeaderBitFlags Or 2048
            If .MaxY  MAX_MAPY Then HeaderBitFlags = HeaderBitFlags Or 4096
            If MapNPCCount  0 Then HeaderBitFlags = HeaderBitFlags Or 8192
          
            Put #F, , HeaderBitFlags
          
            If HeaderBitFlags And 1 Then Put #F, , .Moral
            If HeaderBitFlags And 2 Then Put #F, , .TileSet
            If HeaderBitFlags And 4 Then Put #F, , .Up
            If HeaderBitFlags And 8 Then Put #F, , .Down
            If HeaderBitFlags And 16 Then Put #F, , .Left
            If HeaderBitFlags And 32 Then Put #F, , .Right
            If HeaderBitFlags And 64 Then Put #F, , .Music
            If HeaderBitFlags And 128 Then Put #F, , .BootMap
            If HeaderBitFlags And 256 Then Put #F, , .BootX
            If HeaderBitFlags And 512 Then Put #F, , .BootY
            If HeaderBitFlags And 1024 Then Put #F, , .Shop
            If HeaderBitFlags And 2048 Then Put #F, , .MaxX
            If HeaderBitFlags And 4096 Then Put #F, , .MaxY
            If HeaderBitFlags And 8192 Then
                Put #F, , MapNPCCount
                For i = 1 To MAX_MAP_NPCS
                    If .Npc(i)  0 Then Put #F, , .Npc(i)
                Next
            End If
          
            ' Tile encoding
            For y = 0 To Map(MapNum).MaxY
                For x = 0 To Map(MapNum).MaxX
                    TileBitFlags = 0
                    With .Tile(x, y)
                        If .Ground  0 Then TileBitFlags = TileBitFlags Or 1
                        If .Mask  0 Then TileBitFlags = TileBitFlags Or 2
                        If .Anim  0 Then TileBitFlags = TileBitFlags Or 4
                        If .Fringe  0 Then TileBitFlags = TileBitFlags Or 8
                        If .Type  0 Then TileBitFlags = TileBitFlags Or 16
                        If .Data1  0 Then TileBitFlags = TileBitFlags Or 32
                        If .Data2  0 Then TileBitFlags = TileBitFlags Or 64
                        If .Data3  0 Then TileBitFlags = TileBitFlags Or 128
            
                        Put #F, , TileBitFlags
            
                        If TileBitFlags And 1 Then Put #F, , .Ground
                        If TileBitFlags And 2 Then Put #F, , .Mask
                        If TileBitFlags And 4 Then Put #F, , .Anim
                        If TileBitFlags And 8 Then Put #F, , .Fringe
                        If TileBitFlags And 16 Then Put #F, , .Type
                        If TileBitFlags And 32 Then Put #F, , .Data1
                        If TileBitFlags And 64 Then Put #F, , .Data2
                        If TileBitFlags And 128 Then Put #F, , .Data3
                    End With
                Next
            Next
            
        End With
      
    Close #F
    
    DoEvents
End Sub

Do I need to do this the same way for the client or can I leave it as it normally is? Might be a stupid question xD
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)