Jump to content

Recommended Posts

 I did check the apiexamples, but I didn't find the answer there, or at least didn't make it out.

function PerdBrain:OnStart()    local clock = GetClock()        local root = PriorityNode(    {        WhileNode( function() return self.inst.components.health.takingfiredamage end, "OnFire", Panic(self.inst)),        WhileNode(function() return clock and not clock:IsDay() end, "IsNight",            DoAction(self.inst, GoHomeAction, "Go Home", true )),        DoAction(self.inst, EatFoodAction, "Eat Food"),        RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST, STOP_RUN_DIST),  --I want to override this line        DoAction(self.inst, PickBerriesAction, "Pick Berries", true),        Wander(self.inst, HomePos, MAX_WANDER_DIST),    }, .25)        self.bt = BT(self.inst, root)end

How do I access the node and edit the specified line via modmain?

Link to comment
https://forums.kleientertainment.com/forums/topic/42170-how-to-manage-a-brain/
Share on other sites

 I did check the apiexamples, but I didn't find the answer there, or at least didn't make it out.

function PerdBrain:OnStart()    local clock = GetClock()        local root = PriorityNode(    {        WhileNode( function() return self.inst.components.health.takingfiredamage end, "OnFire", Panic(self.inst)),        WhileNode(function() return clock and not clock:IsDay() end, "IsNight",            DoAction(self.inst, GoHomeAction, "Go Home", true )),        DoAction(self.inst, EatFoodAction, "Eat Food"),        RunAway(self.inst, "scarytoprey", SEE_PLAYER_DIST, STOP_RUN_DIST),  --I want to override this line        DoAction(self.inst, PickBerriesAction, "Pick Berries", true),        Wander(self.inst, HomePos, MAX_WANDER_DIST),    }, .25)        self.bt = BT(self.inst, root)end

How do I access the node and edit the specified line via modmain?

It is in some api examples, but that is quite complicated to do with mod api. I ended just replacing whole brains with prefab post inits.

It is in some api examples, but that is quite complicated to do with mod api. I ended just replacing whole brains with prefab post inits.

 

Would the correct way of doing it be like this? Just so they have the same name?

function OnStart() thingsendAddBrainPostInit("perdbrain", OnStart)

 

Would the correct way of doing it be like this? Just so they have the same name?

function OnStart() thingsendAddBrainPostInit("perdbrain", OnStart)

 

You just make prefab postinit of the Gobbler itself setting new brain there, and make whole new brain file.

 

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
×
  • Create New...