Page 2 of 2
Re: Understanding Monster Brains
Posted: Fri May 08, 2015 3:52 pm
by alois
Consider also using "monster.go.brain:seek(24,17)" as a faster way to send the monster to (24,17) (i.e.: you do not need floor triggers). Once the monster is arrived at destination, the "seek" part is no longer called, so that the "here" part can be omitted.
If you like, you can PM me the whole script so that I can check it.
Alois

Re: Understanding Monster Brains
Posted: Sat May 09, 2015 12:06 am
by Duncan1246
alois wrote:Consider also using "monster.go.brain:seek(24,17)" as a faster way to send the monster to (24,17) (i.e.: you do not need floor triggers). Once the monster is arrived at destination, the "seek" part is no longer called, so that the "here" part can be omitted.
If you like, you can PM me the whole script so that I can check it.
Alois

Thanks for this, it's shorter, and also it's the solution of the puzzle. The issue with goTo() imo is that monster go to coordinates AND facing of the floor_trigger. This explains that some blocks works and others not: I change the facing of floor_trigger and the issue disappears. It explains also why I have observed a second phase in turning movement: after turnTowardsParty(), the first action goTo(ft) is done a second time to align facing of the monster with the floor_trigger!
So seek() is the true solution .

The block looks like this now:
Code: Select all
if posX==24 and posY==17 and fac==1 and acted~=8
then
monster.go.brain:seek(23,18)
if monster.go.x==23 and monster.go.y==18 then
monster.go.brain:turnTowardsParty()
if monster.go.facing==(fac+2)%4 then
acted=8
end
end
end
Re: Understanding Monster Brains
Posted: Mon Jun 15, 2015 6:03 pm
by akroma222
Great thread here guys, Im working on the same stuff too.
This is exactly what I was hoping I would find,
I will share some brainy scripty things with you all as soon as I got something decent happening
Akroma
Re: Understanding Monster Brains
Posted: Tue Jun 16, 2015 12:37 am
by Eburt
FYI, there was another interesting thread on this topic
which can be found here.
That thread explains using the return syntax with the brain functions, which makes a lot of what is in the OP obsolete. It still works, but there are much better ways of doing it (that thread even has an example of the turtle brain - which will show how much simpler it is). This also enables use of the wait function properly in an onThink hook in a predefined brain and makes it pretty much pointless to redefine the existing brains. The only downside here is that many of those commands have built-in logic which can't be edited (e.g., calling MeleeAttack() requires that the party be directly in front of the monster). Of course, you can use PerformAction(...) to get around this, but then you are back to having to manually program a lot of logic (oh, and the attack still won't hurt anything but the party so... yeah).
At some point, I was hoping to upload some more relevant examples and update the OP, but at this point I haven't had the time/motivation. If you have some examples Akroma, they would be much appreciated.
Re: Understanding Monster Brains
Posted: Tue Jun 16, 2015 1:09 am
by akroma222
Yes! Im also reading through that thread...
Yeah there is a lot of braining to do, even for the very simple things we take for granted..
But even so, we can use damage tiles or spawn projectiles on enemy spaces when they are being instructed to beat each other up..?
Ive been making my crab run around attacking breakable barrels and then just blowing them up as he strikes each one
Both threads are very helpful, I will be able to post something more complete soon
