Approach the palace door. When you approach the motion detectors, three turrets will appear (to "wake up" the upper one, you have to build a platform from the bricks laying around). Destroy they and the gate will be opened. Reach the end of the starting corridor, fighting off the guards, and then turn left. Use the helmet dispenser (this time it's the bounty hunter's helmet) and approach the door. In the next room close all the pipes that the pig-guards are coming out of, and then open the next door. It you need to, go back for the helmet.
When you're in the next room, destroy the device to the right and make a platform out of its remains. As Luke use the Force to move one of the other characters up, and then go through the door he opened. You'll destroy the junk that's blocking the way by using the detonator (all characters can throw them while wearing bounty hunter helmets).
Destroy the orange weights that keep the gate closed. Go forth, watching not to fall down through one of the holes in the bridge. Now you have to free the droids. Use both levers to the right and build buttons from the bricks that fell out of the mechanism. Use the Force on the bricks to the left and use the bricks you pulled out of the wall to construct a moving platform. Use the buttons you created to steer its movement. Place it near 3PO cell and switch to Luke to jump into it, that will free the droid. Do the same with R2 and then use both droids to open the door.
Go up the stairs. If you build a jukebox along the way, you'll disable the guards. Up there there's a panel for R2. In the next room start with blocking the pipes that guards come out of, and then push the three platforms so that they form stairs. Use the Force on them to create a footbridge. Destroy the crate and build a bridge of what's left of it. You can now close the final pipe. Switch to R2 and hover to the left, then using the panel. Construct another panel for 3PO and use it.
Close all the pipes again. Kill all the guards that remain alive and approach frozen Han Solo. Go back for a Bounty Hunter helmet and use the panel near him. Time to fight Rancor.
The procedure is quite clear. There are droid-operable panels on both sides of the cave that summon Gamorrean guards. Whenever you summon one of them, Rancor will stop the fight and decide to eat him. Take advantage of it and smash one of the explosive crates laying around (the one that the beast is standing near to). Repeat the thing once more. When Rancor eats the third guard, he stands under the metal gate - use levers on both sides of it to kill him.