Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: How to add a hullMod to a ship in a mission (not campaign)  (Read 466 times)

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
How to add a hullMod to a ship in a mission (not campaign)
« 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");
Logged