Understanding Monster Brains

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Understanding Monster Brains

Post 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 :)
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Understanding Monster Brains

Post 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 . :D
The block looks like this now:
SpoilerShow

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
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Understanding Monster Brains

Post 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 :D
Akroma
Eburt
Posts: 69
Joined: Thu Feb 05, 2015 5:44 am

Re: Understanding Monster Brains

Post 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.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Understanding Monster Brains

Post 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 :D
Post Reply