• Visit Rebornbuddy
  • Combat Routine Question

    Discussion in 'Community Developer Forum' started by Beast, Mar 7, 2014.

    1. Beast

      Beast Member

      Joined:
      Apr 22, 2010
      Messages:
      618
      Likes Received:
      6
      Trophy Points:
      18
      I am working on making a combat routine for my Lancer, I am new to coding but I have this:

      Code:
              protected override Composite CreatePull()
              {
                  if (settings.PullSpell == false)
                  {
                      return new PrioritySelector(
                          r => Actionmanager.InSpellInRangeLOS("Piercing Talon", Core.Target),
                          new Decorator(r => (r as SpellRangeCheck?) == SpellRangeCheck.ErrorNotInRange, new Action(r => Navigator.MoveTo(Core.Target.Location))),
                          Cast("Piercing Talon", r => (r as SpellRangeCheck?) == SpellRangeCheck.Success || (r as SpellRangeCheck?) == SpellRangeCheck.ErrorNotInFront));
                  }
                  else
                  {
                      return new PrioritySelector(
                          r => Actionmanager.InSpellInRangeLOS("True Thrust", Core.Target),
                          new Decorator(r => (r as SpellRangeCheck?) == SpellRangeCheck.ErrorNotInRange, new Action(r => Navigator.MoveTo(Core.Target.Location))),
                          Cast("True Thrust", r => (r as SpellRangeCheck?) == SpellRangeCheck.Success || (r as SpellRangeCheck?) == SpellRangeCheck.ErrorNotInFront));
                  }   
              }
      
      and in the settings I have PullSpell as a public bool where true is using true thrust and false is piercing talon ... It seems to not be working correctly. Any thought?
       
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      CreatePull is called once and then the composite it returns is used over and over. You need modify more then just what spell to choose and add to the behavior tree.
       
    3. Beast

      Beast Member

      Joined:
      Apr 22, 2010
      Messages:
      618
      Likes Received:
      6
      Trophy Points:
      18
      Thanks for the reply! Unfortunately I don't have the knowledge of C#. Could you give an example?
       
    4. Twist

      Twist Community Developer

      Joined:
      Oct 15, 2010
      Messages:
      643
      Likes Received:
      31
      Trophy Points:
      28
      instead of using CLR code like " if (settings.PullSpell == false)" use the Behavioral Trees the way they are meant to be used. Something like "new Decorator (r=> !settings.PullSpell, new PrioritySelector (... etc" also remember that BTs use a succeed/fail status check. If a delegate function succeeds it will stop running the rest of the branch. Read up on BTs.
      Good luck.
      Twist
       

    Share This Page