OK to ask for exploit/Scripting help here...

09/08/2019 21:24 Coaxx123#136
So I need to wait for an enemy group to be out of range so that I can run past them, I'm trying to write as much as I can myself, and want to know if this is a) Right? and b) The best way to do it?

Code:
Func ClearWay()
	
	Local $nAgent = 44
	Local $nTarget = TargetNearestEnemy()
	$aDistance = GetDistance($nAgent, $nTarget)
	
	Do
	  Sleep(100)
	Until $aDistance >= 3200

;~Managed to find the distance between
;~target on bot dev and 3200 seems not to little and not to much
	
EndFunc
09/08/2019 22:38 n0futur3#137
Quote:
Originally Posted by Coaxx123 View Post
So I need to wait for an enemy group to be out of range so that I can run past them, I'm trying to write as much as I can myself, and want to know if this is a) Right? and b) The best way to do it?

Code:
Func ClearWay()
	
	Local $nAgent = 44
	Local $nTarget = TargetNearestEnemy()
	$aDistance = GetDistance($nAgent, $nTarget)
	
	Do
	  Sleep(100)
	Until $aDistance >= 3200

;~Managed to find the distance between
;~target on bot dev and 3200 seems not to little and not to much
	
EndFunc
A few thoughts on this:

To get GWA2' GetDistance() working, both parameters have to be agents (except for when you use -1 and -2, this gets resolved to agents by the function. -2 is your character's agent, -1 it's current target).
Another problem is, that your distance will be only calculated once because you call it only once, and not update every iteration.

My solution would be this(not tested!):

Code:
Func ClearWay()
	
	
	Do
	  Sleep(500)
	Until GetDistance(-2, GetNearestEnemyToAgent(-2)) >= 3200

;~Managed to find the distance between
;~target on bot dev and 3200 seems not to little and not to much
	
EndFunc
Every iteration it updtes the distance and the nearest enemy. And Sleep(500) is enough ;)
09/09/2019 05:56 Coaxx123#138
Right gotcha, was a bit confused by the -2 bits etc, so is that true for a lot of the functions in gwa2 that require an agent and target?

Thanks a lot for your help and explanation

Is there a way to run a function on its own for testing purposes?
09/09/2019 13:13 n0futur3#139
Quote:
Originally Posted by Coaxx123 View Post
Right gotcha, was a bit confused by the -2 bits etc, so is that true for a lot of the functions in gwa2 that require an agent and target?

Thanks a lot for your help and explanation

Is there a way to run a function on its own for testing purposes?
Yes, using -1 and -2 for your target/yourself instead of finding the agents manually usually works, but to be sure have a look at the gwa2 source.

Just make a new au3 file, initialize with your charname, and then call the function.
09/09/2019 18:41 Yoddies#140
Does anyone have any idea on how to detect if the currentTarget ( enemy ) was hit by a lead attack / off-hand attack or dual attack ?

I'm trying to make fight engines for current Meta builds - Assassin (Wota )is next.
09/09/2019 21:20 FriendlyFarmer#141
Quote:
Originally Posted by Yoddies View Post
Does anyone have any idea on how to detect if the currentTarget ( enemy ) was hit by a lead attack / off-hand attack or dual attack ?

I'm trying to make fight engines for current Meta builds - Assassin (Wota )is next.
This is what I use
Code:
func canUseCombo($skill, $target)
	if not isDllStruct($target) then $target = getAgentByID($target)
	if not isDllStruct($skill) then $skill = getSkillById($skill)
	switch dllStructGetData($skill, "comboReq")
		case 1
			return dllStructGetData($target, "laststrike") = 3
		case 2
			return dllStructGetData($target, "laststrike") = 1
		case 4
			return dllStructGetData($target, "laststrike") = 2
	endSwitch
	return true
endFunc
09/12/2019 22:30 maril15#142
Quote:
Originally Posted by havochavoc2 View Post
Does someone know how to target your pet? The only way I can come up with is just scanning the agents for the ModelID, can't seem to get GetAgentName to work with pets.
This is what i'm using for OmniFarmer_Presearing (unreleased version for now).

Code:
Func RangerPet_present() ;Check if a ranger s pet is present in the party Return True if yes, or False if not
;Pet will be targeted if found
	Local $Primary = GetAgentPrimaryProfession(-2)
    Local $Secondary = GetAgentSecondaryProfession(-2)
	
;	Local $Target
	Local $lAgent
	Local $i
	
	If (($Primary == 2) OR ($Secondary == 2)) Then ;If is a ranger R/... or .../R
		For $i = 1 To GetMaxAgents()
			$lAgent = GetAgentByID($i)
			If isRangerPet($lAgent) Then
				Return True	
			EndIf
		Next
	EndIf
	
	Return False
EndFunc

Func isRangerPet($lAgent) ;Check if Agent is a pet based on the Agent struct Returns True or False
	Local $Allegiance = DllStructGetData($lAgent, 'Allegiance')
    Local $lAgentMID = DllStructGetData($lAgent, 'PlayerNumber')
    Local $AgentTeam = DllStructGetData($lAgent, "Team")
    
    If (($Allegiance == 4) AND ($AgentTeam == DllStructGetData(-2, "Team"))) Then
        Switch $lAgentMID
            Case 1339 ;Strider (Moa Bird)
                Return True
            Case 1342 ;Wolf
                Return True
            Case 1344 ;Warthog (Pig)
                Return True
            Case 1348 ;Black Bear
                Return True
            Case 1364 ;Melandru s Stalker
                Return True
            Case Else
                Return False
        EndSwitch
    EndIf
