We are working on the VQ Bot but we are encountering some problem to make an appropriate func when the bot die and has to move again.
We created this func but atm the bot instead of going to the nearest array he try to go back to the array where he died.
Anyone has a solution or can find where we are at fault there?
Thank you for the help
We created this func but atm the bot instead of going to the nearest array he try to go back to the array where he died.
Code:
Func MoveandAggroVQ($aWaypoints)
$DeadOnTheRun = 0
If $DeadOnTheRun = 1 Then
Sleep (16000)
Local $currentX = GetCurrentX()
Local $currentY = GetCurrentY()
Local $closestIndex = -1
Local inDistance = 1e10
For $i = 0 To UBound($aWaypoints) - 1
Local $waypointX = $aWaypoints[$i][0]
Local $waypointY = $aWaypoints[$i][1]
Local $distance = Sqrt(($waypointX - $currentX)^2 + ($waypointY - $currentY)^2)
If $distance < $minDistance Then
$minDistance = $distance
$closestIndex = $i
EndIf
Next
For $Index = $closestIndex To UBound($aWaypoints) - 1
AggroMoveTo($aWaypoints[$Index][0], $aWaypoints[$Index][1], $aWaypoints[$Index][2] & $ActionCounter, $aWaypoints[$Index][3])
$ActionCounter += 1
If $aWaypoints[$Index][0] = $waypointX And $aWaypoints[$Index][1] = $waypointY Then
$DeadOnTheRun = 0 ; Imposta il personaggio come vivo
ExitLoop
EndIf
Next
ElseIf $DeadOnTheRun = 0 Then
For $Index = 0 To UBound($aWaypoints) - 1
AggroMoveTo($aWaypoints[$Index][0], $aWaypoints[$Index][1], $aWaypoints[$Index][2] & $ActionCounter, $aWaypoints[$Index][3])
$ActionCounter += 1
Next
EndIf
EndFunc$m
Thank you for the help