02-06-2006, 07:09 PM
Author: GodSentDeath
Difficulty: 1/5
:: SERVER SIDE ::
In modHandleData add the following anywhere:
:: CLIENT SIDE ::
In modHandleData add the following anywhere:
In modTypes find "Type MapNpcRec under HP As Long" add:Now in modGameLogic, under:Add:Finally, at the very bottom of modGameLogic add:That's all!
Difficulty: 1/5
:: SERVER SIDE ::
In modHandleData add the following anywhere:
Code:
' :::::::::::::::::::::::::::
' :: Npc hp request packet ::
' :::::::::::::::::::::::::::
Dim Pack As String
If LCase(Parse(0)) = "getnpchp" Then
Pack = "npchp" & SEP_CHAR
For i = 1 To MAX_MAP_NPCS
n = MapNpc(GetPlayerMap(index), i).Num
Pack = Pack & MapNpc(GetPlayerMap(index), i).HP & SEP_CHAR & GetNpcMaxHP(n) & SEP_CHAR
Next i
Pack = Pack & END_CHAR
Call SendDataTo(index, Pack)
Exit Sub
End If
:: CLIENT SIDE ::
In modHandleData add the following anywhere:
Code:
' :::::::::::::::::::
' :: Npc hp packet ::
' :::::::::::::::::::
If LCase(Parse(0)) = "npchp" Then
n = 1
For i = 1 To MAX_MAP_NPCS
MapNpc(i).HP = Val(Parse(n))
MapNpc(i).MaxHP = Val(Parse(n + 1))
n = n + 2
Next i
Exit Sub
End If
In modTypes find "Type MapNpcRec under HP As Long" add:
Code:
MaxHP As Long
Code:
' Blit out the npcs
For i = 1 To MAX_MAP_NPCS
Call BltNpc(i)
Next i
Code:
' Blit out NPC hp bars
Dim GSD2 As Long
If GetTickCount > GSD2 + 500 Then
Call SendData("getnpchp" & SEP_CHAR & END_CHAR)
GSD2 = GetTickCount
End If
For i = 1 To MAX_MAP_NPCS
If MapNpc(i).Num > 0 Then
Call BltNpcBars(i)
End If
Next i
Code:
Sub BltNpcBars(ByVal Index As Long)
Dim x As Long, y As Long
x = MapNpc(Index).x * PIC_X + MapNpc(Index).XOffset
y = MapNpc(Index).y * PIC_Y + MapNpc(Index).YOffset - 4
If MapNpc(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 + ((MapNpc(Index).HP / 100) / (MapNpc(Index).MaxHP / 100) * 32), y + 36)
End Sub