• Visit Rebornbuddy
  • Not Casting Vaal Haste?

    Discussion in 'Archives' started by Pochizzle, Jan 3, 2016.

    1. Pochizzle

      Pochizzle Member

      Joined:
      Mar 5, 2012
      Messages:
      204
      Likes Received:
      0
      Trophy Points:
      16
      Currently using a SRS build under OldRoutine and it doesn't want to seem to cast Vaal Haste.

      I have cast vaal spells highlighted, but no luck.

      Is it just me, or is this a known problem?
       
    2. Unknown Buddy

      Unknown Buddy Member

      Joined:
      May 20, 2015
      Messages:
      603
      Likes Received:
      17
      Trophy Points:
      18
      You can always add those skills to the CR itself. OldRoutine doesnt do such a great job imo handling the vaal skills simply because you have very little control over how they are activated. OldRoutine will simply cast any skill with "vaal" in its name everytime the CD is available This is very generic (and made that way for a reason). If you have more than 1 vaal skill on your bars, im not sure if OldRoutine handles that well, which may be why your vaal haste isnt casting.

      You can read up on how to add abilities to the CR here: https://www.thebuddyforum.com/exilebuddy-forum/combat-routines/221570-snippet-golem.html

      This is the code i use for each of the vaal skills i have:

      Code:
      private int _vaalHasteSlot = -1;
      Code:
      _vaalHasteSlot = -1;
      Code:
                      var vh = LokiPoe.InGameState.SkillBarPanel.Skills.FirstOrDefault(s => s.Name == "Vaal Haste");
                      if (IsCastableHelper(vh))
                      {
                          _vaalHasteSlot = vh.Slot;
                      }
      Code:
                     if (_vaalHasteSlot != -1)
                      {
                          // See if we can use the skill.
                          var skill = LokiPoe.InGameState.SkillBarPanel.Slot(_vaalHasteSlot);
                          if (skill.CanUse())
                          {
                              var err1 = LokiPoe.InGameState.SkillBarPanel.Use(_vaalHasteSlot, true);
                              if (err1 == LokiPoe.InGameState.UseError.None)
                              {
                                  await Coroutine.Sleep(Utility.LatencySafeValue(10));
      
                                  await Coroutines.FinishCurrentAction(false);
      
                                  await Coroutine.Sleep(Utility.LatencySafeValue(10));
      
                                  return true;
                              }
      
                              Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
                          }
                      }
      In the final segment of code you can add more conditions if you like. Such as:

      This would make it cast Vaal Haste only if your target is a unique quality monster (such as a boss or tormented spirit).
      Code:
       if (_vaalHasteSlot != -1 && cachedRarity >= Rarity.Unique) 
      This would be for yellow packs or higher:
      Code:
       if (_vaalHasteSlot != -1 && cachedRarity >= Rarity.Rare) 
      If you were messing with something like Vaal Discipline you can add in something like this to make it only cast at 75% or lower energy shield.
      Code:
      if (skill.CanUse() && (LokiPoe.Me.EnergyShieldPercent <= 75))
      Final Note:

      If you are going to use the cachedRarity you will need to place the 4th code section anywhere BELOW the line that looks like:
      Code:
      var cachedRarity = bestTarget.Rarity;
      Otherwise you will get an error trying to use a variable that hasnt been declared.

      And make sure you uncheck the box for auto using vaal skills since you are now setting them up yourself to be used when you want them used.
       
    3. Pochizzle

      Pochizzle Member

      Joined:
      Mar 5, 2012
      Messages:
      204
      Likes Received:
      0
      Trophy Points:
      16
      While I do appreciate the help, I do not like messing with the basic old routine sadly because i run multiple scripts off of it and it is a foreign language to me.

      I do love the option that you can add it to unique mosnters, is it a possibility to do it for all rare+ monsters?

      I only have Vaal Haste on my bar, but I do use a bunch of auras, but I still wouldn't mind it casting it whenever as it would help me get across the map faster, and it basically charges itself up fine and easy
      Does not look good getting tons of charges for it, but never using it, and i'm not exactly sure why it's not working like it used to
       
    4. Laugh

      Laugh New Member

      Joined:
      Apr 26, 2014
      Messages:
      46
      Likes Received:
      0
      Trophy Points:
      0
      just going to leave this here

      Code:
      using log4net;
      using Loki.Bot;
      using Loki.Common;
      using Loki.Game;
      using Loki.Game.Objects;
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Windows.Controls;
      
      namespace VaalCaster
      {
          public class VaalCaster : IPlugin
          {
              private static readonly ILog Log = Logger.GetLoggerInstanceForType();
      
              #region Implementation of IAuthored
      
              /// <summary> The name of the plugin. </summary>
              public string Name
              {
                  get
                  {
                      return "VaalCaster";
                  }
              }
      
              /// <summary>The author of the plugin.</summary>
              public string Author
              {
                  get
                  {
                      return "Bossland GmbH";
                  }
              }
      
              /// <summary> The description of the plugin. </summary>
              public string Description
              {
                  get
                  {
                      return "A plugin that casts vaal skills under specific conditions.";
                  }
              }
      
              /// <summary>The version of the plugin.</summary>
              public string Version
              {
                  get
                  {
                      return "0.0.1.1";
                  }
              }
      
              #endregion
      
              #region Implementation of IBase
      
              /// <summary>Initializes this plugin.</summary>
              public void Initialize()
              {
                  Log.DebugFormat("[VaalCaster] Initialize");
              }
      
              /// <summary>Deinitializes this object. This is called when the object is being unloaded from the bot.</summary>
              public void Deinitialize()
              {
                  Log.DebugFormat("[VaalCaster] Deinitialize");
              }
      
              #endregion
      
              #region Implementation of IRunnable
      
              /// <summary> The plugin start callback. Do any initialization here. </summary>
              public void Start()
              {
                  Log.DebugFormat("[VaalCaster] Start");
              }
      
              /// <summary> The plugin tick callback. Do any update logic here. </summary>
              public void Tick()
              {
                  if (!LokiPoe.IsInGame || LokiPoe.Me.IsInTown || LokiPoe.Me.IsDead)
                      return;
                  var monsters = LokiPoe.ObjectManager.GetObjectsByType<Monster>()
                      .Where(m => !m.IsDead &&
                          m.IsHostile &&
                          m.Distance < 60).ToList();
      
                  //use vaal skill on unique monster
                  if (monsters.Any(m => m.Rarity == Loki.Game.GameData.Rarity.Unique))
                  {
                      UseVaalSkill();
                      return;
                  }
      
                  var hasBoxes = LokiPoe.ObjectManager.GetObjectsByType<Chest>()
                      .Any(b => b.IsStrongBox &&
                          !b.IsOpened &&
                          b.Distance < 20);
      
                  if (!monsters.Any() && hasBoxes)
                  {
                      //use skill before opening box
                      UseVaalSkill();
                      return;
                  }
                 
              }
      
              public void UseVaalSkill()
              {
                  var skill = LokiPoe.InGameState.SkillBarPanel.Skills.FirstOrDefault(s => s.Name == "Vaal Haste");
      
                  if (IsCastableHelper(skill) && skill.CanUse())
                  {
      
                      var err1 = LokiPoe.InGameState.SkillBarPanel.Use(skill.Slot, false);
      
                      Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
                  }
              }
              private bool IsCastableHelper(Skill skill)
              {
                  return skill != null && skill.IsCastable && !skill.IsTotem && !skill.IsTrap && !skill.IsMine;
              }
      
              /// <summary> The plugin stop callback. Do any pre-dispose cleanup here. </summary>
              public void Stop()
              {
                  Log.DebugFormat("[VaalCaster] Stop");
              }
      
              #endregion
      
              #region Implementation of IConfigurable
      
              /// <summary>The settings object. This will be registered in the current configuration.</summary>
              public JsonSettings Settings
              {
                  get
                  {
                      return null;
                  }
              }
      
              /// <summary> The plugin's settings control. This will be added to the Exilebuddy Settings tab.</summary>
              public UserControl Control
              {
                  get
                  {
                      return null;
                  }
              }
      
              #endregion
      
              #region Implementation of ILogic
      
              /// <summary>
              /// Coroutine logic to execute.
              /// </summary>
              /// <param name="type">The requested type of logic to execute.</param>
              /// <param name="param">Data sent to the object from the caller.</param>
              /// <returns>true if logic was executed to handle this type and false otherwise.</returns>
              public async Task<bool> Logic(string type, params dynamic[] param)
              {
                  return false;
              }
      
              /// <summary>
              /// Non-coroutine logic to execute.
              /// </summary>
              /// <param name="name">The name of the logic to invoke.</param>
              /// <param name="param">The data passed to the logic.</param>
              /// <returns>Data from the executed logic.</returns>
              public object Execute(string name, params dynamic[] param)
              {
                  return null;
              }
      
              #endregion
      
              #region Implementation of IEnableable
      
              /// <summary> The plugin is being enabled.</summary>
              public void Enable()
              {
                  Log.DebugFormat("[VaalCaster] Enable");
              }
      
              /// <summary> The plugin is being disabled.</summary>
              public void Disable()
              {
                  Log.DebugFormat("[VaalCaster] Disable");
              }
      
              #endregion
      
              #region Override of Object
      
              /// <summary>Returns a string that represents the current object.</summary>
              /// <returns>A string that represents the current object.</returns>
              public override string ToString()
              {
                  return Name + ": " + Description;
              }
      
              #endregion
          }
      }
      
       
    5. Pochizzle

      Pochizzle Member

      Joined:
      Mar 5, 2012
      Messages:
      204
      Likes Received:
      0
      Trophy Points:
      16
      Sorry for the late reply, but have been super busy lately.

      Trying to add Chaos Golem and one of these to the SRS routine and now i'm not sure which is better to add.

      I like that Laughs (plugin im assuming?) has a option for it to cast before chests as well as casting on rare+ monsters, but would love the option to be able to add Vaal Grace or Clarity like unkown has but seems harder to edit someone elses custom CR.

      If i'm wrong about it being a plugin (I see it in the plugin screen, but nothing after i activate it), or one not being able to add different Vaal skills, please let me know.

      Edit:

      Been using Laughs plugin, and it seemed to work fine but how would I change the rarity of the monsters to lower then unique?
      I have 2 on my bar, and it only seems to use one because it won't cast on blue or rare mobs. I tried editing the script from .Unique to .Rare but it stopped working after i did that


      Either that, or how would I add the option for another Vaal Skill?
       
      Last edited: Jan 11, 2016

    Share This Page