Causing actors to become non-movable once hit

I'm making a game and am trying to make blocks become non movable when they hit another block, however the movable attribute cannot be changed in game so i am not sure how to stop them moving (i have gravity acting on them).
Comments
One workaround is a bit of a pain which I don't think you'll like much, especially if this is going to be happening all the time in your game; still here it is:
Make 2 integer attributes called MBx and MBy, and a boolean, ReplaceB01.
Let's call your first moving block MoveBlock for this example. Make a copy of MoveBlock in the scene but put outside of the screen area. Make it an instance (unlock it's Rules). Make it non-moveable. Delete any Rules that might be there; put
When ReplaceB01 is true
Change Attribute self.Position.x to MBx
Change Attribute self.Position.y to MBy
When the first moveable block is collided with, in its Rules:
Change attribute ReplaceB01 to true
Change Attribute MBx to self.position.x
Change Attribute MBy to self.position.y
Destroy attribute
The above is off the top of my head and so is untested and might need tweaking a bit, but the basic principal is there. For instance, in the non-moveable version, you can still put collision Rules.
A variation is to have the immovable block replace the moving one with a Spawn Behavior.
Can't think of anything more straightforward at the moment, maybe another member will; fingers crossed.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
when block is hit
constrain attribute motion to 0
though when the block is hit by another block the movement seems to be transferred or the weight of the other blocks causes the initial block to move.
For interest, why are you constraining motion to 0, and not using Change Attribute?
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
You could destroy the actor and spawn an unmovable actor in its place?
;-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps