I'm new to WeBWorK, so don't know all the variables we can access. I'm guessing (hoping) there must be a variable we can access that tells whether or not the first section is complete. Might anyone know if this is true, and if so, what that variable is? Assuming a boolean variable $section1Correct, you could then try something like this:
$numOfAttemptsSection1 = 999; #some number of tries you hope students never reach
$x = 3; #number of attempts on second part before showing hint
if ( ($numOfAttemptsSection1 == 999) && $section1Correct) {
$numOfAttemptsSection1 = $numOfAttempts;
$showHints=$numOfAttemptsSection1 + $x;
}
$numOfAttemptsSection1 = 999; #some number of tries you hope students never reach
$x = 3; #number of attempts on second part before showing hint
if ( ($numOfAttemptsSection1 == 999) && $section1Correct) {
$numOfAttemptsSection1 = $numOfAttempts;
$showHints=$numOfAttemptsSection1 + $x;
}