Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NpcOnMap Function
#1
For example when I change map I send the npc hp because my monsters has hp bars. But I dont want to send the hp bar packet from server to client unless there are npcs on the map. In that case you could add this. Could also be used for other things similar to the one I explained.

Code:
Function NpcOnMap(ByVal MapNum As Long) As Boolean
Dim i As Byte
NpcOnMap = False

    For i = 1 To MAX_MAP_NPCS
        If MapNpc(MapNum, i).num > 0 Then
            NpcOnMap = True
            Exit Function
        End If
    Next i

End Function
Reply
#2
You should put an Exit Function after NpcOnMap = True.
Reply
#3
Yeah, I actually put a Exit For below it. But posted this code before I did that. Both things work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)