To defeat the Rancor at Jabba's palace, use R2-D2 on the pad under the pipe to let a pig guard out. The Rancor will grab it and sit in an alcove next to a bomb. Blow up the bomb to hurt it. Do this one more time then let another guard out. The Rancor will take his new snack into his cage, then use R2-D2 to close the gate.