Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: rogerbacon on December 29, 2020, 11:59:11 AM

Title: How to add a hullMod to a ship in a mission (not campaign)
Post by: rogerbacon on December 29, 2020, 11:59:11 AM
I'm creating a mission like randomBattle and I want to get each ship and add a hullMod as the ship is added to the player's fleet. How should I do this? I think I'm close but its not quite working. Here's what I've tried so far.

Code
BattleCreationContext batContext = api.getContext();
CampaignFleetAPI playerFleet = batContext.getPlayerFleet();
FleetMemberAPI ship = api.addToFleet(FleetSide.PLAYER, "astral_Elite", FleetMemberType.SHIP, false);
api.addBriefingItem("ship is " + ship.getVariant().getHullMods());
ship.getVariant().addMod("some_HullMod");