• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Default Combat Discussion

    Discussion in 'Combat Routines' started by Ama, Jan 5, 2015.

    1. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      Did the changes on targeting.cs still healing only one target T.T
       
    2. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      Maybe the problem its not ou me.groupid but as how it create the lists, since he locks on one target it seems its not renewing the list
       
    3. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      That's a possibility, but wouldn't explain why when solo it switches between you and the companion easily. I'd need help figuring out how to cache the lists, I'm not super solid with that.
       
    4. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      why in some parts you use <TorCharacter> and in others <TorNPC> and <TorPlayer>?
       
    5. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      TorCharacter is an umbrella that captures both TorPlayer and TorNPC. Your companion is a TorNPC. You and other players are TorPlayer. When I'm calling for tanks while I'm solo (Me.GroupID == 0) then I need to get my companion, which is a TorNPC, but I also want to grab Tank-spec players when I'm in a group and they're TorPlayer, so I use TorCharacter so I can capture them both when needed.
       
    6. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      I'm thinking about it more and I realized that I never properly cached healing targets. I'm still not sure where to do this, but I think it goes under the DefaultCombat.cs file in the section that says
      Code:
      public override void Dispose()
      		{
      		}
      I changed it so now it says
      Code:
      public override void Dispose()
      		{
                  Targeting.Cache();
      		}
      and in the Targeting.cs file, I now have this
      Code:
      public static TorCharacter hTank;
              public static TorCharacter hTarget;
      
              public static void Cache()
              {
                  hTank = tankCandidate;
                  hTarget = healCandidate;
              }
      where I changed what used to be called hTank and hTarget to tankCandidate and healCandidate. What I'm hoping this does is that the Dispose() command acts as a clear cache, and forces the bot to update the healing targets each pulse. In my WoW routines, there's a section that literally labeled Pulse(), but we don't have that in BW so I'm hoping Dispose is just another name for it. I'm going to play around with it for a second before I post a new update for you guys to try.
       
    7. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      oh well i wish i could help more. But i lack the programing knowledge T.T
       
    8. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      I wish I knew anything about programming. I just follow guides from other people on WoW routines and then try to translate it to BW.

      By the way, the newest update just broke something. At first I thought it was the changes I made to caching, but I revert those and even the old stuff wasn't working so there's something larger at play.
       
    9. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Plugins have the onpulse command public void OnPulse() which sounds like your pulse your looking for. Couldn't tell you if it's just plugin only. A lot of people have put their code in their plugins to run within there just bashing through it over and over.
       
    10. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Probably writing all the healing targeting stuff as a plugin would be the way to go, but I don't know how to write plugins, only combat routines. Even there, I'm pretty limited as we can see.
       
    11. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Honestly wasn't all that bad, if you want I can send you the full project file from the plugin I just did. Has a bit of everything from GUI to backround worker process (multi threading) and a few other pieces. I haven't messed with the internal config but that could allow you to create separate targeting for ops/open world with the buddy gui. I know the latter revisions of the bob dole auto equip used it I just didn't dive into it. Those config windows are all xml and not exactly sure how to go about that.
       
    12. Cryogenesis

      Cryogenesis Moderator Moderator

      Joined:
      Jul 13, 2010
      Messages:
      2,128
      Likes Received:
      13
      Trophy Points:
      38
      Is it possible that the but may not see the entire group? Due to the raid layout of grouping?
      And that the offsets may not be complete or existing?
       
    13. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      offsets are very possible, I sent Alltruest some info last night that should help with his troubleshooting on it. Should echo the heal targets health to see if it's getting reported correctly. That's one thing that would cause healing to keep healing if it's receiving a bad health offset basically saying char is 50% all the time. I don't have any healers so I couldn't really test myself. He did identify that companion has been called incorrectly and his heal routine seems to handle it fine so offsets are good there.
       
    14. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Here's what wired203 sent me this morning. I don't see any reason to keep it private, but if you want I'll take this down. I think it's helpful for anyone to see, maybe they'll have a good idea too!

       
    15. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Sharing is good, but do note this would be for stock default combat and not the modified routine.

       
    16. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      I put it in the Spell.Cast section-- would it not work there?
       
    17. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      I would have to check spell.cast The location I had picked should have access to that float during that time. You can also change the format a little for the 2nd example you could do this. Logger.Write("Player Health Percentage" + SpellCast); so it would give you the info in quotes and the string after. Can make it easier to read. If your using Visual Studio and add Buddy wing as a reference you should be able to play with where you put it and VS should tell you if it should be ok.
       
    18. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Looks like you should be able to call it from there, before the Priority selector return. Course the log screen only shows info for a little bit now but being able to reflect info will help us debug these issues quicker.

      One other issue I have seen as others have would be if you are targeted on a resource to harvest or someone kills your mob as you move to it the bot can hang. Still trying to identify where that is occurring to add a sanity check.
       
    19. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Just an update: I had some luck doing a more simple modification to the original Targeting.cs file, but it's still spotty and gets stuck on targets (could be a LockSelector issue). I also used wired203's suggestion to monitor heal targets and I got decent results-- even when he was healing the wrong target, he still calculated the proper %. I actually found that sometimes it was calculating the enemy target's percentage, which made me notice the the original targeting file never distinguished between hostile and friendly targets in the HealCandidates calculations. Whoops. Fixing that helped, but didn't fix the occasional (but now MUCH LESS frequent) targeting errors.

      Still, I like my rewrite better. It's smoother and less complicated. It uses fewer resources and may allow us to sneak LockSelectors back in without as much lag. Here's my current update on the Targeting.cs. The biggest change is the (re)addition of the ScanTargets Composite. As wired203 indicated, we need to cache and reset targets. I've found a way to do that pretty easily, just set them all to null and 0 at the beginning of each tick. The issue I'm having is then building a new list. What I have at the bottom does not throw errors, but I don't know if it's right. I'm going to test it this afternoon, but I just wanted to let you know where I'm at right now.

      I need:
      Someone really smart to tell me how to build my lists at the bottom of ScanTargets so that it compiles all healing targets and tanks and enemy targets and aoehealing points. What I have makes sense to me, but I don't know if it's right.

      PHP:
      // Copyright (C) 2011-2015 Bossland GmbH
      // See the file LICENSE for the source code's detailed license

      using System.Collections.Generic;
      using System.Linq;
      using Buddy.BehaviorTree;
      using Buddy.Common.Math;
      using Buddy.Swtor;
      using Buddy.Swtor.Objects;
      using DefaultCombat.Helpers;

      namespace 
      DefaultCombat.Core
      {
          public static class 
      Targeting
          
      {
              private static 
      TorPlayer Me
              
      {
                  
      get { return BuddyTor.Me; }
              }

              
      #region TestStuff
              
      public static IEnumerable<TorCharacterPartyMembers get { return getPartyMembers(); } }
              public static 
      IEnumerable<TorCharacterTanks get { return getTanks(); } }

              public static 
      int addCount(TorCharacter unitfloat range)
              {
                  var 
      ObjectManager.GetObjects<TorCharacter>().Where(=> != null
                      
      && p.IsValidTarget()
                      && 
      p.InLineOfSight
                      
      && p.Position.DistanceSqr(unit.Position) <= range range
                      
      && p.IsTargetable).ToList();
                  return 
      t.Count();
              }

              public static 
      int injuredfriendCount(TorCharacter unitfloat range)
              {
                  var 
      PartyMembers.Where(=> != null
                      
      && p.InLineOfSight
                      
      && p.HealthPercent <= 75
                      
      && p.Position.DistanceSqr(unit.Position) <= range range
                      
      && p.IsFriendly).ToList();
                  return 
      t.Count();
              }

              public static 
      IEnumerable<TorCharactergetPartyMembers()
              {
                  if (
      Me.GroupId == 0)
                  {
                      var 
      ObjectManager.GetObjects<TorCharacter>().Where(=> != null && p.IsTargetable && p.Guid == Me.Companion.Guid).ToList();
                      
      t.Add(Me);
                      return 
      t;
                  }
                  else
                  {
                      var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && p.IsTargetable && p.GroupId == Me.GroupId).ToList();
                      return 
      t;
                  }
              }
              public static 
      IEnumerable<TorCharactergetTanks()
              {
                  if (
      Me.GroupId == 0)
                  {
                      return 
      ObjectManager.GetObjects<TorNpc>().Where(=> != null && p.IsTargetable && p.Guid == Me.Companion.Guid);
                  }
                  if (
      Me.GroupId == && Me.Companion == null)
                  {
                      return 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && p.IsTargetable && p.Guid == Me.Guid);
                  }
                  else
                  {
                      var 
      ObjectManager.GetObjects<TorPlayer>().Where(=> != null && p.GroupId == Me.GroupId && p.IsTargetable && (p.Discipline == CharacterDiscipline.Defense
                                                                                                                                      
      || p.Discipline == CharacterDiscipline.Darkness
                                                                                                                                      
      || p.Discipline == CharacterDiscipline.Immortal
                                                                                                                                      
      || p.Discipline == CharacterDiscipline.KeneticCombat
                                                                                                                                      
      || p.Discipline == CharacterDiscipline.ShieldSpecialist
                                                                                                                                      
      || p.Discipline == CharacterDiscipline.ShieldTech)).ToList();
                      return 
      t;
                  }
              }

              public static 
      TorCharacter healCandidate
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      PartyMembers.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.Distance <= 30).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }

              public static 
      TorCharacter tankCandidate
              
      {
                  
      get
                  
      {
                      if (!
      Me.InCombat) return null;
                      var 
      Tanks.Where(=> != null
                          
      && !p.IsDead
                          
      && p.InLineOfSight
                          
      && p.Distance <= 30).OrderBy(=> p.HealthPercent).FirstOrDefault();
                      return 
      != null null;
                  }
              }

              public static 
      TorCharacter hTank;
              public static 
      TorCharacter hTarget;
              public static 
      int adds;
              public static 
      int aoeheal;

              public static 
      void Cache()
              {
                  
      hTank tankCandidate;
                  
      hTarget healCandidate;
                  
      adds addCount(Me.CurrentTargetDistance.MeleeAoE);
                  
      aoeheal injuredfriendCount(hTargetDistance.MeleeAoE);
              }

              public static 
      Composite ScanTargets
              
      {
                  
      get
                  
      {
                      return new 
      Action(delegate
                      
      {
                          
      using (BuddyTor.Memory.AcquireFrame())
                          {
                              
      hTank null;
                              
      hTarget null;
                              
      adds 0;
                              
      aoeheal 0;

                              
      getTanks();
                              
      getPartyMembers();
                              
      aoeheal++;
                              
      adds++;

                              return 
      RunStatus.Failure;
                          }
                      });
                  }
              }
              
      #endregion
          
      }
      }
       
    20. wired203

      wired203 Community Developer

      Joined:
      Jan 22, 2015
      Messages:
      391
      Likes Received:
      1
      Trophy Points:
      18
      Glad I was helpful, I find it's always easier to see what's going on rather than just taking random shots to know what's working and what's not which no one was really sure. Reset looks good same as default however default re-creates the list on reset here. HealCandidates = new List<TorCharacter>(); by generating the list again it would flush it.

      I like how your re-write includes LOS it should increase the accuracy of the bot. I wonder if the target lag in the old routine is all the vector checks and calculations for AOE targeting. Like if you targeted something far away while the bot was running it would cause it to hitch every few seconds till you cleared that target. Keep it up man it's looking good.
       

    Share This Page