So this section of the code would be all that is needed for implementing the creation of a "slave" unit under the unit that won a battle? It looks like the civ names need to be specified and if the unit is veteran that wins the conflict the chance for slave unit creation is 100%?
civ.scen.onUnitKilled(function (loser, winner)
if allStatics.SlaveryBoolean then
if not(civ.hasTech(winner.owner, objects.kSlaveryAbolition)) and winner.type.domain == 0 and loser.type.domain == 0 then
if winner == allVariables.unitDidAttack then
if loser.owner.name == "Zulus" or loser.owner.name == "Ethiopians" or loser.owner.name == "Malineses" then
if winner.veteran then
if math.random(100) <= allStatics.chanceForVeteranToGetSlaves then civlua.createUnit(objects.uAfricanSlaves, winner.owner, {{winner.location.x, winner.location.y, winner.location.z}},{count = 1, randomize = true, homeCity = nil}) end
else
if math.random(100) <= allStatics.chanceToGetSlaves then civlua.createUnit(objects.uAfricanSlaves, winner.owner, {{winner.location.x, winner.location.y, winner.location.z}},{count = 1, randomize = true, homeCity = nil}) end
end
else
if winner.veteran then
if math.random(100) <= allStatics.chanceForVeteranToGetSlaves then civlua.createUnit(objects.uSlaves, winner.owner, {{winner.location.x, winner.location.y, winner.location.z}},{count = 1, randomize = true, homeCity = nil}) end
else
if math.random(100) <= allStatics.chanceToGetSlaves then civlua.createUnit(objects.uSlaves, winner.owner, {{winner.location.x, winner.location.y, winner.location.z}},{count = 1, randomize = true, homeCity = nil}) end
end
end
end
end
end
end)