In Return of the Jedi Luke doesn't really seem to be prepared when Jabba drops him into the Rancor pit. Jabba appears to get the better of Luke and trigger the trap door before Luke can fire on Jabba. In that fight with the Rancor, Luke seems to improvise a means of killing the Rancor in what appears to be a desperate fight.
In contrast, Luke seems to have been totally prepared to defeat Jabba at the Sarlacc Pit. R2-D2 is ready with his lightsaber, Lando has successfully infiltrated the guards, and even Leia appears to be poised to personally execute Jabba herself. The skirmish doesn't go 100% smoothly but with 0 casualties while facing a cadre of galactic underworld soldiers, it doesn't really go badly either. Luke appears to be fairly confident before the battle begins, pointlessly insisting on Jabba to surrender, even though Luke probably knows Jabba will not.
Or it is just luck and preparation that allowed the protagonists to pull off the operation?