Code: Select all
function running(){
$c = 0;
$visionCheck = rand(1,100); //Do a vision check, look for open gap if passed, go to play gap if its open, otherwise go to another gap. If failed, go to a random gap.
if(($oPlayer[23]+ $oPlayer[7])/2 >= $visionCheck){ //If the player passes the vision check
for($i=0; $i > $gap.length; $i++){ //Loops through the gaps
if($gap[$i] == $play[1]){ //Checks if the gap being looped through matches the designed play gap
if($gap[$i] == 'open'){ //If the gap that matches the play gap is open
//Go there
}elseif($gap[$i] == 'partial'){ //If the play gap is partially open
//Go there
}elseif($gap[$i] == 'closed'){ //If the play gap is closed
$c = 1; //End check for play-gap.
}
}
}elseif($gap[$i] != $play[1]){ //If the gap doesn't match the play-gap. The check for the play gap should ALWAYS come first
if($c == 1){ //I made $c = 1 to terminat the play-gap loop through. If $C is not 1, that means the runner has an open/partially open gap on the play gap and should go there
if($gap[$i] == 'open'){ //If the first gap is open, go there
//Go there
}elseif($gap[$i] == 'partial'){
//Look for others, then go there if nothing else. Best option is to have an open gap, but 2nd best is partial. This is part where I need help, how to check all of the opens first and then check for partials.
}elseif($gap[$i] == 'closed'){
//If every gap is closed, go to the play-gap. How do I make this happen?
}
}elseif($c == 0){ //If the play-gap has not been checked, add to $i to get to the playgap.
$i++;
}
}elseif(($oPlayer[23]+ $oPlayer[7])/2 < $visionCheck){ //If the player doesn't pass the vision check
$failedCheck = rand(1,$gap.length);
//go to failedCheck gap. Random gap.
}
}