I know how to use the try and catch for c# to help handle errors, but if there something similiar to this for the behavior tree. The problem I am having is the botbase I am working on watches party members, and arguments like StyxWoW.Me.PartyMember1.Combat upchucks as soon as PM1 is out of range of detection, and will not fix itself untill you restart HB totally. Is there some way to prevent the up-chuck-ed-ness?
Maybe you could do this instead new DecoratorContinue(ret => StyxWoW.Me.PartyMember1 != null, new Decorator(ret => StyxWoW.Me.PartyMember1.Combat...etc just an idea, i havnt worked my way around partymembers
I have tried that, the problem is PM1 exists, but is not close enough to be able to tell the status of them. so what you put above comes back true because pm1 is not null, but thats all HB can tell. Flippen annoying.
I have tried != null, isvalid, and everything else I can find along those lines, nothing. and it errors out when I try to use the try/catch thing because of the way behavior trees work. Blargh!
Default decorators just take delegates as their params for ctors. The syntax you're using is called a "lambda". It's just a shortcut for an anon delegate. Create one yourself with full error handling. Code: new Decorator(delegate(object context){ try { return Me.Blah.Blah; } catch { return false; } }, new Action(ret=>DoSomething()))
I appreciate the help Apoc. Ill give that a shot. Im still learning this as I go. I got a pretty good handle on the C# thing (As far as HB is concerned), but I got a lot to learn about behavior trees.