Make a global variable which is default set to true, something like (bossname)dead, on spawning the boss set the variable to false and when the boss dies set the variable back to true. Then on minion tick update check whether variable = true, if so make invulnerable/invincible. This only works if there is going to be one boss at a time, if there could possibly be more than one at a time it won't work, you would need to make it more complicated using nbt data most likely.
To make the minion invincible you can either keep healing it as it takes damage. Or you could create two entities one which is invulnerable to all damage types and another which isn't. On variable = false, despawn invincible entity and spawn the normal minion entity. There may also be a procedure block to make an entity invincible that I do not know of.
Make a global variable which is default set to true, something like (bossname)dead, on spawning the boss set the variable to false and when the boss dies set the variable back to true. Then on minion tick update check whether variable = true, if so make invulnerable/invincible. This only works if there is going to be one boss at a time, if there could possibly be more than one at a time it won't work, you would need to make it more complicated using nbt data most likely.
To make the minion invincible you can either keep healing it as it takes damage. Or you could create two entities one which is invulnerable to all damage types and another which isn't. On variable = false, despawn invincible entity and spawn the normal minion entity. There may also be a procedure block to make an entity invincible that I do not know of.