
#summon golem x and y are random values
#$execute as @e[sort=random,limit=1,tag=enemies_spawnpoint] at @s run 
summon iron_golem ~ ~1 ~ {PersistenceRequired:1b,attributes:[{id:"minecraft:step_height",base:1},{id:"minecraft:follow_range",base:50},{id:"minecraft:attack_damage",base:0},{id:"minecraft:knockback_resistance",base:1000},{id:"minecraft:movement_speed",base:0},{base:1000,id:"max_health"},{base:10000,id:"armor"},{base:10000,id:"armor_toughness"},{base:1000,id:"max_health"}],ArmorItems:[{},{},{},{}],CanPickUpLoot:0b,CustomName:'{"text":"UK-4","color":"white"}',Health:1000.0f,Tags:["golem","enemy","newborn","medium","melee"]}


execute as @e[type=iron_golem,tag=newborn] run data modify entity @s CustomNameVisible set value 1b
#set id for stuff
scoreboard players set @e[type=iron_golem,tag=golem,tag=newborn,limit=1] id 14

##set level, health and id for newborn enemy
#set health
$scoreboard players set @e[type=iron_golem,tag=golem,tag=newborn,limit=1] health_max $(health)
$scoreboard players add @e[type=iron_golem,tag=golem,tag=newborn,limit=1] health $(health)

execute as @e[type=iron_golem,tag=golem,tag=newborn] run function main:game/mobs/spawn/scores

#enemy is not newborn now
tag @e[type=iron_golem,tag=golem,tag=newborn,limit=1] remove newborn