Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
[ Help ] Trying to make target all
Results 1 to 6 of 6

Thread: [ Help ] Trying to make target all

  1. #1

    [ Help ] Trying to make target all

    Hello I'm trying to make the target all like NG
    But I give a small problem
    If I active my walcker and press "Target All" My character attack the monster, but him not stiop walking, for example to loot items
    He attack monster but not stop walcking

    Ths is the Thread configs
    [code=vbnet] Public Sub New()

    InitializeComponent()
    WaypointWalcker = New ThreadTimer(500)
    TargetAll = New ThreadTimer(2000)
    End Sub[/code]
    [code=vbnet]
    Public WithEvents WaypointWalcker As ThreadTimer
    Public WithEvents TargetAll As ThreadTimer[/code]


    This is my Target All (not use Timers, it use ThreadTimer)
    [code=vbnet] Private Sub TargetAll_OnExecute() Handles TargetAll.OnExecute
    If client.LoggedIn = True Then
    Dim Bl As New BattleList(client)
    Dim BLMonsters As List(Of Creature) = Bl.GetCreatures().ToList
    Dim aux As String = ""
    For ind As Integer = 0 To BLMonsters.Count - 1
    If BLMonsters(ind).Z <> player.Z Then Continue For
    If Not BLMonsters.Item(ind).IsSelf Then
    aux = BLMonsters(ind).Name.ToLower
    If BLMonsters(ind).IsAttacking AndAlso BLMonsters(ind).IsReachable Then
    BLMonsters(ind).Attack()
    End If
    Exit For
    End If
    Next ind
    End If
    End Sub[/code]


    This is My Checkbox to active target all
    [code=vbnet] Private Sub btnAttack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAttack.CheckedChanged
    If btnAttack.Checked = True Then
    TargetAll.StartTimer()
    Else
    TargetAll.StopTimer()
    End If
    End Sub[/code]


    And to finish it's my walcker code
    [code=vbnet] Private Sub WaypointWalcker_OnExecute() Handles WaypointWalcker.OnExecute
    If client.LoggedIn = True Then
    If listWaypoints.SelectedItem.ToString() <> "North" AndAlso listWaypoints.SelectedItem.ToString() <> "South" AndAlso listWaypoints.SelectedItem.ToString() <> "West" AndAlso listWaypoints.SelectedItem.ToString() <> "East" Then
    Dim chek As String() = listWaypoints.SelectedItem.ToString().Split("|"c)
    Dim pos As String = chek(1)
    Dim output As String = pos.Substring(pos.IndexOf("(") + 1, pos.IndexOf(")") - pos.IndexOf("(") - 1)
    arrayWalker = output.Split(","c)
    If player.Location = New Location(Convert.ToInt32(arrayWalker(0)), Convert.ToInt32(arrayWalker(1)), Convert.ToInt32(arrayWalker(2))) Or player.Location.Z <> Convert.ToInt32(arrayWalker(2)) Then
    If listWaypoints.SelectedIndex >= (listWaypoints.Items.Count - 1) Then
    listWaypoints.SelectedIndex = 0
    Else
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    End If
    If chek(0) = "Waypoint" Then
    player.[GoTo] = New Location(Convert.ToInt32(arrayWalker(0)), Convert.ToInt32(arrayWalker(1)), Convert.ToInt32(arrayWalker(2)))
    Else
    If chek(0) = "Rope" Then
    Dim rope__1 As New Location(Convert.ToInt32(arrayWalker(0)), Convert.ToInt32(arrayWalker(1)), Convert.ToInt32(arrayWalker(2)))
    Dim tile As Tile = client.Map.GetTile(rope__1)
    client.Inventory.UseItemOnTile(Rope.Id, tile)
    Thread.Sleep(500)
    Else
    If chek(0) = "Shovel" Then
    Dim shovel__2 As New Location(Convert.ToInt32(arrayWalker(0)), Convert.ToInt32(arrayWalker(1)), Convert.ToInt32(arrayWalker(2)))
    Dim tile As Tile = client.Map.GetTile(shovel__2)
    client.Inventory.UseItemOnTile(Shovel.Id, tile)
    Thread.Sleep(500)
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    End If
    End If
    Else
    If listWaypoints.SelectedItem.ToString() = "North" Then
    player.Walk(Direction.Up)
    Thread.Sleep(1000)
    If listWaypoints.SelectedIndex >= (listWaypoints.Items.Count - 1) Then
    listWaypoints.SelectedIndex = 0
    Else
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    Else
    If listWaypoints.SelectedItem.ToString() = "South" Then
    player.Walk(Direction.Down)
    Thread.Sleep(1000)
    If listWaypoints.SelectedIndex >= (listWaypoints.Items.Count - 1) Then
    listWaypoints.SelectedIndex = 0
    Else
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    Else
    If listWaypoints.SelectedItem.ToString() = "East" Then
    player.Walk(Direction.Right)
    Thread.Sleep(1000)
    If listWaypoints.SelectedIndex >= (listWaypoints.Items.Count - 1) Then
    listWaypoints.SelectedIndex = 0
    Else
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    Else
    If listWaypoints.SelectedItem.ToString() = "West" Then
    player.Walk(Direction.Left)
    Thread.Sleep(1000)
    If listWaypoints.SelectedIndex >= (listWaypoints.Items.Count - 1) Then
    listWaypoints.SelectedIndex = 0
    Else
    listWaypoints.SelectedIndex = listWaypoints.SelectedIndex + 1
    End If
    End If
    End If
    End If
    End If
    End If
    End If
    End Sub[/code]


    And I nneed to make my character stop the walcker if he is attacking a monster
    Sorry for my english ;/
    But I realy need help

  2. #2
    Senior Member
    Join Date
    Aug 2010
    Posts
    532

    RE: [ Help ] Trying to make target all

    Send a "StopWalk" packet before attack the creature and use variables like IsTargeting, so you will know when your bot is targeting a creature, and if it is the walker won't execute.

  3. #3

    RE: [ Help ] Trying to make target all

    Quote Originally Posted by maozao
    Send a "StopWalk" packet before attack the creature and use variables like IsTargeting, so you will know when your bot is targeting a creature, and if it is the walker won't execute.

    [code=vbnet] If client.LoggedIn = True Then
    Dim Bl As New BattleList(client)
    Dim BLMonsters As List(Of Creature) = Bl.GetCreatures().ToList
    Dim aux As String = ""
    For ind As Integer = 0 To BLMonsters.Count - 1
    If BLMonsters(ind).Z <> player.Z Then Continue For
    If Not BLMonsters.Item(ind).IsSelf Then
    aux = BLMonsters(ind).Name.ToLower
    If BLMonsters(ind).IsAttacking AndAlso BLMonsters(ind).IsReachable Then
    WaypointWalcker.StopTimer()
    BLMonsters(ind).Attack()
    If player.IsAttacking() AndAlso player.TargetId > 0 Then
    WaypointWalcker.StopTimer()
    Else
    WaypointWalcker.StartTimer()
    End If
    End If
    Exit For
    End If
    Next ind
    End If[/code]



    Fail ;/ dont work

  4. #4
    Senior Member
    Join Date
    Aug 2010
    Posts
    532

    RE: [ Help ] Trying to make target all

    You didn't do what I said:

    http://code.google.com/p/tibiaapi/source/browse/trunk/tibiaapi/Objects/Player.cs#69

  5. #5
    Junior Member
    Join Date
    Jun 2011
    Posts
    8

    RE: [ Help ] Trying to make target all

    i had the same problem and this is the way i use to fix that problem :shy: :

    first set a function to see if the player is attacking :

    [code=vbnet]Public Function EstoyAtacando() As Boolean

    If jugador.TargetId > 0 Then ' "jugador" is the player
    Return True
    Else
    Return False
    End If

    End Function[/code]


    Then

    [code=vbnet]
    if Not EstoyAtacando() then

    'your walker code

    end if[/code]


    and that is all

  6. #6

    RE: [ Help ] Trying to make target all

    Quote Originally Posted by benqo
    i had the same problem and this is the way i use to fix that problem :shy: :

    first set a function to see if the player is attacking :

    [code=vbnet]Public Function EstoyAtacando() As Boolean

    If jugador.TargetId > 0 Then ' "jugador" is the player
    Return True
    Else
    Return False
    End If

    End Function[/code]


    Then

    [code=vbnet]
    if Not EstoyAtacando() then

    'your walker code

    end if[/code]
    and that is all

    Ok Thanks you very much
    but my attack all attack only creatures with distance 2 SQM -
    How to fix?

    [code=vbnet] If client.LoggedIn = True Then
    Dim cr As Creature = client.BattleList.GetCreatures().FirstOrDefault(Fu nction(c) (c.IsAttacking() AndAlso c.Z = player.Z AndAlso c.DistanceTo(player.Location) < 7))
    Try
    If cr IsNot Nothing AndAlso cr.IsReachable() Then
    cr.Attack()
    End If
    Catch
    End Try
    End If[/code]


Posting Permissions

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