Changing the height during auto mode

Hey guys,

I’m building a solar powered airplane and would like to fly a complex mission.

The airplane should circle the whole time, but change the flying high in condition to the battery level. If the battery is fully charged the airplane should increase every circle the height until it reaches a pre defined max altitude. When the battery level is under a specific value the plane have to decrease. Otherwise the circle height should be constant.

Of course such a function isn’t built in arduplane, that’s why i would like to change the code.

Are there any tutorials for building such “complex” missions.