Hey guys, i am working on some Nickset.Bot stuff. And i want to farm Devourers, which spawn from the ground if you are near by. I dont know why, but my bot (with other enemies there is no problem) just keeps running without killing the spawned devourers.
im pretty new to this code editing stuff, so i dont get where the problem is.
i think this are the relevant parts of the code:
Mainloop:
Code:
Func MainLoop()
If GetMapID() == $MAP_ID_BH Then
Out("Starting run #" & GUICtrlRead($RunLabel) + GUICtrlRead($FailLabel) + 1)
SwitchMode($DIFFICULTY_NORMAL)
Zone_Fast_Way()
Else
$BotSetUpResign = True
Return False
EndIf
2277.49
$MapID = GetMapID()
If ($MapID == $MAP_ID_CD) Then
Out("Cliffs check, start run")
RndSleep(500)
Out("Prepping")
UseSkillEx($vop)
UseSkillEx($grenths)
UseSkillEx($vos)
Out("Waypoint 1")
MoveRun(2406, -7406)
Kill()
Out("Waypoint 2")
MoveRun(3038, -5846)
Kill()
Out("Waypoint 3")
MoveRun(4110, -4442)
Kill()
Out("Waypoint 4")
MoveRun(4764, -3082)
Kill()
Out("Waypoint 5")
MoveRun(6793, 4133)
Kill()
Out("Waypoint 6")
MoveRun(10294, 2024)
Kill()
Out("Waypoint 7")
MoveRun(10888, -7)
Kill()
Out("Waypoint 8")
MoveRun(11614, -925)
Kill()
Out("Waypoint 9")
MoveRun(12582, -795)
Kill()
EndIf
$RunLabel += 1
StopMainLoop ()
EndFunc ;==>MainLoop
Func Kill:
Code:
Func Kill()
Local $lTimer, $lEnemiesCount, $lMe, $lTargetID, $lTargetStruct, $target
$lTimer = TimerInit()
$lEnemiesCount = GetNumberOfFoesInRangeOfAgent()
CheckVoSCombat()
RndSleep(500)
If $lEnemiesCount >=1 Then
$target = GetNearestEnemyToAgent(-2)
ChangeTarget($target)
RndSleep(150)
Attack(-1)
Sleep(200)
If IsRecharged($sweep) Then
CheckVoSCombat()
TargetNearestEnemy()
UseSkill($sweep, -1)
RndSleep(200)
EndIf
Do
Out("Fighting")
If GetMapLoading() == 2 Then Disconnected()
If GetIsDead(-2) Then
StopMainLoop ()
Return
EndIf
CheckVoSCombat()
If GetIsDead($lTargetID) Then
$lTargetID = DllStructGetData(GetNearestEnemyToAgent(-2), 'ID')
If [MENTION=368499]Extended[/MENTION] > $RANGE_NEARBY Then ExitLoop
Attack(-1)
EndIf
$target = GetNearestEnemyToAgent(-2)
ChangeTarget($target)
RndSleep(150)
Attack(-1)
Sleep(200)
If IsRecharged($sweep) Then
CheckVoSCombat()
TargetNearestEnemy()
UseSkill($sweep, -1)
RndSleep(200)
EndIf
If GetIsDead(-2) Then
StopMainLoop ()
Return
EndIf
CheckVoSCombat()
TargetNearestEnemy()
Attack(-1)
If GetSkillbarSkillAdrenaline($crippling) >= 150 Then
CheckVoSCombat()
TargetNearestEnemy()
UseSkill($crippling, -1)
RndSleep(800)
EndIf
If GetIsDead(-2) Then
StopMainLoop ()
Return
EndIf
CheckVoSCombat()
TargetNearestEnemy()
Attack(-1)
If GetSkillbarSkillAdrenaline($reap) >= 120 Then
CheckVoSCombat()
TargetNearestEnemy()
UseSkill($reap, -1)
RndSleep(800)
EndIf
If GetIsDead(-2) Then
StopMainLoop ()
Return
EndIf
Sleep(100)
CheckVoSCombat()
TargetNearestEnemy()
Attack(-1)
If TimerDiff($lTimer) > 7000 Then PickUpLoot()
If TimerDiff($lTimer) > 150000 Then
PickUpLoot()
Return
EndIf
If GetIsDead(-2) Then
StopMainLoop ()
Return
EndIf
$lEnemiesCount = GetNumberOfFoesInRangeOfAgent()
Until $lEnemiesCount <= 0 Or TimerDiff($lTimer) > 150000
CancelAction()
Sleep(GetPing() + 250)
Out("Pick up loot")
PickUpLoot()
;Out("Moving")
EndIf
EndFunc
Func MoveRun:
Code:
Func MoveRun($DestX, $DestY)
If GetMapLoading() == 2 Then Disconnected()
If GetIsDead(-2) Then
StopMainLoop()
Return
EndIf
If GetMapID() = $MAP_ID_BH Then Return
StuckTimer()
;Local $Me
Local $Me = GetAgentByID(-2)
Move($DestX, $DestY)
Do
If GetMapLoading() == 2 Then Disconnected()
CheckVoS()
$Me = GetAgentByID(-2)
If GetIsDead(-2) Then
StopMainLoop()
Return
EndIf
If GetMapID() = $MAP_ID_BH Then Return
If DllStructGetData($Me, 'MoveX') == 0 Or DllStructGetData($Me, 'MoveY') == 0 Then Move($DestX, $DestY)
RndSleep(250)
Until ComputeDistance(DllStructGetData($Me, 'X'), DllStructGetData($Me, 'Y'), $DestX, $DestY) < 250
EndFunc
I dont know maybe it has sth to do with this Func:
Func GetNumberOfFoesInRangeOfAgent
Code:
Func GetNumberOfFoesInRangeOfAgent($aAgent = 0, $aRange = 2000)
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
$lCount += 1
Next
Return $lCount
EndFunc
I thought maybe it has something to do with too short "sleeps". but like the devourers just follow the bot the whole time...
i am thankful for any advise. thank you very much :)