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?
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.
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