Page 21 of 32 FirstFirst ... 11192021222331 ... LastLast
Results 201 to 210 of 320

Thread: OK to ASK FOR HELP HERE!

  1. #201
    hi all, anyone can explain me how i can do (or what program need for do it) the graphics windows of a bot? with button/information/time..? ty all

  2. #202
    Senior Member
    Join Date
    Feb 2016
    Posts
    167
    Quote Originally Posted by koala95 View Post
    hi all, anyone can explain me how i can do (or what program need for do it) the graphics windows of a bot? with button/information/time..? ty all
    Hi Koala,

    There are two basic ways to make a GUI. One is to start with a basic template and modify it to suit your purpose. I find this is the easiest. After awhile you will end up with your own personal template that suits you the best. Here is an example of a simple template that I use when writing Nick Farmers. I often put basic stats such as item counts and time as well as a console box to let me know what the program is doing when I have the graphics disabled.

    Code:
    #Region GUI
    Global $BotRunning = False
    Global $BotInitialized = False
    Global Const $mainGUI = GUICreate("Ancient Eyes", 330, 240)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    Global $Input = GUICtrlCreateCombo("", 8, 8, 150, 25)
    GUICtrlSetData(-1, GetLoggedCharNames())
    GUICtrlCreateLabel("Runs:", 8, 40, 130, 20)
    Global Const $RunsLabel = GUICtrlCreateLabel($successfulruncount, 140, 40, 50, 17)
    GUICtrlCreateLabel("Fails:", 8, 60, 130, 20)
    Global Const $FailsLabel = GUICtrlCreateLabel($FailedRunCount, 140, 60, 50, 17)
    GUICtrlCreatelabel("Ancient Eyes:", 8, 80, 130, 20)
    $AncientEyeLabel = GUICtrlCreateLabel("0", 140, 80, 50, 17)
    GUICtrlCreatelabel("Time:", 8, 100, 130, 17)
    Global Const $Timer = GUICtrlCreatelabel("00:00:00", 96, 100, 50, 17, $SS_RIGHT)
    Global Const $PurgeHook = GUICtrlCreateCheckbox("Purge Engine Hook", 8, 130, 120, 17)
    Global Const $Checkbox = GUICtrlCreateCheckbox("Disable Rendering", 8, 150, 120, 17)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "ToggleRendering")
    Global Const $Alcohol = GUICtrlCreateCheckbox("Drink Alcohol", 8, 170, 129, 17)
    Global Const $Button = GUICtrlCreateButton("Start", 8, 200, 131, 25)
    GUICtrlSetOnEvent(-1, "GuiButtonHandler")
    Global $statuslbl = GUICtrlCreateLabel("", 140, 184, 204, 17, $SS_CENTER)
    Global $GLOGBOX = GUICtrlCreateEdit("", 164, 8, 160, 186, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
    GUICtrlSetColor($GLOGBOX, 65280)
    GUICtrlSetBkColor($GLOGBOX, 0)
    GUISetState(@SW_SHOW)
    #EndRegion GUI
    Keep in mind, when working up a GUI you need to make sure that any functions or constants called out will need to be in the body of your scrip to get the GUI to function. I will include the entire script in this post so you can experiment.

    Another way to create GUI's is to use Koda. It helps you to create the GUI Form visually without having to create all the constants or functions first. Once you complete the design you can easily import it into your script and then assign your functions, constants and values.

    Here is the dowload site for Koda:
    https://www.autoitscript.com/forum/t...ner-koda-1730/

    And here is a basic tutorial to get you started:
    https://www.youtube.com/watch?v=V1QGz2kODE8

    And here is a basic farming script in GWA2 with the above GUI:
    Attached Files Attached Files

  3. #203
    Quote Originally Posted by RiflemanX View Post
    Hi Koala,

    There are two basic ways to make a GUI. One is to start with a basic template and modify it to suit your purpose. I find this is the easiest. After awhile you will end up with your own personal template that suits you the best. Here is an example of a simple template that I use when writing Nick Farmers. I often put basic stats such as item counts and time as well as a console box to let me know what the program is doing when I have the graphics disabled.

    Code:
    #Region GUI
    Global $BotRunning = False
    Global $BotInitialized = False
    Global Const $mainGUI = GUICreate("Ancient Eyes", 330, 240)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
    Global $Input = GUICtrlCreateCombo("", 8, 8, 150, 25)
    GUICtrlSetData(-1, GetLoggedCharNames())
    GUICtrlCreateLabel("Runs:", 8, 40, 130, 20)
    Global Const $RunsLabel = GUICtrlCreateLabel($successfulruncount, 140, 40, 50, 17)
    GUICtrlCreateLabel("Fails:", 8, 60, 130, 20)
    Global Const $FailsLabel = GUICtrlCreateLabel($FailedRunCount, 140, 60, 50, 17)
    GUICtrlCreatelabel("Ancient Eyes:", 8, 80, 130, 20)
    $AncientEyeLabel = GUICtrlCreateLabel("0", 140, 80, 50, 17)
    GUICtrlCreatelabel("Time:", 8, 100, 130, 17)
    Global Const $Timer = GUICtrlCreatelabel("00:00:00", 96, 100, 50, 17, $SS_RIGHT)
    Global Const $PurgeHook = GUICtrlCreateCheckbox("Purge Engine Hook", 8, 130, 120, 17)
    Global Const $Checkbox = GUICtrlCreateCheckbox("Disable Rendering", 8, 150, 120, 17)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "ToggleRendering")
    Global Const $Alcohol = GUICtrlCreateCheckbox("Drink Alcohol", 8, 170, 129, 17)
    Global Const $Button = GUICtrlCreateButton("Start", 8, 200, 131, 25)
    GUICtrlSetOnEvent(-1, "GuiButtonHandler")
    Global $statuslbl = GUICtrlCreateLabel("", 140, 184, 204, 17, $SS_CENTER)
    Global $GLOGBOX = GUICtrlCreateEdit("", 164, 8, 160, 186, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
    GUICtrlSetColor($GLOGBOX, 65280)
    GUICtrlSetBkColor($GLOGBOX, 0)
    GUISetState(@SW_SHOW)
    #EndRegion GUI
    Keep in mind, when working up a GUI you need to make sure that any functions or constants called out will need to be in the body of your scrip to get the GUI to function. I will include the entire script in this post so you can experiment.

    Another way to create GUI's is to use Koda. It helps you to create the GUI Form visually without having to create all the constants or functions first. Once you complete the design you can easily import it into your script and then assign your functions, constants and values.

    Here is the dowload site for Koda:
    https://www.autoitscript.com/forum/t...ner-koda-1730/

    And here is a basic tutorial to get you started:
    https://www.youtube.com/watch?v=V1QGz2kODE8

    And here is a basic farming script in GWA2 with the above GUI:
    ty alot! i will try!

  4. #204
    Junior Member
    Join Date
    Dec 2016
    Posts
    5
    Hello,

    I have a little problem with a script i'm writing ...
    I have 5 group of ennemys to kill, it make the first one ok, but it don't check if all is good, and switch to Ball 2 then 3 without making them ...
    Any idea ? this is the code :

    WriteChat("Farming Group 1")
    MoveTo(002538.436767, 019405.917968)
    Kill()
    Sleep(100)
    PickUpLoot()
    WriteChat("Farming Group 2")
    MoveTo(004541.186523, 019700.656250)
    Kill()
    Sleep(100)
    PickUpLoot()
    WriteChat("Farming Group 3")
    MoveTo(010353.594726, 019524.927734)
    Kill()
    Sleep(100)
    PickUpLoot()
    WriteChat("Farming Group 4")
    MoveTo(015554.617187, 019171.794921)
    Kill()
    Sleep(100)
    PickUpLoot()
    WriteChat("Farming group 5")
    MoveTo(018644.037109, 018783.732421)
    Kill()
    Sleep(100)
    PickUpLoot()
    Sleep(100)
    WriteChat("Returning to Outpost")
    Resign()
    Sleep(3500)
    ReturnToOutpost()

    And the func Kill :

    Func Kill()
    If GetIsDeadEx() Then Return
    If IsRecharged($mantra) Then
    UseSkillEx($mantra)
    EndIf
    If IsRecharged($sa) Then
    UseSkillEx($sa)
    EndIf
    If IsRecharged($ss) Then
    UseSkillEx($ss)
    EndIf
    If IsRecharged($el) Then
    UseSkillEx($el)
    EndIf
    Sleep(300)
    If IsRecharged($sw) Then
    UseSkillEx($sw)
    EndIf
    If IsRecharged($ld) Then
    UseSkillEx($ld)
    EndIf
    If IsRecharged($as) Then
    UseSkillEx($as)
    EndIf
    If IsRecharged($cw) Then
    UseSkillEx($cw)
    EndIf
    If IsRecharged($sw) Then
    UseSkillEx($sw)
    EndIf
    If IsRecharged($ld) Then
    UseSkillEx($ld)
    EndIf
    If IsRecharged($as) Then
    UseSkillEx($as)
    EndIf
    If IsRecharged($cw) Then
    UseSkillEx($cw)
    EndIf

    Any ideas of what to do ?

    Ty

  5. #205
    Senior Member
    Join Date
    Jun 2014
    Posts
    123
    anychange that all your skills are on recharge?

  6. #206
    Junior Member
    Join Date
    Dec 2013
    Posts
    22
    you need some kind of "detection" if there are still foes in range so the bot does know that it has to kill all the mobs before going to the next grp..
    sth like this (got it from the public skalefin farm bot)

    While GetNumberOfFoesInRangeOfAgent(-2, 1250) > 0
    TargetNearestEnemy()
    Sleep(250)
    ChangeTarget(-1)
    If IsRecharged($FARMERS) Then
    UseSkillEx($FARMERS, -1)
    EndIf
    Attack(-1)
    Sleep(100)
    If IsRecharged($SAND_SHARDS) Then
    UseSkillEx($SAND_SHARDS, -2)
    EndIf
    If $recastVos = True And IsRecharged($VOW_OF_STRENGTH) Then
    UseSkillEx($VOW_OF_STRENGTH, -2)
    EndIf
    WEnd
    and now on to my own question^^

    i just made plans for my first bigger "project" and as there are things like the froggy bot around i actually wanted to make on for frostmaws burrow to farm silverwing bows mainly cause i want one for myself^^... i guess most of the scripting should be pretty easy if i stay close to the public bogroot bots.. but i have one problem in mind i kinda dont know how to solve.. on level 5 of the dungeon there are a lot of these snowball things going from left to right which kill u if u come to close.. i guess a simple moveto function requires a lot of rng to survive that^^.. is there any known way to avoid getting hit by these things? i personally cant think of one as u cant target these things and i assume they dont have any ID's or sth like that?

    ty in advance
    Last edited by deeplezz; 02-17-2017 at 12:02 PM.

  7. #207
    Junior Member
    Join Date
    Dec 2016
    Posts
    5
    Hello =) ty for the answer

    Is it possible to run 2 different bot on the same account (basically VQ one + leader (then i have a second account to have VQ too)

    Thank you !

  8. #208
    Senior Member
    Join Date
    Feb 2016
    Posts
    167
    Quote Originally Posted by azerty8585 View Post
    Hello =) ty for the answer

    Is it possible to run 2 different bot on the same account (basically VQ one + leader (then i have a second account to have VQ too)

    Thank you !

    No, it is not "conventionally" possible to run scripts for two of your chars at the same time on the same account.

    In regards to your Kill functions previously listed, it looks like it could use a little more work. Try adding in the below functions (GWA2) and adjusting the distance/range to ensure you attack only your small aggroed group.

    Code:
    Func Kill()
    Out("Attacking")
    Do
       CheckPartyDead()
       $target = GetNearestEnemyToAgent(-2)
       $distance = GetDistance($target, -2)
       ChangeTarget($target)
       Attack($Target)
       UseSkills()
    Until DllStructGetData($target, 'HP') = 0 Or GetDistance($target, -2) > 1400
    PickUpLoot()
    EndFunc
    
    Func UseSkills()
    $target = GetNearestEnemyToAgent(-2)
    $targetHP = DllStructGetData(GetCurrentTarget(),'HP')
    $targetDistance = GetDistance($target, -2)
    
    For $i = 1 to 8
      If GetSkillBarSkillRecharge($i) = 0 Then
    	  If $targetHP <> 0 And $targetDistance > 1250 then ExitLoop
    	  UseSkill($i, $target)
    	  CallTarget($target)
    	  Sleep(1000)
      EndIf
    Next
    EndFunc
    
    Func CheckPartyDead()
      Local $Deads = 0
      For $i =1 to GetHeroCount()
    	   Sleep(100)
    		 If GetIsDead(GetHeroID($i)) = True Then
    			RndSleep(40)
    			$Deads +=1
    			RndSleep(450)
    		 EndIf
      Next
      If $Deads > 0 Then
    	 Out("We died!")
         Main()
      EndIf
    EndFunc

  9. #209
    Senior Member
    Join Date
    Feb 2016
    Posts
    167
    Here is another fighting function that I like. It is an older GWA2 function but it is helpful when you wish to move from one point to the next and attack everything along the way.

    You would simply write out the route:

    Code:
    Out("Beginning Farm")
    Aggromovetoex(-12345, 12345)
    Aggromovetoex(-23456, 78903)
    Aggromovetoex(-3456-67890)

    And for the actual function:

    Code:
    Func AGGROMOVETOEX($X, $Y, $S = "", $Z = 2000)
    Out($S)
    $RANDOM = 50
    $IBLOCKED = 0
    MOVE($X, $Y, $RANDOM)
    $ME = GETAGENTBYID()
    $COORDS[0] = DllStructGetData($ME, "X")
    $COORDS[1] = DllStructGetData($ME, "Y")
    Do
    If GetIsDead(-2) Then
    			Out("Ouch!  We Died!")
    			PingSleep(400)
    			HardLeave()
    			Sleep(500)
    			return 0
    		EndIf
    RndSleep(250)
    $OLDCOORDS = $COORDS
    $ENEMY = GETNEARESTENEMYTOAGENT(-2)					;<------------I tried changing this to $ENEMY = 475 but then this function failed to target at all
    $DISTANCE = COMPUTEDISTANCE(DllStructGetData($ENEMY, "X"), DllStructGetData($ENEMY, "Y"), DllStructGetData(GETAGENTBYID(-2), "X"), DllStructGetData(GETAGENTBYID(-2), "Y"))
    If $DISTANCE < $Z And $ENEMY <> 0 Then
    FIGHT($Z, $S)
    Out($S)
    EndIf
    RndSleep(250)
    $ME = GETAGENTBYID()
    $COORDS[0] = DllStructGetData($ME, "X")
    $COORDS[1] = DllStructGetData($ME, "Y")
    If $OLDCOORDS[0] = $COORDS[0] And $OLDCOORDS[1] = $COORDS[1] Then
    $IBLOCKED += 1
    MOVETO($COORDS[0], $COORDS[1], 1500)
    RndSleep(1500)
    MOVE($X, $Y)
    If GETMAPLOADING() == 2 Then DISCONNECTED()
    EndIf
    Until COMPUTEDISTANCE($COORDS[0], $COORDS[1], $X, $Y) < 250 Or $IBLOCKED > 20
    EndFunc
    Func FIGHT($X, $S = "enemies")
    Local $LASTID = 99999, $COORDINATE[2], $TIMER
    Do
    If $PartyDead = 1 Then Return
    $ME = GETAGENTBYID(-2)
    $ENERGY = GETENERGY()
    $SKILLBAR = GETSKILLBAR()
    $USESKILL = -1
    For $I = 0 To 7
    $RECHARGED = DllStructGetData($SKILLBAR, "Recharge" & ($I + 1))
    $STRIKES = DllStructGetData($SKILLBAR, "AdrenalineA" & ($I + 1))
    If $RECHARGED = 0 And $INTSKILLENERGY[$I] <= $ENERGY Then
    $USESKILL = $I + 1
    ExitLoop
    EndIf
    Next
    $TARGET = GETNEARESTENEMYTOAGENT(-2)
    $DISTANCE = COMPUTEDISTANCE(DllStructGetData($TARGET, "X"), DllStructGetData($TARGET, "Y"), DllStructGetData(GETAGENTBYID(-2), "X"), DllStructGetData(GETAGENTBYID(-2), "Y"))
    If $USESKILL <> -1 And $TARGET <> 0 And $DISTANCE < $X Then
    If DllStructGetData($TARGET, "Id") <> $LASTID Then
    CHANGETARGET($TARGET)
    	If GetIsDead(-2) Then
    			Out("Ouch!  We Died!")
    			PingSleep(400)
    			HardLeave()
    			Sleep(500)
    			return 0
    		EndIf
    RndSleep(250)
    RndSleep(150)
    CALLTARGET($TARGET)
    RndSleep(150)
    ATTACK($TARGET)
    $LASTID = DllStructGetData($TARGET, "Id")
    $COORDINATE[0] = DllStructGetData($TARGET, "X")
    $COORDINATE[1] = DllStructGetData($TARGET, "Y")
    $TIMER = TimerInit()
    Do
    MOVE($COORDINATE[0], $COORDINATE[1])
    RndSleep(500)
    $ME = GETAGENTBYID(-2)
    $DISTANCE = COMPUTEDISTANCE($COORDINATE[0], $COORDINATE[1], DllStructGetData($ME, "X"), DllStructGetData($ME, "Y"))
    Until $DISTANCE < 1100 Or TimerDiff($TIMER) > 10000
    EndIf
    RndSleep(150)
    $TIMER = TimerInit()
    Do
    $TARGET = GETNEARESTENEMYTOAGENT(-2)
    $DISTANCE = COMPUTEDISTANCE(DllStructGetData($TARGET, "X"), DllStructGetData($TARGET, "Y"), DllStructGetData(GETAGENTBYID(-2), "X"), DllStructGetData(GETAGENTBYID(-2), "Y"))
    If $DISTANCE < 1250 Then
    USESKILL($USESKILL, $TARGET)
    RndSleep(500)
    EndIf
    ATTACK($TARGET)
    $ME = GETAGENTBYID(-2)
    $TARGET = GETAGENTBYID(DllStructGetData($TARGET, "Id"))
    $COORDINATE[0] = DllStructGetData($TARGET, "X")
    $COORDINATE[1] = DllStructGetData($TARGET, "Y")
    $DISTANCE = COMPUTEDISTANCE($COORDINATE[0], $COORDINATE[1], DllStructGetData($ME, "X"), DllStructGetData($ME, "Y"))
    Until DllStructGetData(GETSKILLBAR(), "Recharge" & $USESKILL) > 0 Or DllStructGetData($TARGET, "HP") < 0.005 Or $DISTANCE > $X Or TimerDiff($TIMER) > 5000
    EndIf
    $TARGET = GETNEARESTENEMYTOAGENT(-2)
    $DISTANCE = COMPUTEDISTANCE(DllStructGetData($TARGET, "X"), DllStructGetData($TARGET, "Y"), DllStructGetData(GETAGENTBYID(-2), "X"), DllStructGetData(GETAGENTBYID(-2), "Y"))
    Until DllStructGetData($TARGET, "ID") = 0 Or $DISTANCE > $X
    PickUpLoot()
    EndFunc

  10. #210
    Senior Member
    Join Date
    Feb 2016
    Posts
    167
    Ok, one more fight function. I like this one for Rits. It is simple and effective. I usually go with an SoS build and then use Explosive Growth and Boon as skills 7 & 8.

    Code:
    Func Nuke()
    	Out("Attacking!")
    	If GetMapLoading() == 2 Then Disconnected()
    	$deadlock = 0
    	$target = GetNearestEnemyToAgent(-2)
    	Local $lMe = GetAgentByID(-2)
    	Local $e = 0, $shouldmove = false
    	Do
    		if GetIsDead(-2) Then
    			;HardLeave()
    			Out("Ouch!  We Died!")
    			return 0
    		EndIf
    		PingSleep(50)
    		$deadlock += 100
    		$e = GetEnergy($lMe)
    		if $class == "Rt" Then
    			KeepUpBoon()
    			If GetSkillBarSkillRecharge(6) = 0 Then
    				If $e >= 15 Then UseSkillEx(6, -2)
    			ElseIf GetSkillBarSkillRecharge(5) = 0 Then
    				If $e >= 5 Then UseSkillEx(5, -2)
    			ElseIf GetSkillBarSkillRecharge(4) = 0 Then
    				If $e >= 5 Then UseSkillEx(4, -2)
    			ElseIf GetSkillBarSkillRecharge(3) = 0 Then
    				UseSkillEx(3, -2)
    			ElseIf GetSkillBarSkillRecharge(1) = 0 Then
    				If $e >= 5 Then UseSkillEx(1, -2)
    			ElseIf GetSkillBarSkillRecharge(7) = 0 Then
    				If $e >= 15 Then UseSkillEx(7, -2)
    				$shouldmove = true
    			Else
    				if $shouldmove Then
    					MoveAway($lMe, $target)
    					$shouldmove=false
    				EndIf
    			EndIf
    		Else
    			if GetSkillBarSkillRecharge(3) = 0 and DllStructGetData($lMe, 'HP') < 1/2 Then
    				UseSkillEx(3, -2)
    			Else
    				KeepUpBoon()
    				If GetSkillBarSkillRecharge(6) = 0 Then
    					If $e >= 15 Then UseSkillEx(6, -2)
    				ElseIf GetSkillBarSkillRecharge(5) = 0 Then
    					If $e >= 5 Then UseSkillEx(5, -2)
    				ElseIf GetSkillBarSkillRecharge(4) = 0 Then
    					If $e >= 5 Then UseSkillEx(4, -2)
    				ElseIf GetSkillBarSkillRecharge(3) = 0 Then
    					UseSkillEx(3, -2)
    				ElseIf GetSkillBarSkillRecharge(2) = 0 Then
    					If $e >= 15 Then UseSkillEx(2, -2)
    				ElseIf GetSkillBarSkillRecharge(1) = 0 Then
    					If $e >= 5 Then UseSkillEx(1, -2)
    				Else
    					Attack($target)
    				EndIf
    			EndIf
    		EndIf
    		$target = GetNearestEnemyToAgent(-2)
    		ChangeTarget($target)
    	Until DllStructGetData($target, 'HP') = 0 Or GetNumberOfFoesInRangeOfAgent(-2, 1012) = 0 Or $deadlock > 6000 Or GetDistance($target, -2) > 1150
    	PingSleep(1000)
    	PickUpLoot()
    EndFunc   ;==>Nuke

    Here are some extra functions to support the above:

    Code:
    Func PingSleep($msExtra = 0)
    	$ping = GetPing()
    	Sleep($ping + $msExtra)
    EndFunc   ;==>PingSleep
    
    Func MoveAway($start,$target)
    	$xdiff = DllStructGetData($start,"X")-DllStructGetData($target,"X")
    	$ydiff = DllStructGetData($start,"Y")-DllStructGetData($target,"Y")
    	MoveTo(DllStructGetData($start,"X")+Random()*$xdiff,DllStructGetData($start,"Y")+Random()*$ydiff)
    EndFunc
    
    Func KeepUpBoon()
    	If $class == "Rt" Then
    		If GetSkillBarSkillRecharge(8) == 0 And DllStructGetData(GetEffect(772), 'SkillID') <> 772 and GetEnergy(-2)>=5 Then UseSkillEx(8, -2)
    		PingSleep(250)
    		If GetSkillBarSkillRecharge(2) == 0 And DllStructGetData(GetEffect(911), 'SkillID') <> 911 and GetEnergy(-2)>=15 and GetDistance(GetNearestEnemyToAgent(-2))<=1800 Then UseSkillEx(2, -2)
    	Else
    		If GetSkillBarSkillRecharge(8) == 0 And DllStructGetData(GetEffect(1230), 'SkillID') <> 1230 and GetEnergy(-2)>=10 Then UseSkillEx(8, -2)
    		PingSleep(250)
    		If GetSkillBarSkillRecharge(7) == 0 And DllStructGetData(GetEffect(1229), 'SkillID') <> 1229 and GetEnergy(-2)>=5 Then UseSkillEx(7, -2)
    	EndIf
    EndFunc   ;==>BuffsUpKeep
    
    
    Func GetNumberOfFoesInRangeOfAgent($aAgent = -2, $fMaxDistance = 1012)
    	Local $lDistance, $lCount = 0
    
    	If IsDllStruct($aAgent) = 0 Then $aAgent = GetAgentByID($aAgent)
    	For $i = 1 To GetMaxAgents()
    		$lAgentToCompare = GetAgentByID($i)
    		If GetIsDead($lAgentToCompare) <> 0 Then ContinueLoop
    		If DllStructGetData($lAgentToCompare, 'Allegiance') = 0x3 Or DllStructGetData($lAgentToCompare, 'Type') = 0xDB Then
    			$lDistance = GetDistance($lAgentToCompare, $aAgent)
    			If $lDistance < $fMaxDistance Then
    				$lCount += 1
    			EndIf
    		EndIf
    	Next
    	Return $lCount
    EndFunc   ;==>GetNumberOfFoesInRangeOfAgent
    
    Func GetFarthestEnemyToAgent($aAgent = -2, $aDistance = 1250)
       If GetMapLoading() == 2 Then Disconnected()
       Local $lFarthestAgent, $lFarthestDistance = 0
       Local $lDistance, $lAgent, $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 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 > $lFarthestDistance And $lDistance < $aDistance Then
    		 $lFarthestAgent = $lAgent
    		 $lFarthestDistance = $lDistance
    	  EndIf
       Next
       Return $lFarthestAgent
    EndFunc

    I will attach the complete running script so you can see how it works:
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •