Jump to content

Bug with RandomNode in BehaviorTree


Recommended Posts

I'm writing an AI for Dont Starve and trying to use the RandomNode functionality in the Behavior Tree....only when I do, I get the following error:

../mods/ArtificalWilson/modmain.lua(11,1) Enabling Artifical Wilson	...ps/common/dont_starve/data/scripts/behaviourtree.lua:456: variable 'inst' is not declared...

So, I open up BehaviorTree and find the RandomNode section and sure enough, there is a few cases of inst.blah when it should be self.blah.

 

The bug report forum seems like it is only suited for crashes that happen with the base game...so I'm posting it here. Maybe I should post it there instead...no idea.

 

On top of that, there is another bug in RandomNode. If the random returns the last element in the children, it will crash as it increments past the boundary. Namely, the code at line 468:

            self.idx = self.idx + 1               if self.idx == #self.children then                self.idx = 1            end

should be changed to:

            self.idx = self.idx + 1            if self.idx > #self.children then               self.idx = 1            end

After these 2 changes, RandomNode works :)

 

Current Dont Starve Version: 

 

Rev. 151567

2015-09-29_17-37-18

17:40:29

Link to comment
Share on other sites

Yeah, there's some parts of the game that seem functional until you try to use them and realize that everything in the game works around them because they don't work properly... Cooldown component for instance.

 

I really hope the devs revise the base game for such minimal code changes.

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