Page 1 of 2
Brains
Posted: Tue Oct 28, 2014 9:45 pm
by JKos
I just leave this here
Code: Select all
defineObject{
name = "herder_ai_test",
baseObject = "herder",
components = {
{
class = 'Brain',
onThink = function(self)
self:turnLeft()
end,
onThinkSpecial = function(self,arg1,arg2,arg3)
self:turnRight()
end,
}
}
}
Let the brain surgery begin.

Re: Brains
Posted: Tue Oct 28, 2014 10:07 pm
by Prozail
I've been playing around with that thing lots yesterday.. still havn't gotten very far.
I tried to get a herder to go pull a lever when they spot the party, but it seems it's more complicated than i first thought.
Some of the basic herder stuff (like chasing after the party) i couldn't get rid of, so it kindof conflicted with moving toward a lever.... then i went on trying the tricksterbrain instead and that got REALLY messy.
Re: Brains
Posted: Tue Oct 28, 2014 10:51 pm
by Isaac
Hopefully we will get a plain text version of the Trickster brain in the asset pack, or perhaps Petri will post snippets of it in this thread.

Re: Brains
Posted: Tue Oct 28, 2014 10:54 pm
by JKos
This script makes the herder_test move to the lever_1 after it has seen the party.
Code: Select all
defineObject{
name = "herder_test",
baseObject = "herder",
components = {
{
class = 'Brain',
onThink = function(self)
if self.partyLastSeen ~= 0 then
self:goTo("lever_1")
end
end
}
}
}
Harder can't operate devices, it doesn't have the animation for it.
Re: Brains
Posted: Tue Oct 28, 2014 10:59 pm
by Isaac
JKos wrote:Harder can't operate devices, it doesn't have the animation for it.
That can change... but we might not want that with herders; other monsters though.

Re: Brains
Posted: Tue Oct 28, 2014 11:05 pm
by Prozail
ooo. nice one!
I'll have to try that tomorrow. I totally missed the "goTo" function.
i was playing around with giving it the MonsterOperateDeviceComponent, and pointed the animation to the attack anim.... and got it to actually play that once i managed to lure it over to a lever..
so.. lets see tomorrow

Re: Brains
Posted: Tue Oct 28, 2014 11:09 pm
by sps999
Code: Select all
onThink = function(self)
self:flee()
end,
Code: Select all
function speedUp()
herderTest.move:setCooldown(0)
herderTest.move:setAnimationSpeed(5)
herderTest.turn:setCooldown(0)
herderTest.turn:setAnimationSpeed(5)
end
speedUp()
Runaway herder coming through.
Would be cool to hook this up to occur when the herder is on fire, seeing as there is a "BurningMonsterComponent". No idea how to handle that one though.
Re: Brains
Posted: Tue Oct 28, 2014 11:16 pm
by Eleven Warrior
If you placed a floor trigger in front of the lever_2 which activates a Script, which the floor trigger is activated by Monster only, the door could open I think? I don't know the Script for this.
Re: Brains
Posted: Tue Oct 28, 2014 11:21 pm
by JKos
Well you can do it by scripting for example like this:
herder_ai_test script entity
Code: Select all
state = "begin"
function onThink(self)
if state == "begin" and self.partyLastSeen ~= 0 then
if self:goTo("lever_1") then
state = "operate"
end
end
if state == "operate" then
lever_1.lever:toggle()
state = "end"
end
end
just call herder_ai_test.script.onThink(self) from the onThink hook. But floor trigger works too of course.
Re: Brains
Posted: Tue Oct 28, 2014 11:30 pm
by Doridion
JKos wrote:Harder can't operate devices, it doesn't have the animation for it.
Haven't got the animation, but seems got the .Operate("") function ( Thanks for all componements JKos

).
Is something like :
Code: Select all
defineObject{
name = "herder_test",
baseObject = "herder",
components = {
{
class = 'Brain',
onThink = function(self)
if self.partyLastSeen ~= 0 then
while lever_1.getPosition ~= self.getPosition do
self:goTo("lever_1")
else
self:Operate("lever_1")
end
end
end
}
}
could be better ?