We investigate the origin of the abundance ratios and scatter of α− and neutroncapture elements of old, metal-poor stars, using hydrodynamical simulations of galaxy formation in a cosmological context. For this, we implement a novel treatment for the production and distribution of chemical products of Type II supernovae, which considers, on one side, the effects of the rotation of massive stars on the chemical yields and, on the other hand, the effects of the different life-times of stars that are progenitors of this type of supernovae. We first describe and test our implementation on idealized initial conditions of an isolated galaxy, and then focus on the stellar halo of a Milky Way-mass galaxy simulated in a cosmological context, studying the abundances and scatter of [O/Fe], [Mg/Fe], [Si/Fe], [Sr/Fe], [Eu/Fe] and [Ba/Fe]. Our model is able, for the first time in a cosmological simulation, to describe at the same time the low scatter in the abundances of α-elements and the higher scatter associated to neutroncapture elements in the halo stars, as suggested by observations of the Milky Way. We also reproduce the scatter observed in the [Sr/Ba] ratio, which is a direct consequence of the treatment of the fast-rotating stars and the dependence of the chemical yields on the metallicity, mass and rotational velocities. Our simulations show that such scatter patterns appear naturally if the difference life-times of stars of different mass -and therefore the time of their ejection -are properly described, without the need to invoke for additional mixing mechanisms or a distinct treatment of the α− and neutron-capture elements. Our results show that simulations of this type will help characterizing and identifying the past accretion debris as well as the pristine in-situ populations in the Galaxy unveiled by Gaia and spectroscopic data.