Order is correct.
giveTech line should be
civ.giveTech(killed.owner,civ.getTech(LegionKilled[unitType].tech))
the homeCity=civ.getCity(Batavodurum) part is also wrong, but don't feel bad, since we need more machinery to get it right.
civ.getCity() converts an integer into the correct city object. We need a function that converts a string into the correct city object. In which case it would be homeCity=stringToCity("Batavodurum")
We can work around this by using the tile where the city should be to get the city.
local bataTile = {1,2,0}
local Batavodurum = civ.getTile(bataTile[1],bataTile[2],bataTile[3]).city
So, I think this would work
1. local bataTile = {1,2,0}
2. local Batavodurum = civ.getTile(bataTile[1],bataTile[2],bataTile[3]).city
3. civ.scen.onUnitKilled(function (killed, killedBy)
4. local unitType = killed.type.id
5. if unitType == 54 then
6. civ.ui.text(func.splitlines(LegioIText))
7. civ.giveTech (killed.owner, civ.getTech (LegionKilled[unitType].tech))
8. civlua.createUnit(civ.getUnitType(31),civ.getTribe(0), massacreLocations[31][1], {randomize=false, veteran=true, count=3, homeCity=civ.getCity(Batavodurum)})
9. end
10. end)
I suppose we could put lines 1 and 2 inside the civ.scen.onUnitKilled if we wanted to.
My only other concern is that you call civ.scen.onUnitKilled twice in your code. I don't know if this is a problem or not. We may have to bundle them all into one call to civ.scen.onUnitKilled by using a sequence of if statements.