• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Placing pet

    Discussion in 'Community Developer Forum' started by gathel, Apr 12, 2015.

    1. gathel

      gathel New Member

      Joined:
      Feb 14, 2015
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      1
      I'm trying to write a bit of code that would allow me to place a pet, and re-place the pet back there when it gets knocked away.

      I can check where the pet is, I assume, by doing something like this:
      Code:
                  var pet = ff14bot.Managers.GameObjectManager.CurrentPet;
                  if (pet == null)
                      return;
                  // use pet.Location
      
      I can't seem to find a way to do something like this:
      Code:
                      ff14bot.Objects.Pet.DoAction("Place", location);
                      // Pet.DoActionLocation("spell", location);
      
      How can I place the pet somewhere? Thanks!
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      382
      Trophy Points:
      83
      First, theres no need to include the namespaces.
      GameObjectManager.CurrentPet;
      Pet.DoAction("Place", location);
      will work fine in most cases that are exposed to users, otherwise import the namespace.

      Second, you can try doing
      ActionManager.DoActionLocation
      As Pet.* functions are just wrappers for that.
       
    3. gathel

      gathel New Member

      Joined:
      Feb 14, 2015
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      1
      Thanks for the info. It doesn't seem to work for Place though, here's the code I've tried:

      Code:
          public class RePlacer
          {
              private const string PlaceSpell = "Place";
              private readonly Logger _logger;
              public float MaxDistance = 3;
      
              public RePlacer(Logger logger)
              {
                  _logger = logger;
              }
      
              public void Pulse()
              {
                  PlacePet();
              }
      
              private void PlacePet()
              {
                  var pet = GameObjectManager.CurrentPet;
                  if (pet == null)
                  {
                      return;
                  }
      
                  var location = Location;
                  if (location != Vector3.Zero)
                  {
                      var distance = location.Distance(pet.Location);
                      if (distance > MaxDistance)
                      {
                          _logger.Log("Pet is {0} away, moving it back to {1}.", distance, location);
                          if (!Actionmanager.CanCastLocation(PlaceSpell, location))
                          {
                              _logger.Log("Unable to cast place at {0}.", location);
                              return;
                          }
                          Actionmanager.DoActionLocation(PlaceSpell, location);
                      }
                  }
              }
      
              public Vector3 Location { get; set; }
          }
      

      I've also tried to use the word, but with the same result:
      Code:
              private const string PlaceSpell = "Place";
      
      From the logs, it's obvious the spell is properly marked as not castable:
      Code:
      [00:13:14.981 N] [PetPlacer] Pet is 3.157768 away, moving it back to <69.01648, 25, 19.4552>.
      [00:13:14.981 N] [PetPlacer] Unable to cast place at <69.01648, 25, 19.4552>.
      
      I'm really close to the desired location, it's in LOS, and it's somewhere my pet was standing originally because the Location property is set with a button press based on the pet's location at the time.

      I'm guessing at this point that Place isn't a spell/action in the traditional sense? I'm not sure. Would you be able to help me any further?

      Thanks.
       
    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      382
      Trophy Points:
      83
      I'm not sure cancastlocation works properly with pet spells

      Just in the console try running doactionlocation and pass the players current location.
       
    5. gathel

      gathel New Member

      Joined:
      Feb 14, 2015
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      1
      Trying this doesn't do anything:
      Code:
      Actionmanager.DoActionLocation("Place", GameObjectManager.LocalPlayer.Location);
      
      So I tried to embrace, which also doesn't do anything using Actionmanager:
      Code:
      Actionmanager.DoAction("Embrace", GameObjectManager.LocalPlayer);
      
      Then to make sure I wasn't doing something wrong with the console, I did this.. and it worked:
      Code:
      Pet.DoAction("Embrace", GameObjectManager.LocalPlayer);
      
      So I can't seem to use the Actionmanager DoAction calls to perform pet actions.

      Is there anything else I can try?

      Thanks for the continued help.
       
    6. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      382
      Trophy Points:
      83
      Ofcourse none of those worked, you didn't tell it you were trying to use the actiontype.pet
       
    7. gathel

      gathel New Member

      Joined:
      Feb 14, 2015
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      1
      Not sure how I missed that overload.

      I've now tried these two:
      Code:
      Actionmanager.DoActionLocation(ActionType.PetAction1, 150003, GameObjectManager.LocalPlayer.Location);
      Actionmanager.DoActionLocation(ActionType.PetAction2, 150003, GameObjectManager.LocalPlayer.Location);
      
      With no response. I got the spell id from xivdb: I tried getting it from the action cache when I summon my pet, I see this stuff normally when swapping class:
      But the pet shows with no id, such as:

      Am I getting the wrong Id? Wrong overload still?

      Thanks for all the help.
       
    8. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      382
      Trophy Points:
      83
      Your out of luck until the next version. all the doaction* check if you have the spell unless you pass the spelldata object directly, and there isnt one exposed for doactionlocation.
       
    9. gathel

      gathel New Member

      Joined:
      Feb 14, 2015
      Messages:
      26
      Likes Received:
      0
      Trophy Points:
      1
      Awesome.
       

    Share This Page