LogicSocket Posted February 19, 2017 Share Posted February 19, 2017 So I created a custom races/faction modeled after examining the Xsotan files. "The Dweenle" (Old Starflight game alien race) I had to use my own command to spawn them but it works. Next I'll have to figure out how to randomly have them living throughout the galaxy. Stay tuned. This would be a good thing to have a template for all modders so as to create custom galaxies with our own races and factions. They have their own custom ship that i created then placed in the plans folder. Link to comment Share on other sites More sharing options...
Devious Posted February 20, 2017 Share Posted February 20, 2017 It would indeed be cool if a custom faction could spawn throughout the galaxy, Looking forward to your progress! Link to comment Share on other sites More sharing options...
Joe70 Posted February 21, 2017 Share Posted February 21, 2017 Great ! Looking forward for this ! Would be very cool to edit Factions and there Ships and Stations Link to comment Share on other sites More sharing options...
picklelord Posted February 22, 2017 Share Posted February 22, 2017 This would be awesome, and has a lot of potential! I have been looking at modding some stuff too and this idea was on my list! =D I have mostly been looking at ways to make what you receive more random, like the secret stashes. It would be awesome if the factions could be dynamically added to, so like the upgrade systems all being picked up from a folder, the custom factions could have a folder so other custom factions could be easily dropped in. How are you getting the Ship Plan in there? Link to comment Share on other sites More sharing options...
LogicSocket Posted February 22, 2017 Author Share Posted February 22, 2017 Hi picklelord, sure i'll post the code so you and others can play around. to define the new faction: local Dweenle = {} function Dweenle.getFaction() local name = "The Dweenle"%_T local galaxy = Galaxy() local faction = galaxy:findFaction(name) if faction == nil then faction = galaxy:createFaction(name, 0, 0) faction.initialRelations = 100000 faction.initialRelationsToPlayer = 0 faction.staticRelationsToPlayers = true for trait, value in pairs(faction:getTraits()) do faction:setTrait(trait, 0) -- completely neutral / unknown end end return faction end Create ship function for the new faction: function Dweenle.createShip(position, volumeFactor) position = position or Matrix() local volume = Balancing_GetSectorShipVolume(Sector():getCoordinates()) volume = volume * (volumeFactor or 1) volume = volume * 0.5 -- Dweenle ships aren't supposed to be very big local x, y = Sector():getCoordinates() local probabilities = Balancing_GetMaterialProbability(x, y) local material = Material(getValueFromDistribution(probabilities)) local faction = Dweenle.getFaction() local plan = LoadPlanFromFile("data/plans/Dweenle.xml") local ship = Sector():createShip(faction, "", plan, position) Dweenle.infectShip(ship) -- Dweenle have random turrets TurretGenerator.initialize(random():createSeed()) local turret = TurretGenerator.generateArmed(x, y) local numTurrets = math.max(2, Balancing_GetEnemySectorTurrets(x, y) * 0.75) ShipUtility.addTurretsToCraft(ship, turret, numTurrets) ship:setTitle("Dweenle ${ship}", {ship = ShipUtility.getMilitaryNameByVolume(ship.volume)}) ship.crew = ship.minCrew ship.shieldDurability = ship.shieldMaxDurability AddDefaultShipScripts(ship) ship:addScript("ai/patrol.lua") ship:addScript("antismuggle.lua") ship:addScript("story/Dweenlebehaviour.lua") ship:setValue("is_xsotan", 1) return ship end Code that will spawn the new ships: function onSpawnDweenleButtonPressed() if onClient() then invokeServerFunction("onSpawnDweenleButtonPressed") return end local x, y = Sector():getCoordinates() local faction = Dweenle.getFaction() local right = Entity().right local dir = Entity().look local up = Entity().up local position = Entity().translationf local pos = position + dir * 100 for i = -3, 3 do Dweenle.createShip() Placer.resolveIntersections() end end To answer your question about how I got the ship plan is this bit: LoadPlanFromFile("data/plans/Dweenle.xml") you can build a ship, and save it then copy that xml and place it in data/plans/ folder. Hope this helps! -LS Link to comment Share on other sites More sharing options...
Devious Posted February 22, 2017 Share Posted February 22, 2017 Nice, good work! I have two questions, the first being what the reference to the Dweenlebehaviour.lua does. And second, if it would also be possible to create a faction but let the game generate the ships for them. I'm also curious wether it is possible to control how they spawn through the galaxy, for example their population density or how close to the center they spawn. I think I understand how your file structure is so I will have a look at it myself but others could use some instructions on how to implement your code. Link to comment Share on other sites More sharing options...
SiotiK Posted May 23, 2018 Share Posted May 23, 2018 hallo an alle :) ich habe eine frage. Ich habe den Xsotan einen Schiffsbauplan zugeordnet und das hat auch wunderbar funktioniert. Das schiff besitzt einen Hangar und genug platz für viele Jäger. kann ich den schiffen noch Jäger hinzufügen ? Hello everyone :) I have a question. I have assigned the Xsotan a shipbuilding plan and that worked fine too. The ship has a hangar and enough space for many fighters. Can I still add fighters to the ships? Link to comment Share on other sites More sharing options...
SpaceBusBimbles Posted June 14, 2018 Share Posted June 14, 2018 I have no clue how to install the code. I would love to see a faction flying about using buses or WW2 ships :P Link to comment Share on other sites More sharing options...
Kamo Posted June 14, 2018 Share Posted June 14, 2018 Someone is doing a mod of the same kind ! Maybe you could exchange faction creating tips :D. I guess the Dweenle scripts come from the Xsotan ones. Also nice ship LogicSocket :) ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now