What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Plugin to pause all the behavior tree on instance enter?

jim87

New Member
Joined
Aug 26, 2011
Messages
445
Reaction score
7
Hello!

I'd like to know if there is any way to completely pause the bot (i.e. including combat routine) whenever the character is in an instance. My idea is to queue as DPS in the LFD system and let the bot gather/search/run things in the mean while, but take complete control of the character whenever I enter the instance; once out of it, return to the jobs. I know I could stop the bot, but such a plugin would be better IMHO as you could forget about it.

Any hint on where to start?

I thought about a plugin which hangs the bot (a while cycle?) untill we're out of instance, but will it work despite of the combat state? And how to know if it's an instantiated map?

Thanks :)
 
Last edited:
New thread.

If (StyxWoW.Me.IsInInstance && Styx.Logic.BehaviorTree.TreeRoot.IsRunning) { TreeRoot.Stop; }
If (!StyxWoW.Me.IsInInstance && ! Styx.Logic.BehaviorTree.TreeRoot.IsRunning) { TreeRoot.Start; }

You may want to set a timer to limit how often it is checking those two possibilities.

Edit*
Limit how often so that it doesn't conflict with the Core HB Thread.
Also it's Start() and Stop()
And as I'm sure you know, locking up the HB Core Thread can cause issues in under 60 seconds, let alone the many minutes it would take to run an instance.

Good luck to ya,
Panda.
 
Last edited:
The example doesn't require spawning a new thread since it uses the GUI thread.

PHP:
                // use the GUI thead
                // _monitorTimer is a DispatcherTimer and needs to be a field so it don't get garbage collected before before it even runs.
                Application.Current.Dispatcher.Invoke(new Action(
                    delegate
                    {
                        _monitorTimer = new DispatcherTimer();
                        _monitorTimer.Tick += (sender, args) =>
                                                  {  // stuff in here should execute fast so the GUI doesn't become unresponsive
                                                      if (StyxWoW.Me.IsInInstance && Styx.Logic.BehaviorTree.TreeRoot.IsRunning)
                                                          TreeRoot.Stop();
                                                      if (!StyxWoW.Me.IsInInstance && !Styx.Logic.BehaviorTree.TreeRoot.IsRunning) 
                                                          TreeRoot.Start();
                                                  };
                        _monitorTimer.Interval = TimeSpan.FromSeconds(10); // executes every 10 seconds.
                        _monitorTimer.Start();
                    }));
 
Last edited:
Very nice approach Highvoltz.

I didn't think of using the GUI thread, although that would be safer/easier :)
 
Well, from a programming point of view, touching the GUI thread is something like... heresy :P but it should just work!

Thanks both!
 
Back
Top