EndFunc
09/19/2019 21:49 Yoddies#143
Hey Guys - Another fun question: Does anyone have a function to check if a character has a given skill unlocked ?

Backstory: I'm looking at creating a script to automate Legendary skill hunter

And to further this.. Is a list of elite skill ID's available anywhere ?

Thanks!
09/19/2019 23:58 maril15#144
Quote:
Originally Posted by Yoddies View Post
Hey Guys - Another fun question: Does anyone have a function to check if a character has a given skill unlocked ?

Backstory: I'm looking at creating a script to automate Legendary skill hunter

And to further this.. Is a list of elite skill ID's available anywhere ?

Thanks!
You can find a list of ALL skills IDs in my PreFarmer Bot but you're going to have to dig in the API to find them.
09/20/2019 12:46 havochavoc2#145
Quote:
Originally Posted by maril15 View Post
This is what i'm using for OmniFarmer_Presearing (unreleased version for now).

Code:
Func RangerPet_present() ;Check if a ranger s pet is present in the party Return True if yes, or False if not
;Pet will be targeted if found
	Local $Primary = GetAgentPrimaryProfession(-2)
    Local $Secondary = GetAgentSecondaryProfession(-2)
	
;	Local $Target
	Local $lAgent
	Local $i
	
	If (($Primary == 2) OR ($Secondary == 2)) Then ;If is a ranger R/... or .../R
		For $i = 1 To GetMaxAgents()
			$lAgent = GetAgentByID($i)
			If isRangerPet($lAgent) Then
				Return True	
			EndIf
		Next
	EndIf
	
	Return False
EndFunc

Func isRangerPet($lAgent) ;Check if Agent is a pet based on the Agent struct Returns True or False
	Local $Allegiance = DllStructGetData($lAgent, 'Allegiance')
    Local $lAgentMID = DllStructGetData($lAgent, 'PlayerNumber')
    Local $AgentTeam = DllStructGetData($lAgent, "Team")
    
    If (($Allegiance == 4) AND ($AgentTeam == DllStructGetData(-2, "Team"))) Then
        Switch $lAgentMID
            Case 1339 ;Strider (Moa Bird)
                Return True
            Case 1342 ;Wolf
                Return True
            Case 1344 ;Warthog (Pig)
                Return True
            Case 1348 ;Black Bear
                Return True
            Case 1364 ;Melandru s Stalker
                Return True
            Case Else
                Return False
        EndSwitch
    EndIf
EndFunc
I found that a simple GetAgentByName() works prety well.
09/20/2019 14:58 maril15#146
Quote:
Originally Posted by havochavoc2 View Post
I found that a simple GetAgentByName() works prety well.
What function are you using? Because getAgentByname while search for a specific name like "Pet-Maril15" but not for "Pet-Doods" because they don't have the same name?
Or do you split the string or something?
09/21/2019 17:47 phat34#147
Quote:
Originally Posted by Yoddies View Post
Hey Guys - Another fun question: Does anyone have a function to check if a character has a given skill unlocked ?

Backstory: I'm looking at creating a script to automate Legendary skill hunter

And to further this.. Is a list of elite skill ID's available anywhere ?

Thanks!
A functional way to test is possible but:

This can be complex because equipping a skill requires you to be in a guildhall, town or outpost and actually using the skill would require you to be in an instance... So a functional way of testing if one has a skill that has been equipped and proceeding to an instance to test by casting and then using func IsRecharged() right after or some other way of testing if the skill has been cast such as haseffect() to determine if the skill is even equipped.

I will look through my code to see if there is a function or way to determine if a skill is unlocked... but even if there is you would then be looking way for a way to attain the said skill from a skill trainer or priest in GTOB, would you not?
09/22/2019 00:47 Yoddies#148
Quote:
Originally Posted by phat34 View Post
This can be complex because equipping a skill requires you to be in a guildhall, town or outpost and actually using the skill would require you to be in an instance... So a functional way of testing if one has a skill that has been equipped and proceeding to an instance to test by casting and then using func IsRecharged() right after or some other way of testing if the skill has been cast such as haseffect() to determine if the skill is even equipped.

I will look through my code to see if there is a function or way to determine if a skill is unlocked... but even if there is you would then be looking way for a way to attain the said skill from a skill trainer or priest in GTOB, would you not?
Sorry - i used the wrong wording, with "unlocked" i meant if the character already has captured the elite skill ( as in, from boss or with Tome, not unlocked with factions)

I imagine the flow of things to be something like:
1. switchSecondary profession
2. in a town Check if skill (using skill_id from Maril ) is present or not
3. if not, travel to boss location and capture ( if outpost is unlocked )
[optional] - Go buy signet of capture at skilltrader

All skills / bosses / closest outpost to boss / path to boss would be in different lists and called accordingly.

The 2 hard parts are:
1. Checking if skill is already capped or not
2. Navigating the "skill capture" window after the boss dies

The last annoyance is Prophecies where bosses spawn randomly.. but that'll be a worry for later.
09/22/2019 12:24 phat34#149
ok... good plan! I will examine the 2 hard parts since I already have a boss tracker/hunt down script.
09/27/2019 05:25 list comprehension#150
It might be something obvious that I missed but is there a way to check if a agent is in a cinematic? I see there is a SkipCinematic() function.