-
Posts
216 -
Joined
-
Last visited
Content Type
Forums
Articles
Bug Tracker
Downloads
Store
Everything posted by Zer0
-
Increase range for "Attack before being attacked"
Zer0 commented on Fisher Man's bug report in Bug Tracker
A plugin has been released to try and fix this issue. -
Version 1.0.0 is out
-
After further investigation, turns out there's a simpler way to handle the issue. Much cleaner, and works way better. It is confirmed that when you try to aggro a NPC that is not explicitly listed in the profile, AND when you're in a movement loop, the bot just tries to get back in the loop. The 3D radar helped a lot to understand what was going on. I still have a few (hopefully) minor bugs, and then I can release the plugin. Thanks again for your help, everyone. // Pull hook robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += (engine, state, cancelable) => { if (state.DisplayName == "Movement Loop" && inRadarCombat) { cancelable.Cancel = true; } };
-
I found a solution. It's not the most elegant and a bit too crafty to my taste, but it works pretty well so far. Again, if anyone has a better idea, please let me know. I have done a ton of tests and I had to search and guess into the API until I found useful pieces of code. What happens is pretty much what I suspected. When you call Fight.startFight on an enemy NPC that is not in the DB (profile) and that is not attacking you, the bot starts a new Move thread to approach the unit. After a second, during the approach, the bot thinks it's still traveling, despite Fight.InFight being true and starts a second Move thread to return to its travel path. Then the 2 threads run at the same time until somehow you're flagged in combat and the bot interrupts the travel Move thread. Here's what I've done : First : MovementManager.StopMove(); Fight.StartFight(closestUnit.Guid); Then the Event hook takes over whenever a new path is created during a pull. I pause the one that is not going to the enemy in a loop for the entire fight. Then, when the fight is over, I stop every movement and launch a new movement thread that will re-calculate the travel path. This last part is not absolutely necessary, but it keeps the bot from running back to its original place after every fight, which looks unnatural. In case you wonder, I tried to use cancelable.Cancel = true;... no dice, it makes the bot move eternally in a direction after reaching the first node, post-fight. wManager.Events.OthersEvents.OnPathFinderFindPath += (Vector3 from, Vector3 to, string continentNameMpq, CancelEventArgs cancelable) => { if (inRadarCombat && Fight.InFight && enemyToFight.Position != to) { while (Fight.InFight && enemyToFight.IsAlive && inRadarCombat) { Thread.Sleep(250); } MovementManager.StopMove(); MovementManager.StopMoveTo(); MovementManager.LaunchThreadMovementManager(); Thread.Sleep(2000); } }; It works for both melee and ranged. I'll keep testing and adjusting. Feel free to share your inputs if any. Also if anyone wants to test the plugin, please let me know. I should mention I'm developing it on a TBC server. No idea if it would work on other versions.
-
To me, it seems that it's a conflict within the same "module", actually. The MoveTo one. The bot is sending conflicting information to it when I try to force a fight. It's going "Go fight. Oh wait, no, go travel, no wait, go fight, no wait, go travel...". I'm pretty new to wRobot and I don't know the ins and outs of its engine, so if you have any more concrete info about all this, feel free to share :). I'm willing to share the file if needed, since I'll release it for free once it's done.
-
From my observation, once you launch Fight.startFight(), the next line of code isn't executed until the fight is over. I've tried setting Fight.InFight to true in many different places, and it doesn't work, unfortunately. I've also tried MovementManager.MoveTo(closestUnit.Position), but the bot takes over and tries to get back on its traveling path as soon as it starts moving to its target. I've also hooked the wManager.Events.MovementEvents.OnMoveToPulse event and maybe there's some hope in there but it's getting really complicated for such a simple task. I'm running out of ideas here. Do you think there is a way to temporarily deactivate the profile path, or the profile altogether?
-
Thanks a lot for your help, but I'm still really stuck here. Here's what I tried : Logging.Write("[Z.E.Radar] Enemy too close (" + closestUnit.GetDistance + "), attacking : " + closestUnit.Name); // Start Fight Logging.WriteDebug(MovementManager.CurrentMoveTo.ToString()); MovementManager.StopMove(); Logging.WriteDebug(MovementManager.CurrentMoveTo.ToString()); MovementManager.StopMoveTo(false, 500); Logging.WriteDebug(MovementManager.CurrentMoveTo.ToString()); MovementManager.CurrentPath.Clear(); Logging.WriteDebug(MovementManager.CurrentMoveTo.ToString()); Fight.StartFight(closestUnit.Guid); And here's my log : 21:18:07 - [Z.E.Radar] Enemy too close (48,20433), attacking : Kolkar Scout [D] 21:18:07 - -776,1435 ; 1188,599 ; 98,48631 ; "None" [D] 21:18:07 - -776,1435 ; 1188,599 ; 98,48631 ; "None" [D] 21:18:07 - -776,1435 ; 1188,599 ; 98,48631 ; "None" [D] 21:18:07 - -776,1435 ; 1188,599 ; 98,48631 ; "None" 21:18:12 - [Fight] Player Attacked by Kolkar Scout (lvl 31) I'm really getting confused here. Nothing seems to work, yet it looks like it shouldn't be an issue at all. Any idea what is going on? I've also noted that once I'm actually in combat (for example my pet attacks or is attacked), the bot starts acting normally again. To me it seems like when I force engage a fight, unless I'm actually "In fight" in the game, the bot tries to take back control and follow its normal path, and I can't find a way to cancel it.
-
I've recorded a video demonstrating the bug. It seems like the bot is conflicted between moving to its next node and moving toward the enemy. Hope it helps. pullbug.webm
-
Thanks for the blacklist events, I'll check that out. Unfortunately, your solution still doesn't work. To give you more info, the bot goes erratic up until I actually am flagged in combat. Then it's back to normal.
-
I'm getting very close to what I want. There's one more bug that I can't seem to shake off. When the bot detects an enemy to attack, I run : MovementManager.StopMove(); Fight.StartFight(closestUnit.Guid); Then, if the bot is not in combat range, it starts moving erratically back and forth. I think it's still running its current move to the next node, as well as its move in range towards the enemy, both at the same time, or one after the other, or they keep interfering with each other, I don't know. I've tried setting Fight.InFight to true, I've tried checking the movements events, I've tried different things with MovementManager and it's led to nothing so far. I'm probably missing something very obvious, so any input will be much appreciated.
-
For some reason, even turning wManagerSetting.CurrentSetting.BlackListIfNotCompletePath to false (and in the UI) doesn't do the trick and the vendor still gets blacklisted. I've found a workaround though. It's a bit shaky but so far it's working as intended. Works for both Vendor and Repair. Maybe there's a way to hook blacklist events directly? If not I'll clean up the code and use this for now. private string vendorNpc = ""; // Manage blacklist (inside Initialize()) robotManager.Events.LoggingEvents.OnAddLog += delegate (Logging.Log log) { ManageNpcBlacklist(log); }; private void ManageNpcBlacklist(Logging.Log log) { if (log.Text.Contains("[ToTown] Go to vendor")) { vendorNpc = log.Text.Substring(22); vendorNpc = vendorNpc.Remove(vendorNpc.Length - 9); } if (inRadarCombat && log.Text.Contains("[ToTown] Unable to reach the vendor, blacklist it 120 minutes (you can disable this NPC in NPC DB tab 'Tools').")) { foreach (var n in NpcDB.ListNpc) { if (n.Name == vendorNpc) { Logging.WriteDebug("Removing " + n.Name + " from vendor Blacklist"); n.BlackList(-1); } } } }
-
I will try that and let you guys know how it went. Thank you both!
-
That would indeed fix the issue, but also kill the purpose of the plugin. I really like the idea that the radar is still on when a toTown or looting event is on. So far it's only inactive when the player is flagged in combat or on a taxi.
-
Ok, so I'll keep posting here for updates in case anyone's around and is willing to provide a little help. I've made it into a plugin and it's working very well so far, although it still needs a lot of testing. Basically the plugin creates a background task which updates every 500ms and checks for close units. I've made the Range of the radar, the lvl of the enemies and the option to attack passive enemies into settings. The detection works very well and the bots enters combat without issue, now. So far the bugs I have are : - When the bot is on its way to a NPC vendor in Town and is interrupted by a fight caused by a radar detection, the bot then states that "the NPC couldn't be reached" and then blacklists the vendor. I'm clearing the blacklist when it happens as a quick fix but it's ugly and potentially harmful. Any idea? - Same problem with looting. When the bot is on its way to loot a corps and is interrupted by a radar detection, it states that it can't reach the corpse and blacklists it. I don't think it's the worst bug, but I'd like to get it fixed anyway.
-
Hey, thanks for the quick answer. The problem was that I didn't know you could pass a WowUnit.Guid argument to the overloaded StartFight function. Now I feel stupid :). Also I'm new to C# and decompiling dll, so don't judge me too harshly. I do have a filter and it works pretty well so far. So now the detection works, but there's still bugs to fix. Especially when looting nearby hostiles, the bot will start moving erratically between 'I wanna go loot" and "I wanna start a fight". I'll look into it tomorrow. Quick question : I put the detection into a method ( private void AggroRadar() ), that is executed every 500ms. If I instantiate an object inside my method ( WoWUnit closestUnit = new WoWUnit(1234); ), is it destroyed once the method is over, or am I causing a memory leak? Thanks a lot for your help!
-
Related to the bug : This bug annoys me to no end. The bot , when on its way to quest enemies/objectives just basically runs into other hostile mobs which not only is very bot-like in terms of behavior, but also stress-inducing to watch ?. Since I'm working on a Fight Class in C#, I thought I might as well give it a try and fix it directly in the FC for now. I've created a simple radar which is able to detect the closest hostile units around every 500ms. When the closest unit is under a certain distance, I target it. But then I can't seem to start a fight. Fight.StartFight(); doesn't work (it says that the Target is not valid), I've tried a lot of other stuff, like manually setting Fight.InFight to true, but nothing seems to work and the bot keeps walking. Is there a way for me to interrupt the pathing and start a fight? Any help would be very appreciated.