• Visit Rebornbuddy
  • Get Curse on Hit working

    Discussion in 'Archives' started by BigBudda87, Oct 9, 2015.

    1. BigBudda87

      BigBudda87 Member

      Joined:
      May 5, 2012
      Messages:
      243
      Likes Received:
      0
      Trophy Points:
      16
      Maybe i´m stupid or something but i can´t get cuse on hit working. ich search the routine and find

      Code:
      // Register curses.
      				foreach (var skill in LokiPoe.InGameState.SkillBarPanel.Skills)
      				{
      					var tags = skill.SkillTags;
      					var name = skill.Name;
      
      					if (tags.Contains("curse")) 
      so ich change too

      Code:
      				// Register curses.
      				foreach (var skill in LokiPoe.InGameState.SkillBarPanel.Skills)
      				{
      					var tags = skill.SkillTags;
      					var name = skill.Name;
      
      					if (tags.Contains("curse") || skill.Name == "Frenzy"))
      					{
      but it don´t work. maybe someone can help me
       
    2. toNyx

      toNyx Well-Known Member

      Joined:
      Oct 29, 2011
      Messages:
      3,770
      Likes Received:
      35
      Trophy Points:
      48
      Need a specific logic for CoH, you'll need to find if your best target has curse, if not use specific spell, else keep rotating
       
    3. BigBudda87

      BigBudda87 Member

      Joined:
      May 5, 2012
      Messages:
      243
      Likes Received:
      0
      Trophy Points:
      16
      so i need to work with

      Code:
      var cachedIsCursable = bestTarget.IsCursable;
      and

      Code:
      var cachedCurseCount = bestTarget.CurseCount;
      sry i´m learning coding atm
       
    4. toNyx

      toNyx Well-Known Member

      Joined:
      Oct 29, 2011
      Messages:
      3,770
      Likes Received:
      35
      Trophy Points:
      48
      Yep,

      Code:
      if (cachedIsCursable && !bestTarget.HasAura("your_aura_name"))
      {
          // cast specific spell here
          // return true to avoid rotating entirely until mob has curse, or not if you wanna try once and keep going
      }
       
      Last edited: Oct 9, 2015
    5. BigBudda87

      BigBudda87 Member

      Joined:
      May 5, 2012
      Messages:
      243
      Likes Received:
      0
      Trophy Points:
      16
      okay. i need to learn more before i can get this to work for me. i´m trying it when i know more about coding :rolleyes:

      but thanks tonyx for the help
       
    6. ugin757

      ugin757 Member

      Joined:
      Sep 14, 2015
      Messages:
      44
      Likes Received:
      0
      Trophy Points:
      6
      you were on such a roll though, this would help people im sure.
       
    7. razmataz

      razmataz New Member

      Joined:
      Oct 26, 2015
      Messages:
      6
      Likes Received:
      0
      Trophy Points:
      1
      I managed to get this working in its most simplest form. Here's the code snippet I'm using (and thanks to toNyx for getting it started)

      Code:
      if (cachedIsCursable && !bestTarget.HasAura("Frostbite"))
      	{
      					
      		LokiPoe.InGameState.SkillBarPanel.UseAt(7, false, cachedPosition);		
      		return true;
      
      	}
      
      In my setup I'm using Leap Slam to apply the Frostbite curse. The first line checks the mobs to see if the best target (as calculated by the bot) has the curse, and if it does not, it uses the slot 7 skill (in my case, Leap Slam), and then moves into the standard combat routine. I placed this snippet after the vaal skills section, and before the combat section, so itll be the last thing checked before the basic combat starts. So far it works just fine for grinding.

      Now, I'm not a code expert by any means, and this will need to be modified to make it work with any other setup (the curse name and slot position for example), but its a start, and I'm sure someone more proficient than I can stream line this into something more user friendly (though I'll continue to tinker with it)
       
    8. Unknown Buddy

      Unknown Buddy Member

      Joined:
      May 20, 2015
      Messages:
      603
      Likes Received:
      17
      Trophy Points:
      18
      I have been wanting to get Curse on Hit working myself, since it can be extremely powerful both offensively and defensively. What i ended up doing was basically copy/pasta'ing the entire cursing logic from OldRoutine. Renamed a few variables, and set my Curse on Hit key. Been running a few hours now and all seems to work perfectly fine for my Poison Arrow build. Hotkey is simply linked to my level 1 Frenzy > Curse on Hit > Greater Multiple Projectiles > Chain > Vulnerability.

      Code:
      // Curse on Hit Adjustments 
      var Curse_On_Hit = myPos.Distance(cachedPosition) < OldRoutineSettings.Instance.MaxRangeRange &&
      			(cachedRarity >= Rarity.Magic || cachedMobsNearForCurse >= 4);
      if (Curse_On_Hit)
      {
      	var skill = LokiPoe.InGameState.SkillBarPanel.Slot([COLOR="#FF0000"]1[/COLOR]);
      	if (skill.CanUse() &&
      	cachedIsCursable &&
      	cachedCurseCount < LokiPoe.Me.TotalCursesAllowed &&
      	!bestTarget.HasAura("[COLOR="#FF0000"]Vulnerability[/COLOR]"))
      							
           {
      	//await DisableAlwaysHiglight();
      					
      	var err1 = LokiPoe.InGameState.SkillBarPanel.UseAt([COLOR="#FF0000"]1[/COLOR], false, cachedPosition);
      	if (err1 == LokiPoe.InGameState.UseError.None)
      		return true;
      
      	Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
           }
      }
      
      Red text is what each user will have to edit manually. 1-8 depending on which hotkey you decide to use and you will have to change the name of the curse / debuff you are applying to the mob.

      The above code will curse:
      1. All Magic Enemies
      2. All Rare Enemies
      3. All Bosses
      4. Any cluster of 4+ (any enemy type)


      SideNotes:

      1. I dont know what await DisableAlwaysHiglight(); is used for. I have it commented out for now.
      Tested with it enabled and disabled and i see no difference.

      2. I dont know what the true / false represents in: LokiPoe.InGameState.SkillBarPanel.UseAt(1, false, cachedPosition);

      3. I havent tested this on a melee character yet. So i dont know how its going to interact with the MaxRangeRange. Works fine for ranged so far. Worst case you may have to change MaxRangeRange to MaxMeleeRange if you are playing a melee class, or set MaxRangeRange to the max distance of whatever skill you are using. IE: If you are using Leap Slam to Curse on Hit and Leap Slam has a range of 20 yards, set MaxRangeRange to 20 (i dont know the actual range of Leap Slam, just an example).


      If toNyx, darkbluefirefly, pushedx, ExVault, or any of the other regular devs around here want to weigh on the correct settings for these things, would appreciate it. As of now, i see no difference between true/false and removing the await DisableAlwaysHighlight.
       
      Last edited: Oct 27, 2015
    9. toNyx

      toNyx Well-Known Member

      Joined:
      Oct 29, 2011
      Messages:
      3,770
      Likes Received:
      35
      Trophy Points:
      48
      1. it's mainly to avoid clicking on items labels, it'll disable the highlight.
      2. This value sets "AttackInPlace" to true for this action. Mostly for Ranged builds to curse on hit with split arrow and such things.
      3. cachedPosition is the bestTarget location pretty much, so there's no reason it wouldn't work with Leap Slam or any other melee spell.

      For those who wants to use "max range" of a spell, determine it visually or do some testing, and replace OldRoutineSettings.Instance.MaxRangeRange by (value - 5) to avoid stutterstep or weird behaviors.
      Logic seems good.
      Good stuff :)
       
    10. razmataz

      razmataz New Member

      Joined:
      Oct 26, 2015
      Messages:
      6
      Likes Received:
      0
      Trophy Points:
      1
      I can confirm that it does work just fine with Leap Slam (even using the default max range settings) in a melee setup. In fact, it doubles as a movement skill, quickly getting into melee range before executing the normal combat routine. In the case of melee setups, if the CoH ability doubles as a movement skills (Leap Slam, Flicker Strike, etc.), I would probably remove the density check so I could constantly be moving from monster to monster (in the case you aren't using any other movement plugins, or your main ability doesn't supply any movement benefits).

      Thanks you all, this thread has been very helpful!
       

    Share This Page