• Visit Rebornbuddy
  • sleep function to circumvent gcd issues

    Discussion in 'Combat Routines' started by Cass, Feb 12, 2016.

    1. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      Hello folks

      I would like to ask for the devs if it would be possible to create a function or modify Spell.Cast() so that it would check a list or a table to see if the ability casted use a gcd to put a sleep for xxx msecs before using it.
      That way we could fix the behavior of priorityselector that skip some skills because CanCast() cant recognize the gcd and we could tweak it .
      The ideia to check the list its to make sure we wont waste gcds when using abilities that are out of it like cannon shoulder for example.
       
    2. Aevitas

      Aevitas Well-Known Member Staff Member Buddy Core Dev

      Joined:
      Mar 2, 2010
      Messages:
      2,307
      Likes Received:
      36
      Trophy Points:
      48
      You should be able to cob this together with the Sleep composite and a collection. However, since combat runs off a single thread, it wouldn't be as simple to use spells that aren't on the GCD interwoven with spells that are, in perfect timing. An alternate solution would be to just put the non-GCD spells on top of the priority selector, so it'd always cast those first.
       
    3. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      That why i imagined that changing inside spell.cs a way to check this

      PHP:
      public static Composite Cast(string spellUnitSelectionDelegate onUnitSelection<boolreqs null)
              {
                  return
                      new 
      Decorator(
                          
      ret =>
                              
      onUnit != null && onUnit(ret) != null && (reqs == null || reqs(ret)) &&
                              
      AbilityManager.CanCast(spellonUnit(ret)),
                          new 
      PrioritySelector(
                              new 
      Action(delegate
                              
      {
                                  
      Logger.Write(">> Casting <<   " spell);
                                  return 
      RunStatus.Failure;
                              }),
                              new 
      Action(ret => AbilityManager.Cast(spellonUnit(ret))))
                              if 
      Spelltable 1
                              
      new Action(ret => Sleep(xxx))
                          );
              }
      Acctually i dont anything about c# so i dont know how if the sleep is correct and spelltable should get the data from a table where we can add the skills in a colum and 1 or 0 on another column as boolean to identify if the skill use gcd or not. But i dont know how to create a table too nether how to look for the data inside T.T
       
    4. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      I tried including Thread.Sleep and only Sleep (since there is a class on Buddy.BehaviorTree) between buffs and single target rotation but none of those works.

      wich is the correct syntax for using those?
       
    5. pindleskin

      pindleskin Community Developer

      Joined:
      Oct 24, 2012
      Messages:
      1,124
      Likes Received:
      2
      Trophy Points:
      38
      You must include the namespace in the top of the file for Thread.Sleep() to work.

      Code:
      using System.Threading;
      
      source: https://msdn.microsoft.com/sl-SI/li...ep(v=vs.110).aspx?f=255&MSPPError=-2147217396
       
    6. Cass

      Cass New Member

      Joined:
      Jan 24, 2014
      Messages:
      98
      Likes Received:
      2
      Trophy Points:
      0
      Tried that too it gives me error CS1519 on compilation

      PHP:
      public override Composite Cooldowns
              
      {
                  
      get
                  
      {
                      return new 
      PrioritySelector(
                          
      Spell.Buff("Determination"ret => Me.IsStunned),
                          
      Spell.Buff("Vent Heat"ret => Me.ResourcePercent() >= 50),
                          
      Spell.Buff("Supercharged Gas"ret => Me.BuffCount("Supercharge") == 10)
                          ,
                          
      //Spell.Buff("Energy Shield", ret => Me.HealthPercent <= 70),
                          
      Spell.Buff("Kolto Overload"ret => Me.HealthPercent <= 30)
                          );
                  }
              }

              
      Thread.Sleep(1400);
              
              public 
      override Composite SingleTarget
      I tried putting inside single target rotation as well, i dont really know how to use it
       

    Share This Page