Jump to content

How to modify the DoAction node in a brain?


Recommended Posts

I'm trying to make a mod that fixes molebrain's running into walls all the time, but I can't seem to modify the DoAction that tells them to make a new home. 

 

If I use the exact same code, but use it to change a WhileNode instead of a DoAction, it works perfectly, but DoAction nodes seem to be quite substantially different from WhileNodes. So how do I change what a DoAction node does?

Link to comment
Share on other sites

well, a Whilenode is just a node that keeps doin a subnode, als long as a condition is met, a doaction node on the other hand is a node that does an action.

if u want to study the code, Whilenode is in behaviourtree.lua and doaction is in doaction.lua.

the problem with them hitting the walls is probably, that they dont use intelligent pathing, when they try to do an action via doaction. they however use intelligent pathing with other behaviours, like the follow.lua behaviour. so u could probably just program a behaviour that is similiar to the follow-behaviour, but which lets him move to the nearest home, and then, when he is next to it, just let him do the regular GoHomeAction.

Link to comment
Share on other sites

I did manage to figure it out. A WhileNode function is accessed by node.fn, while a DoAction node function is in node.getactionfn. I didn't notice that, and assumed that any node's function would be in node.fn. 

 

 

I've currently fixed the issue by making them set up a new home directly where they are, but the plan for the future is to just make them wander for a bit, and then set up a home wherever they end up. But I'm gonna figure out how to do that tomorrow. I've got a couple other things I wanna work on today.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...