Mirage Source http://www.miragesource.net/forums/ |
|
Display Player HP/MP Bars http://www.miragesource.net/forums/viewtopic.php?f=210&t=94 |
Page 1 of 1 |
Author: | Tutorial Bot [ Fri Jun 02, 2006 7:05 pm ] |
Post subject: | Display Player HP/MP Bars |
Author: GodSentDeath Difficulty: 1/5 Note: This displays everybody's HP bars, but only you can see your own MP bar. :: SERVER SIDE :: In modHandleData, add: Code: ' ::::::::::::::::::::::: ' :: Get players stats :: ' ::::::::::::::::::::::: Dim Packet As String If LCase(Parse(0)) = "playershpmp" Then Packet = "playershpmp" & SEP_CHAR For i = 1 To MAX_PLAYERS Packet = Packet & GetPlayerHP(i) & SEP_CHAR & GetPlayerMaxHP(i) & SEP_CHAR Next i Packet = Packet & END_CHAR Call SendDataTo(Index, Packet) Exit Sub End If :: CLIENT SIDE :: In modGameLogic, under: Code: ' Blit out tile layer fringe For y = 0 To MAX_MAPY For x = 0 To MAX_MAPX Call BltFringeTile(x, y) Next x Next y Add: Code: ' Blit players bar Dim GSD As Long If GetTickCount > GSD + 1000 Then Call SendData("playershpmp" & SEP_CHAR & END_CHAR) GSD = GetTickCount End If For i = 1 To MAX_PLAYERS If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then Call BltPlayerBars(i) End If Next i At the very bottom, add: Code: Sub BltPlayerBars(ByVal Index As Long) Dim x As Long, y As Long x = GetPlayerX(Index) * PIC_X + Player(Index).XOffset y = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - 4 If Player(Index).HP = 0 Then Exit Sub Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0)) Call DD_BackBuffer.DrawBox(x, y + 32, x + 32, y + 36) Call DD_BackBuffer.SetFillColor(RGB(0, 255, 0)) Call DD_BackBuffer.DrawBox(x, y + 32, x + ((Player(Index).HP / 100) / (Player(Index).MaxHP / 100) * 32), y + 36) If Index = MyIndex Then Call DD_BackBuffer.SetFillColor(RGB(255, 0, 0)) Call DD_BackBuffer.DrawBox(x, y + 35, x + 32, y + 39) 'draws MP for you Call DD_BackBuffer.SetFillColor(RGB(0, 0, 255)) Call DD_BackBuffer.DrawBox(x, y + 35, x + ((Player(MyIndex).MP / 100) / (Player(MyIndex).MaxMP / 100) * 32), y + 39) End If End Sub In modClientTCP, add: (anywhere) Code: ' ::::::::::::::::::::::: ' :: Get players stats :: ' ::::::::::::::::::::::: If LCase(Parse(0)) = "playershpmp" Then n = 1 For i = 1 To MAX_PLAYERS Player(i).HP = Val(Parse(n)) Player(i).MaxHP = Val(Parse(n + 1)) n = n + 2 Next i Exit Sub End If That's all! |
Author: | mustorze [ Fri Jan 11, 2008 11:53 pm ] |
Post subject: | Re: Display Player HP/MP Bars |
modClientTCP on end or modHandleData?? im brazilian dont speak english Thx For all |
Author: | Stomach Pulser [ Sat Jan 12, 2008 2:14 am ] |
Post subject: | Re: Display Player HP/MP Bars |
It says modClientTCP. Unless I'm blind, then it should go there... |
Author: | Lea [ Sat Jan 12, 2008 3:36 am ] |
Post subject: | Re: Display Player HP/MP Bars |
Dragoons Master could help you, he also speaks Portuguese. |
Author: | Dragoons Master [ Sat Jan 12, 2008 4:09 pm ] |
Post subject: | Re: Display Player HP/MP Bars |
Haha, me adiciona no msn que agente pode conversar... |
Author: | Anthony [ Sat Jan 12, 2008 5:56 pm ] |
Post subject: | Re: Display Player HP/MP Bars |
If your using Mirage 3.0.3 which this tutorial is for probably it goes in modClientTCP, if you are using MSE1 then it would go in the modHandleData. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |