###Sets scoreboards used for progression during the invasion###
scoreboard objectives add nitInvadeProg dummy

###Places and grounds markers for static invasion structures, unless an invasion is in progress###
execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -82 90 0 {Tags:[nitEntity,nitEntityTechnical,nitPlanarPortal,smithed.entity,smithed.strict]}
execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -60 70 -40 {Tags:[nitEntity,nitEntityTechnical,nitPlanarPortal,smithed.entity,smithed.strict]}
execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -60 70 40 {Tags:[nitEntity,nitEntityTechnical,nitPlanarPortal,smithed.entity,smithed.strict]}

execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -50 70 0 {Tags:[nitEntity,nitEntityTechnical,nitDrillStation,nitInvadeMarker,smithed.entity,smithed.strict]}

execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -18 70 23 {Tags:[nitEntity,nitEntityTechnical,nitObelisk,nitInvadeMarker,smithed.entity,smithed.strict]}
execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker 19 70 -27 {Tags:[nitEntity,nitEntityTechnical,nitObelisk,nitInvadeMarker,smithed.entity,smithed.strict]}
execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker -11 70 -17 {Tags:[nitEntity,nitEntityTechnical,nitObelisk,nitInvadeMarker,smithed.entity,smithed.strict]}

execute in minecraft:the_end unless entity @a[scores={nitInvadeProg=1..}] run summon minecraft:marker 25 70 0 {Tags:[nitEntity,nitEntityTechnical,nitRWither,nitInvadeMarker,smithed.entity,smithed.strict]}

execute as @e[tag=nitInvadeMarker] at @s unless entity @a[scores={nitInvadeProg=1..}] run spreadplayers ~ ~ 0 1 false @s

###Starts first invasion stage###
execute unless entity @a[scores={nitInvadeProg=1..}] run scoreboard players set @a[predicate=nitref:end_dimension] nitInvadeProg 1