function random(ary){
    return ary[Math.floor(Math.random()*ary.length)];
}

onEvent('entity.spawned', event => {
    if(event.entity.isMonster()) {
    
	var atLeastOne = false;
    event.world.players.forEach((player) => {
	if(player.stages.has("curse_ants")) {
    atLeastOne = true;
	}
	});
  
        if(atLeastOne) {
        event.server.scheduleInTicks(10, cb => {
        
        var UUID = event.entity.getFullNBT().UUID;
      
      event.server.runCommandSilent('data merge entity @e[nbt={UUID:'+UUID+'},limit=1] {"pehkui:scale_data_types": {"pehkui:width": {initial: 0.5f, scale: 0.5f, target: 0.5f}, "pehkui:height": {initial: 0.5f, scale: 0.5f, target: 0.5f}}}');
    });
    }
}
});