Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 10:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with a MoveFunc for VQBot

Discussion on Help with a MoveFunc for VQBot within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2016
Posts: 70
Received Thanks: 85
Help with a MoveFunc for VQBot

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.

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
Anyone has a solution or can find where we are at fault there?
Thank you for the help
TheKuM1Ko is offline  
Old 05/17/2024, 22:39   #2
 
Underavelvetmoon's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 111
Received Thanks: 94
Quote:
Originally Posted by TheKuM1Ko View Post
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.

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
Anyone has a solution or can find where we are at fault there?
Thank you for the help
I think its because no matter what within the function you have to loop through and execute the whole array, so it will always return to the last element within an array.

I am not sure if this will work because I just Googled it, but you could add a function within the array to check whether the next co-ords are within X amount of distance from the current co-ords, as long as the majority of your co-ords are within a certain distance it shouldnt impact the running of the bot, but you may have to edit some co-ords.

I imagine it would look something like this:

Code:
Global $WayPoints = [["0000, 0000", WayPoint 1, IsNearestCoord()]]

Func IsNearestCoord()
Local $lDistance = 500 ;Coords need to be within this distance to continue to the next one
Code to return true or false
EndFunc

;Check for this to be true or false during the UBound portion of code
For reference, this is the example I found, so even if the above doesnt work I imagine adding something similar to the array is the way forward, rather than trying to edit the Move function.

Code:
#include <MsgBoxConstants.au3>
#include <Array.au3>

HotKeySet("{ESC}", "_Exit")

Global $Array[5] = ["5", "4", _Function2, "2", "1"]

While 1
    _Function1()
WEnd

Func _Function1 ()
   For $i=1 to 5
      $element = IsFunc($Array[$i])
      If $element = 0 Then
         MsgBox ($MB_OK, "", $Array[$i])
      Else
         Call($Array[$i])
      EndIf
   Next
EndFunc   ;==>_Function1

Func _Function2()
    MsgBox ($MB_OK, "", "Function was executed")
EndFunc

Func _Exit()
    Exit
EndFunc
Hope it helps!
Underavelvetmoon is offline  
Thanks
1 User
Old 05/18/2024, 00:20   #3
 
elite*gold: 0
Join Date: Oct 2016
Posts: 70
Received Thanks: 85
Quote:
Originally Posted by Underavelvetmoon View Post
I think its because no matter what within the function you have to loop through and execute the whole array, so it will always return to the last element within an array.

I am not sure if this will work because I just Googled it, but you could add a function within the array to check whether the next co-ords are within X amount of distance from the current co-ords, as long as the majority of your co-ords are within a certain distance it shouldnt impact the running of the bot, but you may have to edit some co-ords.

I imagine it would look something like this:

Code:
Global $WayPoints = [["0000, 0000", WayPoint 1, IsNearestCoord()]]

Func IsNearestCoord()
Local $lDistance = 500 ;Coords need to be within this distance to continue to the next one
Code to return true or false
EndFunc

;Check for this to be true or false during the UBound portion of code
For reference, this is the example I found, so even if the above doesnt work I imagine adding something similar to the array is the way forward, rather than trying to edit the Move function.

Code:
#include <MsgBoxConstants.au3>
#include <Array.au3>

HotKeySet("{ESC}", "_Exit")

Global $Array[5] = ["5", "4", _Function2, "2", "1"]

While 1
    _Function1()
WEnd

Func _Function1 ()
   For $i=1 to 5
      $element = IsFunc($Array[$i])
      If $element = 0 Then
         MsgBox ($MB_OK, "", $Array[$i])
      Else
         Call($Array[$i])
      EndIf
   Next
EndFunc   ;==>_Function1

Func _Function2()
    MsgBox ($MB_OK, "", "Function was executed")
EndFunc

Func _Exit()
    Exit
EndFunc
Hope it helps!
If I understood your reasoning correctly, by incorporating what you said into the script, the bot searches for an array at the maximum distance from x and will move towards that one instead of the array where it died?

Is this the logic you would try to implement?
TheKuM1Ko is offline  
Old 05/18/2024, 09:43   #4
 
elite*gold: 0
Join Date: Apr 2010
Posts: 1
Received Thanks: 1
You assign 0 to $DeadOnTheRun every time you execute the function, so the first If will never be executed. Either pass this as parameter or check the status in the function.
wombatandrzej is offline  
Thanks
1 User
Old 05/18/2024, 11:22   #5
 
elite*gold: 0
Join Date: Oct 2016
Posts: 70
Received Thanks: 85
Quote:
Originally Posted by wombatandrzej View Post
You assign 0 to $DeadOnTheRun every time you execute the function, so the first If will never be executed. Either pass this as parameter or check the status in the function.
Code:
Func Death()
    If DllStructGetData(GetAgentByID(-2), "Effects") = 0x0010 Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==>Death

Func MoveandAggroVQ($aWaypoints)
    $DeadOnTheRun = Death()

    If $DeadOnTheRun = 1 Then
        Sleep(16000)
        Local $currentX = GetCurrentX()
        Local $currentY = GetCurrentY()
        Local $closestIndex = -1
        Local $minDistance = 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
                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
Sorry but im totally new to coding, i checked my GWA and found this Dead func, i should integrate it like that?

Also i think i should add a while to execute dead check every for ex 30 sec?

Code:
While 1
      
        If TimerDiff($timer) >= 30000 Then
            $DeadOnTheRun = Death()
            $timer = TimerInit() ;

        EndIf
Something like that?
TheKuM1Ko is offline  
Reply


Similar Threads Similar Threads
[HELP]HELP HELP HELP[HELP]
09/23/2013 - Facebook - 3 Replies
GUYS ^^ THIS IS A HELP THREAD NOT REQUEST THREAD BUT YOU CAN CONSIDER IT AS REQUEST THREAD DOES ANYONE OF YOU KNOW THE AUTO SUBMIT PHP CODE? THANKS!
[HELP][HELP][HELP][HELP]!!
09/11/2009 - Soldier Front - 3 Replies
Microsoft Visual C++ Run time error! :(:( **HELP ME PLEASE!!***
help help help help help help
06/28/2009 - Say Hello - 0 Replies
how i can dowmload Mangos 6385 ??????????????????????????????????? please give me the limk i can't see that i know it is in www.elitepvpers.com/.../153716-release-mangos-relea ses-blackscorpian-win32-2-4-3-a.html - but give me link sent it to my email plz



All times are GMT +1. The time now is 10:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.