Mirage Engine
Names Under NPCs - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Names Under NPCs (/showthread.php?tid=69)



Names Under NPCs - Tutorial Bot - 01-06-2006

Author: ? (unknown)
Difficulty: 1/5
See Also: http://www.key2heaven.net/ms/forums/viewtopic.php?t=55

:: CLIENT SIDE ::
In modGameLogic.bas, add:
Code:
Sub BltMapNPCName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long

With Npc(MapNpc(Index).Num)
'Draw name
TextX = MapNpc(Index).x * PIC_X + MapNpc(Index).XOffset + CLng(PIC_X / 2) - ((Len(Trim$(.Name)) / 2) * Cool
TextY = MapNpc(Index).y * PIC_Y + MapNpc(Index).YOffset - CLng(PIC_Y / 2) - 4
DrawText TexthDC, TextX, TextY, Trim$(.Name), vbWhite
End With
End Sub

In sub GameLoop, find:
Code:
For i = 1 To MAX_PLAYERS
If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
Call BltPlayerName(i)
End If
Next i

Beneath it, add:
Code:
'Draw NPC Names
For i = LBound(MapNpc) To UBound(MapNpc)
If MapNpc(i).Num > 0 Then
BltMapNPCName i
End If
Next
That's all!