What is a "blocker"? It is getting auto-spawned at exits

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!
Post Reply
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

What is a "blocker"? It is getting auto-spawned at exits

Post by MrChoke »

I spent lots of time wondering why my code was failing to make a path to one of the forest_exits at times. I came to realize that "at some point" in the game's initialization, the squares right in front of exits start giving values of "true" for map:isBlocked(). Even though, the square is NOT blocked by anything I placed in the editor or spawned. I can walk on the square as well. Calling entitiesAt() on the square revealed that the game itself is spawning an entity called "blocker" there. Ok.... why? I guess I have seen monster AI behavior always avoid the squares in front of exits and I never knew why. Maybe this is why? The "blocker" square blocks mobs but not the party? Is that its purpose?

I am about to try to see if I can destroy this upon game start. Hopefully I can.

UPDATE:
So I can destroy the blocker via script which is good. And yes, it is this object that blocks monster movement. However, I still don't see its purpose. If the intent is to keep the mobs off the exit, that happens anyway since the exit is an obstacle. I had to uncheck "obstacle" on the exit and destroy the blocker and then a monster can enter the exit square. NO, he didn't leave the level (BUMMER). He just acts like its another square it seems.
Last edited by MrChoke on Sun Nov 30, 2014 1:56 am, edited 1 time in total.
Kaliflour
Posts: 3
Joined: Sat Nov 29, 2014 6:20 pm

Re: What is a "blocker"? It is getting auto-spawned at exit

Post by Kaliflour »

I've been tinkering with the editor, and yes, it appears blockers are meant to stop monsters from entering certain squares. You can activate/deactivate blockers you place yourself, but I'm not sure about the auto-spawned ones.
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: What is a "blocker"? It is getting auto-spawned at exit

Post by Isaac »

Calling entitiesAt() did not work for me; I had assumed they had removed it... just like allEntities(). :shock:

I get the error for calling an assumed global that is nil.

What's the working syntax that you used, if you don't mind? 8-)
MrChoke
Posts: 324
Joined: Sat Oct 25, 2014 7:20 pm

Re: What is a "blocker"? It is getting auto-spawned at exit

Post by MrChoke »

Isaac wrote:Calling entitiesAt() did not work for me; I had assumed they had removed it... just like allEntities(). :shock:

I get the error for calling an assumed global that is nil.

What's the working syntax that you used, if you don't mind? 8-)
entitiesAt() is now a function on the map object. Once you have access to a map object, you will need to iterate thru what is returned. Example:

Code: Select all

local entTbl = party.map:entitiesAt(15, 15)
for ent in entTbl do
    print(ent.name)
end
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: What is a "blocker"? It is getting auto-spawned at exit

Post by Batty »

It's probably there because monsters would follow you and coagulate on the last square before exit.

Then you could exit and reenter on top of them thus killing them all just as when you teleport onto a monster. :)
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: What is a "blocker"? It is getting auto-spawned at exit

Post by Isaac »

MrChoke wrote:
Isaac wrote:Calling entitiesAt() did not work for me; I had assumed they had removed it... just like allEntities(). :shock:

I get the error for calling an assumed global that is nil.

What's the working syntax that you used, if you don't mind? 8-)
entitiesAt() is now a function on the map object. Once you have access to a map object, you will need to iterate thru what is returned. Example:

Code: Select all

local entTbl = party.map:entitiesAt(15, 15)
for ent in entTbl do
    print(ent.name)
end
Thank you. 8-)

* :mrgreen: I just discovered this in the script ref, minutes ago, and rushed back to edit my post.

[AFAIK], Monsters do not trigger the exits, but the effect can be simulated with teleporters... best to start the tunnel/exit model one or more tiles in from the wall, so that the monster is in the tunnel before they just pop away (vanish); but it does work ~albeit with a telefrag risk. I would expect that even the fades can be faked with the GameMode.fadeOut function call.
Post Reply