Searchable objects on top of each other

I want to place 5 crates in a room.
the crates must be openable and searchable.
they need to be stack randomly on top of each other.
each crate will have interactable content inside but that also needs to be placed randomly inside the crates.

the player should have the option to remove the top crates to be able to search the bottom crates.

I managed to get 5 crates in a location but can only have one selected crate on top of another selected crate and place objects in selected crates before hand. But as you can see that is not what I want and i am battling to get it right.

Can you share the code you have tried already?

1 Like
Crate 1 is a container in the Alleyway. It is openable and closed.
Crate 2 is a container in the Alleyway. It is openable and closed.
Crate 3 is a container in the Alleyway. It is openable and closed.
Crate 4 is a container in the Alleyway. It is openable and closed.

There is a enterable container called Crate4's interior. [interior]
It is part of Crate 4.
Crate 4's top is a supporter.
There is a supporter called Crate 4's top.
Crate 5 is a container on Crate 4's top in the Alleyway. It is openable and closed. It is lockable and unlocked. 	

Instead of taking Crate 4:
	say "I need to take the top crate of the bottom crate.". 
	
Instead of opening Crate 4:
	if player is not carrying Crate 5:
		say "There is something on top of this crate.";
	else if player is carrying Crate 5:
		say "You open the bottom crate.";
		now Crate 4 is openable;
		continue the action.