Complex sentence: He fought in the Battle of Almenar against by Count Guido Starhemberg in 1710 being captured and locked in prison till 1712, time he used to prepare the State organizational structure of all the Engineering Works to be undertaken in different kingdoms under Spanish sovereignty.
Split into simpler sentences: He fought in the Battle of Almenar against Count Guido Starhemberg in 1710, where he was captured. He was imprisoned until 1712, time he used to prepare the State organizational structure of all the Engineering Works to be undertaken under Spanish sovereignty.