This stuff is a little beyond me, but the first part looks like nothing more than automated console commands creating units in particular cities. The unit size stuff in the second part looks like it assigns bodyguard units. I would try these in the console and see what they do but as I said, I believe these are just army generation instructions for whatever campaign you are playing. The not LocalFaction/is LocalFaction stuff is assignment between the Player and the AI ( is = Player, not = AI). Good Luck!