pushable_block_floor (Solved)

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
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

pushable_block_floor (Solved)

Post by Dunkler »

Hello

I made pushable_block_floor that can be with light or without light (activated/deactivated)

My Question is how can i check if they are lit or unlit in a script?

I tried it with a counter but it didnt work.

For example. I want a door to open if all 8 pushable_block_floors are with light.
Last edited by Dunkler on Tue Dec 16, 2014 3:17 pm, edited 2 times in total.
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: pushable_block_floor_trigger

Post by Dunkler »

I tried something like this

But since im a scripting noob...i dont know what i am doing wrong

function pushable()
if pushable_block_floor_1.PushableBlockFloor:isActivated() and pushable_block_floor_2.PushableBlockFloor:isActivated() and
pushable_block_floor_3.PushableBlockFloor:isActivated() and pushable_block_floor_4.PushableBlockFloor:isActivated() and
pushable_block_floor_5.PushableBlockFloor:isActivated() and pushable_block_floor_6.PushableBlockFloor:isActivated() and
pushable_block_floor_7.PushableBlockFloor:isActivated() and pushable_block_floor_8.PushableBlockFloor:isActivated() then
dungeon_door_wooden_2.door:open()
else
dungeon_door_wooden_2.door:close()
end
end


i always get an error when i use the script in game. attempt to index field PushableBlockFloor (a nil Value) X
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: pushable_block_floor

Post by Soaponarope »

The error is because you want a pushable_block_floor_trigger, they allow for connectors.
Scotty
Posts: 69
Joined: Fri Nov 07, 2014 2:59 pm

Re: pushable_block_floor

Post by Scotty »

I haven't played around with pushable blocks at all, so I can't really provide a solution. But I can point out that in your script:

Code: Select all

pushable_block_floor_1.PushableBlockFloor:isActivated()
"PushableBlockFloor" shouldn't have any capitals. Should be:

Code: Select all

pushable_block_floor_1.pushableblockfloor:isActivated()
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: pushable_block_floor

Post by Grimfan »

I think

Code: Select all

pushable_block_floor_1.controller:isActivated()


is what you want though Scotty's suggestion could also work. I haven't tried it either.
Last edited by Grimfan on Tue Dec 16, 2014 12:34 pm, edited 1 time in total.
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: pushable_block_floor

Post by Soaponarope »

pushable_block_floor_trigger_1.floortrigger:isActivated()

.pushableblockfloor isn't a valid field
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: pushable_block_floor

Post by Grimfan »

If you are using normal floor blocks (the gray ones in the editor) and not the floor block triggers (the gold ones in the editor) then controller is the component you want (since the gray ones don't have a floortrigger component). I first thought you were talking about custom floor blocks you had created so I was slightly confused. :roll:

Of course this makes me wonder how you are activating your floor blocks in the first place?

And if you are using gold floor blocks that act like floortriggers just connect them to a counter individually (if you don't want to use a script). Set the counter to 8 and have each floortrigger decrement the counter. When the counter reaches 0 have it activate to open the door.

Also you can wait until a real scripter comes in and sees this thread, hits their forehead in exasperation, and promptly makes me look like a moron. ;)
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: pushable_block_floor

Post by Soaponarope »

Or I might be confused if he just wants to use the normal floor tiles. In that case the .controller should work. So one of those should do it.
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: pushable_block_floor

Post by Dunkler »

Hello Everyone. Thanks for the help! :)

pushable_block_floor_1.controller:isActivated()

works!

And yes your assumption was right. i didnt use the pushable-triggers because the puzzle i tried to make would not work with the triggers.
(the pushable-floors have to activate other nearby pushable floors)

Anyway. The puzzle works perfectly now :)

@ grimfan i tried to make the puzzle with a counter but it didnt work because the counter does not decrement if a pushable-floor is activated by a nearby pushable-floor.
It only decrements if i activate it directly by steping on it. And thats not what i tried to do.

Or maybe it would work with a counter-but i was just too stupid to do it right :D
User avatar
Halluinoid
Posts: 165
Joined: Tue Apr 02, 2013 7:08 pm
Contact:

Re: pushable_block_floor (Solved)

Post by Halluinoid »

great info but in my dungeon the team can't even push a block from one pushable tile to the next

the team touch the block, no reaction. what do they do to push the block?
Post Reply