smashman186 Posted August 6, 2011 Author Share Posted August 6, 2011 Ok, Heres how you make a Npc have its level over its name.First, Open Client.vbp. Now scroll down to "ModText (modText.Bas) And double click it. Now push "ctrl" + "F" Keys.Type in "Public Sub DrawNpcName(ByVal Index As Long)" Now scroll down a little until you see->! Name = Trim$(Npc(npcNum).Name) TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) If Npc(npcNum).Sprite < 1 Or Npc(npcNum).Sprite > NumCharacters Then TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16 Else ' Determine location for text TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(Npc(npcNum).Sprite).lHeight / 4) + 16 End If>! ' Draw name Call DrawText(TexthDC, TextX, TextY, Name, color) - Now, Right Under the>! 'Draw name Call DrawText(RexthDC, TextX, TextY, Name, color) - Add ->! ' calc pos Level = Trim$(Npc(npcNum).Level) TextA = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & (Npc(npcNum).Level)))) If Npc(npcNum).Sprite < 1 Or Npc(npcNum).Sprite > NumCharacters Then TextB = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 5 Else ' Determine location for text TextB = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(Npc(npcNum).Sprite).lHeight / 4) + 5 End If 'Draw level Call DrawText(TexthDC, TextA, TextB, "Level " & (Npc(npcNum).Level), color) - Now scroll back up to "Public Sub DrawNpcName(ByVal Index As Long)" And find ->! Dim npcNum As Long - Now, Right below it, Add ->! Dim TextA As LongDim TextB As LongDim Level As String - Now your done! Go up to your vb6 Toolbar, And click on "File" Then click on "save project" Then, Click on "File" Again, And click on "Make Eclipse Orgines.exe" Or w/e your game name is.Now your done! :D Simple edit, I know, But it took me like 2 hours to figure it out o.o Good for noobs like me, right? :DI don't take credit for anything except for copying and pasting o.o Heres the full code for it ->! Public Sub DrawNpcName(ByVal Index As Long)Dim TextX As LongDim TextY As LongDim color As LongDim Name As StringDim npcNum As LongDim TextA As LongDim TextB As LongDim Level As String>! ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler>! npcNum = MapNpc(Index).num>! Select Case Npc(npcNum).Behaviour Case NPC_BEHAVIOUR_ATTACKONSIGHT color = QBColor(BrightRed) Case NPC_BEHAVIOUR_ATTACKWHENATTACKED color = QBColor(Yellow) Case NPC_BEHAVIOUR_GUARD color = QBColor(Grey) Case Else color = QBColor(BrightGreen) End Select>! Name = Trim$(Npc(npcNum).Name) TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) If Npc(npcNum).Sprite < 1 Or Npc(npcNum).Sprite > NumCharacters Then TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16 Else ' Determine location for text TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(Npc(npcNum).Sprite).lHeight / 4) + 16 End If>! ' Draw name Call DrawText(TexthDC, TextX, TextY, Name, color) ' calc pos Level = Trim$(Npc(npcNum).Level) TextA = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$("Level " & (Npc(npcNum).Level)))) If Npc(npcNum).Sprite < 1 Or Npc(npcNum).Sprite > NumCharacters Then TextB = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 5 Else ' Determine location for text TextB = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(Npc(npcNum).Sprite).lHeight / 4) + 5 End If 'Draw level Call DrawText(TexthDC, TextA, TextB, "Level " & (Npc(npcNum).Level), color) ' Error handler Exit Suberrorhandler: HandleError "DrawNpcName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub - All you have to do is erase "Public Sub DrawNpcName(ByVal Index As Long)" And right click on your mouse and select paste! :DThanks for reading, And i hope its easy to understand….Because i like reading easy to understand tuturials! :D Link to comment Share on other sites More sharing options...
Spitzy Posted September 4, 2011 Share Posted September 4, 2011 What do i use to open Client.vpb? Link to comment Share on other sites More sharing options...
Domino_ Posted September 4, 2011 Share Posted September 4, 2011 Isn't there other way where I dont need to mess up with lot of coding?Okey… less coding than in your tut, cuz I dont think that I need to add all this to get npc lvl... Link to comment Share on other sites More sharing options...
Beanie93 Posted September 4, 2011 Share Posted September 4, 2011 You have to add all that to calculate the location of where you want the NPC level to be drawn… Link to comment Share on other sites More sharing options...
quintensky Posted September 6, 2011 Share Posted September 6, 2011 shouldnt this be in source tutorials? Link to comment Share on other sites More sharing options...
eric9 Posted September 8, 2011 Share Posted September 8, 2011 I followed this guide and everything worked fine, but I never said thank you. So… Thank you very much. Link to comment Share on other sites More sharing options...
emmanoelbs Posted September 12, 2011 Share Posted September 12, 2011 i cant encounter this at my EO. this tutorial is for EE? why i cant encounter this at client.vbp? (i encountered the file client.vbp and opened it with "notes block"). please help me. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted September 12, 2011 Share Posted September 12, 2011 You need Visual Basic 6 to open client.vbp. Nothing else will work. Read the guide in that big 'TUTORIALS' tab. Link to comment Share on other sites More sharing options...
gothikaboy Posted September 27, 2011 Share Posted September 27, 2011 this would be ten times easier in c++. Link to comment Share on other sites More sharing options...
shadowwulf Posted September 28, 2011 Share Posted September 28, 2011 wow. Why aren't you just editing the draw text line?After the variable containing the NPC's name add```& " " & npc(npcnum).level```Might be harder than this since i havent actually looked but thats the direction I would have headed. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now