Wish there was more info on the Brain component
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Wish there was more info on the Brain component
Trying to figure out brain scripts and not getting it. I even just tried to make the trickster move by doing what AH did in the twigroot tunnels and it's still not working.
Floor trigger activates this;
function startTrickster()
if cell_trickster then
local brain = cell_trickster.brain
brain:enable()
cell_trickster.rangedAttack:disable()
end
end
So far so good, trickster is active and does not attack
Trickster brain script;
function think(self)
if self:here("floor_target") then
return self:performAction("escape")
else
return self:goTo("floor target")
end
end
Trickster won't go to the spot. Please help
Floor trigger activates this;
function startTrickster()
if cell_trickster then
local brain = cell_trickster.brain
brain:enable()
cell_trickster.rangedAttack:disable()
end
end
So far so good, trickster is active and does not attack
Trickster brain script;
function think(self)
if self:here("floor_target") then
return self:performAction("escape")
else
return self:goTo("floor target")
end
end
Trickster won't go to the spot. Please help
Re: Wish there was more info on the Brain component
add an underline to the 2nd "floor_trigger" line. Also, make sure your trickster is named cell_trickster.
Hope it works for you!
Hope it works for you!
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Wish there was more info on the Brain component
A few quick questions, though you probably are doing them right. You added the onThink() hook and the "think" function is being called correct?Soaponarope wrote:Trying to figure out brain scripts and not getting it. I even just tried to make the trickster move by doing what AH did in the twigroot tunnels and it's still not working.
Floor trigger activates this;
function startTrickster()
if cell_trickster then
local brain = cell_trickster.brain
brain:enable()
cell_trickster.rangedAttack:disable()
end
end
So far so good, trickster is active and does not attack
Trickster brain script;
function think(self)
if self:here("floor_target") then
return self:performAction("escape")
else
return self:goTo("floor target")
end
end
Trickster won't go to the spot. Please help
Second question, "floor_target" is an object ID and the object is on the same floor as Trickster?
Oh wait! You missed the underscore for "floor_target" in the goTo() line:
return self:goTo("floor target")
No underscore means it is not a valid ID and he won't go there.
NOTE: I hope its a fairly easy path to get to "floor_target". One thing I have found with the pathfinding AI is if its a complicated path, he can get stuck and not move at all.

- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Wish there was more info on the Brain component
You gotta be f#!king kidding me...
Thank you, it works.
Now to do what I actually want to have happen.
think was simply the name of the function, no onThink hook is needed when using think(self) on a monster brain
second question yes to both
Thank you, it works.

Now to do what I actually want to have happen.
think was simply the name of the function, no onThink hook is needed when using think(self) on a monster brain
second question yes to both

- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Wish there was more info on the Brain component
Had this working, then not...
Why is this working,
function think(self)
if self:here("trickster_lock_1") then
if cell_door_2.door:isOpen()then return self:performAction("escape")
else
return self:operate("trickster_lock_1")
end
else
return self:goTo("trickster_lock_1")
end
end
but not this,
function think(self)
if self:here("trickster_lock_1") then
if cell_door_2.door:isOpen()then return self:goTo("cell_trickster_target_1")
else
return self:operate("trickster_lock_1")
end
else
return self:goTo("trickster_lock_1")
end
end
Can you only use one goTo command?
Why is this working,
function think(self)
if self:here("trickster_lock_1") then
if cell_door_2.door:isOpen()then return self:performAction("escape")
else
return self:operate("trickster_lock_1")
end
else
return self:goTo("trickster_lock_1")
end
end
but not this,
function think(self)
if self:here("trickster_lock_1") then
if cell_door_2.door:isOpen()then return self:goTo("cell_trickster_target_1")
else
return self:operate("trickster_lock_1")
end
else
return self:goTo("trickster_lock_1")
end
end
Can you only use one goTo command?
Re: Wish there was more info on the Brain component
Both versions look ok. I don't know your map to know where this is going:
self:goTo("cell_trickster_target_1")
If that object is in a place he knows he cannot reach, he will ignore the command.
self:goTo("cell_trickster_target_1")
If that object is in a place he knows he cannot reach, he will ignore the command.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Wish there was more info on the Brain component
It is going to a place easy for him to get to. I even moved it 2 spaces away and it still wouldn't work. Positive there are no typos this time too.
Re: Wish there was more info on the Brain component
once makes one move towards "cell_trickster_target_1", he is no longer by the lock, and will start moving towards the lock instead.
Links to my YouTube playlist of "tutorials" and to my forum thread.
Re: Wish there was more info on the Brain component
OK, I see it now. Didn't before because lack of indention in the code (suggest usingSoaponarope wrote:It is going to a place easy for him to get to. I even moved it 2 spaces away and it still wouldn't work. Positive there are no typos this time too.
Code: Select all
So your code has the trickster moving toward the lock until he reaches it (here() returns true). However, it is in this condition that you then tell him to move toward target one. As soon as he steps off the square where the lock is, here() is false again and he turns around and moves right back to the lock.
You need to change the code to have him moving toward target without having to be at the lock first.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: Wish there was more info on the Brain component
Hmm, thanks guys I see what you mean.
My idea involved going from one spot to another so he would have to be at a previous spot first. I may just keep this brain stuff simple since more complicated scripts are a pain for me without scripting experience.
Really like the editor though and learn something new each time.
My idea involved going from one spot to another so he would have to be at a previous spot first. I may just keep this brain stuff simple since more complicated scripts are a pain for me without scripting experience.
Really like the editor though and learn something new each time.