• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Companion Targeting

    Discussion in 'Community Developer Forum' started by alltrueist, Sep 2, 2015.

    1. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      This is something I cooked up when I was developing my Fistweaving routine for WoW and then promptly forgot about. I've been thinking about our issues targeting companions, and how we might solve what appears to be a game issue. I opened up DefaultCombat and focused ONLY on the Targeting.cs file. I put this code at the very end:
      Code:
      public static TorNpc MyCompanion
              {
                  get
                  {
                      TorNpc companion = ObjectManager.GetObjects<TorNpc>().Where(unit => unit.Name == Me.Companion.Name && unit.Guid == Me.Companion.Guid && !unit.IsDead && unit.IsFriendly).OrderBy(i => i.Distance).FirstOrDefault();
                      if (companion == null) { Logger.Write("I can't find a companion"); }
                      return companion;
                  }
              }
      And in the ScanTargets and DefaultCombat.IsHealer section, I dropped the new companion check right after the old companion check:
      Code:
      if (Tank == null && Me.Companion != null && !Me.Companion.IsDead)
                                          Tank = Me.Companion;
      
                                      if (Tank == null && MyCompanion != null && !MyCompanion.IsDead)
                                          Tank = MyCompanion;
      
                                      if (Tank == null)
                                          Tank = Me;
      I haven't tested it yet, but I'm not sure if it really matters if I test it. The companion targeting bug is so unpredictable that I could test it and it works great, but then you guys test it and it doesn't work. The question I'm really asking is:
      1. SHOULD this work in theory? (Much different than whether it does work or doesn't)
      2. How does the bot currently determine my companion?
      3. What would be the difference between using TorNpc (which I currently use) and TorObject (which I was tempted to use)?

      Just trying to see if we can get traction on this issue that has bugged me for years. If we can get companion targeting reliably working, we could actually test out healing routines.
       
    2. Cryogenesis

      Cryogenesis Moderator Moderator

      Joined:
      Jul 13, 2010
      Messages:
      2,128
      Likes Received:
      13
      Trophy Points:
      38
      When i was messing with Companions in profiles with the following code:
      Code:
      BuddyTor.Me.Companion.Name.Contains()
      
      This code runs after a quest is complete to check, which companion we have and choose the appropriate reward for this companion.

      I had the following problem:
      When the quest is complete, it runs the code for each companion, if yes then completequest with the reward i want for that companion.
      As soon as i got 2 quests that got completed at once and both had rewards for companions, i CANT run this code after each other.
      It looked like, i could read out the mem, but not reread it like if the option was used up. I Accidently moved and ran the code again and it worked.

      So maybe this is the issue with the code you had. Running it once works, but second or more doesnt if you dont do anything in between to 'refresh' the memory.
      In the end it looks an issue the game has in stead of the bot itself, or maybe the bot/game clears the memspot after its been read?!?
       
    3. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Yeah that could be a problem. My code would force the bot to constantly check for an NPC in range that has the same name/guid as our companion. The issue is that I don't know how the bot calculates BuddyTor.Me.Companion. Obviously the way it works isn't 100% effective-- that could be a bot issue (in which case we could try to fix it) or it could be a game issue (in which case we're wasting our time). The only real way to figure that out is to work on methods for targeting Npcs (or Objects, like I said) that SHOULD work. If they don't, we're stuck.

      I should note that my method probably wouldn't work even in theory, since I'm searching for my companion using Me.Companion.Name and Me.Companion.Guid. If the bot is already having trouble find the companion, those checks are likely useless. Why oh why couldn't Bioware put the companion in a damn party window?
       
    4. Teo

      Teo Member

      Joined:
      Oct 6, 2012
      Messages:
      35
      Likes Received:
      1
      Trophy Points:
      8
      Looking at other routines (namely Joes), it appears that he was clearing the ObjectManager cache every 250ms before doing a check for a companion. Would it help forcing the cache to reload?
       
    5. Cryogenesis

      Cryogenesis Moderator Moderator

      Joined:
      Jul 13, 2010
      Messages:
      2,128
      Likes Received:
      13
      Trophy Points:
      38
      That was/is one of the best features of joe. It release every bad mojo and reconnects.
      I copied that piece of code to a plugin, but it reloads to much now haha.
       
    6. alltrueist

      alltrueist Active Member

      Joined:
      Dec 10, 2012
      Messages:
      1,424
      Likes Received:
      16
      Trophy Points:
      38
      Joe's was the only routine that reliably healed the companion, but it had so much other stuff in it that I usually avoided the routine altogether. It may be worth taking a look into, or at least running a test on.
       

    Share This Page