If you want to make the phases of the attack move onwards when bosshp reaches a certain threshold, then just put each phase in a loop while the bosses' health is above a certain threshold.
Working from Sparen's earlier example:
task mainTask {
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {
//Phase 1 last until the boss's life gets below 3000
while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 3000) {
loop(6) {
ascent(i in 0..36) {
ascent(j in 0..4) {
CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2 + j/4, GetAngleToPlayer(objBoss) + 360/36*i, 4, 5);
}
}
wait(20);
}
}
wait(120);
//Phase 2
//If there were a third phase when the boss got to, say, 1500 health, you'd just put a similar while loop around Phase 2 as well
let randangle = rand(0, 360);
ascent(i in 0..120) {
loop(4) {
CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 1 + i/30, randangle, 6, 5);
randangle += 360/4;
}
randangle += 7.1 + i/30;
wait(2);
}
wait(120);
}
}
Its also usually a good idea to have the pattern skip straight to the last phase if the player takes too long to clear it, like how Boundary of Life and Death works if you try to time it out. That can be accomplished by just adding a time condition to each phase's while loop.