Jump to content

How do you spawn in a workshop ship to fight?


drew4452862

Recommended Posts

No idea.  Going to try and start with a command to test this out  /summon

 

-- well it works but lua is cancer.  supposedly it can never find any script ever.  even when it is looking in the correct folder, for the correct file AND IT RUNS.  Nope, couldn't find it

 

ok lets try google, o not a fucking thing... shocked --

Link to comment
Share on other sites

If you test this you won't have AstrayasClass.xml in data/plans.  I had to subscribe to a Workshop ship, build it from plans, save it as something else and then I could move the file from my AppData/Roaming/Avorion folder.  lol zzzz

 

also added in a modified version of the price command and added it to the admin.xml

 

package.path = package.path .. ";data/scripts/lib/?.lua"
package.path = package.path .. ";data/scripts/?.lua"

require ("galaxy")
require ("stringutility")
local PlanGenerator = require ("plangenerator")
local ShipUtility = require ("shiputility")
local TurretGenerator = require ("turretgenerator")


if onServer() then

function initialize()
player = Player()
local str = "Testing ship summon"
local lastSector = {}
player:sendChatMessage("Debug", 0, str)

--local faction = Galaxy():createRandomFaction(Sector():getCoordinates())
--DB 1 changing faction name to make nme 
local factionName = "Astrayanians 44"
local faction = Galaxy():findFaction(factionName)
if Galaxy():findFaction(factionName) == nil then
	player:sendChatMessage("Debug", 0, "I made a new faction")
    faction = Galaxy():createFaction(factionName, 310, 0)
    faction.initialRelations = 0
    faction.initialRelationsToPlayer = -100000
    faction.staticRelationsToPlayers = true
end
--local plan = PlanGenerator.makeFreighterPlan(Faction())
local plan = LoadPlanFromFile("data/plans/AstrayasClass.xml")

local pos = random():getVector(-1000, 1000)
    pos = MatrixLookUpPosition(-pos, vec3(0, 1, 0), pos)

local ship = Sector():createShip(faction, "Astrayas Class", plan, pos) 
ship.title = "something"
ship.name = "something2"
ship.crew = ship.minCrew
ship:addScript("ai/patrol.lua")

TurretGenerator.initialize(random():createSeed())
local turret = TurretGenerator.generateArmed(x, y)
-- Number of turets gets reduced and replaced with a damage multiplier
local numTurrets = 3000

ShipUtility.addTurretsToCraft(ship, turret, numTurrets)

--this is validation found in the4 script that i didn't want to mess with 
-- make sure this is all happening in the same sector
    local x, y = Sector():getCoordinates()
    if lastSector.x ~= x or lastSector.y ~= y then
        -- this must be set in order to drop the loot
        -- if the sector changed, simply unset it
        lastPosition = nil
    end
    lastSector.x = x
    lastSector.y = y

    Loot(boss.index):insert(InventoryTurret(TurretGenerator.generate(x, y, 0, Rarity(RarityType.Exotic), WeaponType.RepairBeam)))

terminate()
end
end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...