Jump to content

Can I Insert a BehaviorNode to a BehaviorTree?


Recommended Posts

I want to add a Follow BehaviourNode to Koalefant. I don't want to completely overwrite the entire koalefantbrain, so I'm trying to do this with a AddBrainPostInit, but I cannot for the life of me get it to work. How can I do this?

GLOBAL.require "behaviours/follow"

AddBrainPostInit("koalefantbrain", function(brain)
  table.insert(braint.bt.root.children, Follow(brain.inst, function(inst) 
    return inst.components.follower.leader 
  end, 2, 5, 9))
end

This blows up when I try to load a world with the message:

Quote

[string "../mods/koalefant/modmain.lua"]:91: attempt to call global Follow (a nil value)
LUA ERROR stack traceback:
  ../mods/koalefant/modmain.lua:91 in (local) modfn (Lua) <9-97>
  scripts/brain.lua:200 in (method) Start (Lua) <187-203>
  scripts/entityscript.lua:824 in (method) RestartBrain (Lua) <817-827>
  scripts/mainfunctions.lua:427 in () ? (Lua) <414-443>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...