Postado Junho 27, 2011 13 anos Estou desenvolvendo um Novo Bot. Porém em VB.Net Ok is o meu problema Estou começando a desenvolver o cavebot com target all (igual NG) Só tem um problema nisso tudo.... Eu usava este code pro MBot e quando passei para VB.Net ocorreu o seguinte erro 1 - Eu crio o waypoint list para o char andar 2 - Eu ativo os waypoints 3 - Ativo o Target All Erro - Quando meu char ataca o monstro ele não para de seguir as waypoints e continua a andar, como arrumar? Eis o meus code OBS: Este code não utiliza timers, ele utiliza ThreadTimers Código Inicialização Public Sub New() InitializeComponent() WaypointWalcker = New ThreadTimer(500) TargetAll = New ThreadTimer(2000) End Sub Public WithEvents WaypointWalcker As ThreadTimer Public WithEvents TargetAll As ThreadTimer [/php] Este seria o suposto "Timer" do Target All [php]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 Este é o checkbox para ativar o Target All 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[/php] Este é o código do meu walcker para ler os waypoints [php]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 Só preciso que alguem me ajude a fazer o walcker paar de seguir os waypoints assim que meu char estiver atacando o monstro. Obviamente apos matar todos os monstros ele voltara a caçar
Postado Junho 27, 2011 13 anos Tente colocar no walker a seguinte condição. While p.TargetId = 0 //o restante do walker End While Ou seja, se não tiver nenhum monstro sendo atacado, ele continua o walker.
Postado Junho 27, 2011 13 anos Autor Tente colocar no walker a seguinte condição. While p.TargetId = 0 //o restante do walker End While Ou seja, se não tiver nenhum monstro sendo atacado, ele continua o walker. Não adiantou ;/ mesmo erro
Postado Agosto 8, 2011 13 anos tenta colocar um "stop" no walker, caso ele ataque algum monstro, eu n sei como ficaria com threadtimers, pois nunca usei eles antes... mas seria algo assim: if p.isAttacking = true then TimerWalker.stop end if ou caso o de cima n funcione tente esse: if p.RedSquare = 0 then TimerWalker.stop end if ou pod tentar com o p.TargetId = 0 q nem o amigo ai de cima falou... Vlws fui
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.