What could cause this?
Thanks in advance
Func GetNumberOfFoesInRangeOfAgent($aAgent, $aRange)
Local $lAgent, $lDistance
Local $lCount = 0
If Not IsDllStruct($aAgent) Then $aAgent = GetAgentByID($aAgent)
For $i = 1 To GetMaxAgents()
$lAgent = GetAgentByID($i)
If BitAND(DllStructGetData($lAgent, 'typemap'), 262144) Then ContinueLoop
If DllStructGetData($lAgent, 'Type') <> 0xDB Then ContinueLoop
If DllStructGetData($lAgent, 'Allegiance') <> 3 Then ContinueLoop
If DllStructGetData($lAgent, 'HP') <= 0 Then ContinueLoop
If BitAND(DllStructGetData($lAgent, 'Effects'), 0x0010) > 0 Then ContinueLoop
$lDistance = GetDistance($lAgent)
If $lDistance > $aRange Then ContinueLoop
$lCount += 1
Next
Return $lCount
EndFunc
EDIT: Found this same function written more understandibly in vaettir script and got it working






