Hi there! I found an error, that cause Swoks not to spawn.
in /data/scripts/lib/pirategenerator.lua line 100
you should move local ship var outside of if else block, becase it can't be returned after it.
Also you should move local faction outside too, becase
local race = faction:getValue("AvorionMultiverse_Rasse")
calls earlier then faction initializes.
Fixed function should be like this:
function PirateGenerator.create(position, volumeFactor, title)
-----------------------------------------------
---------- AvorionMultiverse Changes ----------
-----------------------------------------------
local faction = Galaxy():getPirateFaction(PirateGenerator.pirateLevel)
local race = faction:getValue("AvorionMultiverse_Rasse")
local ship
if (race ~= nil and race ~= "") then
position = position or Matrix()
local x, y = Sector():getCoordinates()
PirateGenerator.pirateLevel = PirateGenerator.pirateLevel or Balancing_GetPirateLevel(x, y)
local volume = Balancing_GetSectorShipVolume(x, y) * volumeFactor;
local plan = PlanGenerator.makeShipPlan(faction, volume)
package.path = package.path .. ";data/mods/avorionmultiverse/?.lua"
avorionMultiverse = require("AvorionMultiverse")
local material = PlanGenerator.selectMaterial(faction)
--Possible title from "pirategenerator.lua" and "asyncpirategenerator.lua"
--"Outlaw", "Bandit", "Pirate", "Marauder", "Disruptor", "Raider", "Ravager", "Pirate Mothership"
local raceObject = {}
if string.match(title, "Mothership") then
raceObject = avorionMultiverse.GetRaceObject(faction, plan, material, "CarrierShip")
else
raceObject = avorionMultiverse.GetRaceObject(faction, plan, material, "DefenderShip")
end
plan = raceObject.plan
ship = Sector():createShip(faction, "", plan, position)
PirateGenerator.addPirateEquipment(ship, title)
if (raceObject ~= nil) then
ship.name = ship.name.." by "..raceObject.Creator
if (raceObject.IngameName ~= nil and raceObject.IngameName ~= "") then
ship.name = raceObject.IngameName.." by "..raceObject.Creator
end
if (raceObject.Title ~= nil and raceObject.Title ~= "") then
ship.title = raceObject.Title
end
end
ship.crew = ship.minCrew
ship.shieldDurability = ship.shieldMaxDurability
else -- original code!!
position = position or Matrix()
local x, y = Sector():getCoordinates()
PirateGenerator.pirateLevel = PirateGenerator.pirateLevel or Balancing_GetPirateLevel(x, y)
--local faction = Galaxy():getPirateFaction(PirateGenerator.pirateLevel)
local volume = Balancing_GetSectorShipVolume(x, y) * volumeFactor;
local plan = PlanGenerator.makeShipPlan(faction, volume)
ship = Sector():createShip(faction, "", plan, position)
PirateGenerator.addPirateEquipment(ship, title)
ship.crew = ship.minCrew
ship.shieldDurability = ship.shieldMaxDurability
end
-----------------------------------------------
return ship
end