Print Page | Close Window

Names above NPC

Printed From: Mirage Source
Category: Tutorials
Forum Name: Submitted Tutorials
Forum Discription: Tutorial submissions for MSE are posted here, waiting for approval
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=451
Printed Date: 20 December 2006 at 6:05pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Names above NPC
Posted By: Aydan
Subject: Names above NPC
Date Posted: 10 March 2006 at 1:31am
Ok guys here's a tutorial on how to add names above an NPC. This if my first tutorial and it works perfectly for me. Again, go easy on me since I haven't tried this before.

Difficulty: 2/5

Ok guys first of all open up your MIRAGE project. Then open up MODGAMELOGIC.BAS. Add this sub right at the bottem.


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) * 8)
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


Then in the same Module find this code:


        ' Lock the backbuffer so we can draw text and names
        TexthDC = DD_BackBuffer.GetDC
        For i = 1 To MAX_PLAYERS
             If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
                 Call BltPlayerName(i, MapXOffset, MapYOffset)
             End If
        Next i


Underneath it add this peice of code add this:


'Draw NPC Names
For i = LBound(MapNpc) To UBound(MapNpc)
If MapNpc(i).Num > 0 Then
BltMapNPCName i
End If
Next i






Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info