00GuthixLord Posted July 12, 2012 Author Share Posted July 12, 2012 I Couldn't Find A Tutorial For This So I Went In The Code, Messed Around And I Got It To Work :)Level Outcome:![](http://i48.tinypic.com/az7vgx.png)This Is All Client Based, It's All In modText, And The Sub DrawPlayerName.Ok First We Need To Add The Variables We Are Going To Use. So Find This:```Dim TextX As LongDim TextY As LongDim color As LongDim Name As String```And Add These To The List:```Dim TextY2 As LongDim Level As String```Those Will Be Explained Soon. Now If You Go Down And Find This:``` Name = Trim$(Player(Index).Name)```I Copied & Pasted That Code Under It But Changed It To This:``` Level = Trim$(Player(Index).Level)```That Tells The Code That The Variable Level Is The Players Level. Now About 3 Lines Under That Is This:``` TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16```Copy And Paste That Under It, Then Change It So It Looks Like This:``` TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16```That Tells The Code Where TextY2 is Located On The Player. Now You See That They Both Say 16\. Well That's Bad, They Will Both Be Touching Like That, So I Changed The TextY's 16 To -1 And I Thought That It Looked Good, But If You Don't Like It Then You Can Change It.Now About 3 Lines Under Is This:``` TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16```Ok, You Need To Copy And Paste That Under It. Before You Edit The One You Pasted Change The 16 On The First One To -1\. Now Just Add The 2 On The Pasted One So It Looks Like This:``` TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16```Now A Couple Lines Down Is This:``` Call DrawText(TexthDC, TextX, TextY, Name, color)```Now Again I Would Copy Then Paste Under It. Change The Bottom One To This:``` Call DrawText(TexthDC, TextX - 1, TextY2, "[Lv. " & Level & "]", color)```That Tells The Code To Position It -1 Off The Normal(So It's Centered) And Adds The [Lv. 1] Under The Name. If The -1 Isn't Centered You Can Change It. If Some One Has A Way To Easily Center It Better I Would Like To Know Thanks. :cheesy:I Hope This Works For You And Helps :cheesy:Finished Code>! Variables:```Dim TextX As LongDim TextY As LongDim TextY2 As LongDim color As LongDim Name As StringDim Level As String>! ```The Other Stuff:``` Name = Trim$(Player(Index).Name) Level = Trim$(Player(Index).Level) ' calc pos TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name))) If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - -1 TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16 Else ' Determine location for text TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + -1 TextY2 = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight / 4) + 16 End If>! ' Draw name Call DrawText(TexthDC, TextX, TextY, Name, color) Call DrawText(TexthDC, TextX - 1, TextY2, "[Lv. " & Level & "]", color)>! ```Sorry If I Messed Up On Grammar Or Spelling I'm Bad A Typing Tutorials, So I Tend To Mess Up. ;) Link to comment Share on other sites More sharing options...
Synergy Posted July 12, 2012 Share Posted July 12, 2012 Looks good.Two things though.. In future, you do not need to use Capital Letters At The Start Of Every Word In A Sentence. It makes a sentence really difficult to read as it breaks up the natural flow of the sentence.Secondly, it's quite crowded (the tutorial) so I'd suggest you space stuff out a bit more so it's easier to see which line is related to which bit of code.Those are just comments on the tutorial, the actual code looks good though. :) Link to comment Share on other sites More sharing options...
Whackeddie99 Posted July 12, 2012 Share Posted July 12, 2012 There is a tutorial for this already I thought? Check the source index.Warning - while you were reading a new reply has been posted. You may wish to review your post.dammit Link to comment Share on other sites More sharing options...
Synergy Posted July 12, 2012 Share Posted July 12, 2012 @Whack:> There is a tutorial for this already I thought? Check the source index.There is, but let him have his moment. :P Link to comment Share on other sites More sharing options...
Whackeddie99 Posted July 12, 2012 Share Posted July 12, 2012 @Synergy:> There is, but let him have his moment. :P*moment given* Link to comment Share on other sites More sharing options...
00GuthixLord Posted July 12, 2012 Author Share Posted July 12, 2012 Oh i didn't see that there was another tutorial for it, I looked for a while for one, And ill try to space it out more. The hardest part is the caps, I either put caps at every letter or i don't it's just a habit. So thanks :)LoL this took a while to write getting the caps and stuff… Link to comment Share on other sites More sharing options...
Synergy Posted July 12, 2012 Share Posted July 12, 2012 @00GuthixLord:> Oh i didn't see that there was another tutorial for it, I looked for a while for one, And ill try to space it out more. The hardest part is the caps, I either put caps at every letter or i don't it's just a habit. So thanks :)> > LoL this took a while to write getting the caps and stuff…Much better. You give me hope.At least you're trying and have made an effort, that's good. Good job. :) Link to comment Share on other sites More sharing options...
tslusny Posted July 12, 2012 Share Posted July 12, 2012 Yes but this tutorial is for DX8 i think Link to comment Share on other sites More sharing options...
Exception Posted July 12, 2012 Share Posted July 12, 2012 @Deathbeam:> Yes but this tutorial is for DX8 i thinkIf you actually read the code, you would find it clearly draws text with the GDI text rendering system. Not exactly the rendering of the bitmap font that D3D8 offers, is it? Link to comment Share on other sites More sharing options...
00GuthixLord Posted July 12, 2012 Author Share Posted July 12, 2012 @Lenn:> If you actually read the code, you would find it clearly draws text with the GDI text rendering system. Not exactly the rendering of the bitmap font that D3D8 offers, is it?I'm new to this and i just use the one on the download link so…It's the event system one. I don't know any other ones... Link to comment Share on other sites More sharing options...
JohnPony Posted July 13, 2012 Share Posted July 13, 2012 Simple and already done, But I'm glad to see you contributing to the community mate. Link to comment Share on other sites More sharing options...
Kemerd Posted July 14, 2012 Share Posted July 14, 2012 @Synergy:> Looks good.> Two things though.. In future, you do not need to use Capital Letters At The Start Of Every Word In A Sentence. It makes a sentence really difficult to read as it breaks up the natural flow of the sentence.> Secondly, it's quite crowded (the tutorial) so I'd suggest you space stuff out a bit more so it's easier to see which line is related to which bit of code.> > Those are just comments on the tutorial, the actual code looks good though. :)I used to type like that. XD 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