Mirage Source
NpcOnMap Function - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: NpcOnMap Function (/showthread.php?tid=2368)



NpcOnMap Function - William - 12-11-2008

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



Re: NpcOnMap Function - Kraft - 12-11-2008

You should put an Exit Function after NpcOnMap = True.


Re: NpcOnMap Function - William - 12-11-2008

Yeah, I actually put a Exit For below it. But posted this code before I did that. Both things work.