Player name being moving on large maps(EO 2.3)

engine using : EO 2.3

player name moves when your on a larger maps.

this started to happen once the offset of the map was fixed.

below is what was changed for fixing the offset of the map (the “- camera.left” and " - camera.top" are what was added)


Public Function ConvertMapX(ByVal X As Long) As Long

	 ' If debug mode, handle error then exit out

	 If Options.Debug = 1 Then On Error GoTo ErrorHandler

	 ConvertMapX = X - (TileView.Left * PIC_X) - Camera.Left

	 ' Error handler

	 Exit Function

ErrorHandler:

	 HandleError "ConvertMapX", "modDirectX7", Err.Number, Err.Description, Err.Source, Err.HelpContext

	 Err.Clear

	 Exit Function

End Function

Public Function ConvertMapY(ByVal Y As Long) As Long

	 ' If debug mode, handle error then exit out

	 If Options.Debug = 1 Then On Error GoTo ErrorHandler

	 ConvertMapY = Y - (TileView.Top * PIC_Y) - Camera.Top

	 ' Error handler

	 Exit Function

ErrorHandler:

	 HandleError "ConvertMapY", "modDirectX7", Err.Number, Err.Description, Err.Source, Err.HelpContext

	 Err.Clear

	 Exit Function

End Function

this is the char name code for its x and y.


' calc pos < top line at "-30" is players name X , on the second textY with "-16" is player name Y.

TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) - 30

GuildString = Player(Index).GuildName

Text2X = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GuildString)))

	 If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then

TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16

Text2Y = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset

Else

' Determine location for text

TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) - 16

Text2Y = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 4

End If

' Draw name

Call DrawText(TexthDC, TextX, TextY, Name, color)

If Not Player(Index).GuildName = vbNullString Then

Call DrawText(TexthDC, Text2X, Text2Y, GuildString, color)

End If

anyone know how to make it stop sliding around on larger maps?

Why exactly did you need to “fix” the offset of the map? What was wrong with it?

it was offseted+1 tile space from top and left side.

stilll dont know how to fix the name 😕

How big is your map? Give me the exact x/y

EDIT: I’m taking a blank copy of EO 2.3 and testing everything right now. I’ll let you know what I come up with.

my picscreen is

picScreen.width = 832

picScreen.height = 608

and the test size i used was 30x20 sized map. when i walked in larger maps it was sliding around(you have to put in the convertions above)

and i got a gui texture over the whole picscreen .

Log in to reply