Quote:
Originally Posted by oneshout
noob questions :
- are there a function for target a specific foe like margo ki ?
|
I did it in my plains farm bot to target riders only :
Code:
Func GetTargetRider($aAgent = -2, $aRange = 1700)
If GetIsDead(-2) Then Return
Local $rider = 2323
If GetMapLoading() == 2 Then Disconnected()
Local $lAgent, $lDistance, $lNearestDistance, $TargetRider
Local $lAgentArray = GetAgentArray(0xDB)
If Not IsDllStruct($aAgent) Then $aAgent = GetAgentByID($aAgent)
$lNearestDistance = 9999
For $i = 1 To $lAgentArray[0]
$lAgent = $lAgentArray[$i]
If BitAND(DllStructGetData($lAgent, 'typemap'), 262144) Then
If StringLeft(GetAgentName($lAgent), 7) <> "Servant" Then ContinueLoop
EndIf
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
If DllStructGetData($lAgent, 'PlayerNumber') <> $rider Then ContinueLoop
If $lDistance < $lNearestDistance Then
$TargetRider = $lAgent
$lNearestDistance = $lDistance
EndIf
Next
Return $TargetRider
EndFunc
Code:
Func GetNumberOfRidersInRangeOfAgent($aAgent = -2, $aRange = 1700)
If GetIsDead(-2) Then Return
Local $rider = 2323
If GetMapLoading() == 2 Then Disconnected()
Local $lAgent, $lDistance
Local $lCount = 0, $lAgentArray = GetAgentArray(0xDB)
If Not IsDllStruct($aAgent) Then $aAgent = GetAgentByID($aAgent)
For $i = 1 To $lAgentArray[0]
$lAgent = $lAgentArray[$i]
If BitAND(DllStructGetData($lAgent, 'typemap'), 262144) Then
If StringLeft(GetAgentName($lAgent), 7) <> "Servant" Then ContinueLoop
EndIf
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
If DllStructGetData($lAgent, 'PlayerNumber') <> $rider Then ContinueLoop
$lCount += 1
Next
Return $lCount
EndFunc
Quote:
Originally Posted by oneshout
- What is the condition for bot to stop the run ? (apart from being dead )
|
What do you mean ?