• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Bagslot.UseItem() hq items

    Discussion in 'Community Developer Forum' started by kaihaider, Jan 17, 2015.

    1. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      I can't get Bagslot.UseItem() to work on high quality potions.

      Am I doing something wrong or is this a bug?
      [h=3][/h]
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Log and example of your code.
       
    3. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Code:
      var pot = InventoryManager.FilledSlots.FirstOrDefault(a => a.Name.Equals("Mega-Potion Of Dexterity"));
      if (pot != null && pot.IsValid)
         {    Logging.Write("[RebornCo] Found: " + pot.Name);
          pot.UseItem();
          }
       

      Attached Files:

    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83

      Code:
      [23:34:30.850 D] DoAction Item 4595 0xE0000000
      
      If you wan't it to use HQ items you need to filter out non-hq otherwise your code is just going to use whatever item it finds first.
       
    5. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      that was when i swtiched to a Potion Of Dexterity instead of the hq Mega-Potion Of Dexterity I had in my inventory, to check if the code should be using an item.
      Code:
      [23:34:10.577 N] [RebornCo] Found: Mega-Potion of Dexterity
      [23:34:30.833 N] [RebornCo] Found: Potion of Dexterity
      [23:34:30.850 D] DoAction Item 4595 0xE0000000
      I would be fine with it using either quality but it's not using hq at all.

      Were your test results different?
       
    6. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Thanks got it, pushing a new build now.
       
    7. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Also if your going to be bad and use strings then make sure to compare both the englishname and the currentlocalename of objects so that it will work in other regions.
       
    8. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      if the names are user settings and not hard coded, would a .Name be fine?
       
    9. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      No, then you should really be using currentlocalename
       

    Share This Page