Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 401 402 [403] 404 405 ... 710

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1725822 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6030 on: February 03, 2020, 02:21:26 PM »

Hmm. Do both of those modules have >0 ordnance points, and weapons or fighter bays? If the game thinks one of the modules is an "armor" module and the other one isn't, that could trigger different behavior.

See:
Code
public static boolean isActiveModule(ShipAPI ship) {
boolean notActiveModule = ship.getVariant().getHullSpec().getOrdnancePoints(null) <= 0 &&
  ship.getVariant().getWeaponGroups().isEmpty() &&
  ship.getMutableStats().getNumFighterBays().getModifiedValue() <= 0;
return !notActiveModule;
}

If that returns different results for one module but not the other, it could have something to do with it.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6031 on: February 03, 2020, 03:16:27 PM »

HA! In this instance, the non buggy module had a built-in weapon, and the buggy one didn't.

So I tried to only destroy an armor module on a ship that had both armor and non armor modules and it worked fine. Then I tried to only put that same armor module in all slots and destroy one, and the bug showed up again.

It seems that having one or more destroyed modules on a ship that ONLY has pure armor modules is the trigger.

[edit] But adding 1 OP to one of the armor module seems to solve the issue, so that's a workaround in the meantime.
« Last Edit: February 03, 2020, 03:26:53 PM by Tartiflette »
Logged
 

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6032 on: February 03, 2020, 03:27:38 PM »

[edit] But adding 1 OP to one of the armor module seems to solve the issue, so that's a workaround in the meantime.

On the plus side, this workaround allows players to see armor modules' stats in the refit screen.
Logged

Nia Tahl

  • Admiral
  • *****
  • Posts: 793
  • AI in disguise
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6033 on: February 03, 2020, 03:38:05 PM »

Couldn't find any good info on this:

Can skin files change a ship's tech and engine styles?

edit: Nevermind, stumbled into it eventually. The lack of documentation for skins is driving me mad.
« Last Edit: February 03, 2020, 03:45:12 PM by Nia Tahl »
Logged
My mods: Tahlan Shipworks - ScalarTech Solutions - Trailer Moments
It's all in the presentation

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6034 on: February 03, 2020, 04:02:37 PM »

HA! In this instance, the non buggy module had a built-in weapon, and the buggy one didn't.

So I tried to only destroy an armor module on a ship that had both armor and non armor modules and it worked fine. Then I tried to only put that same armor module in all slots and destroy one, and the bug showed up again.

It seems that having one or more destroyed modules on a ship that ONLY has pure armor modules is the trigger.

[edit] But adding 1 OP to one of the armor module seems to solve the issue, so that's a workaround in the meantime.

Ahh yes, that reminds me of what the issue was, exactly. I believe this is fixed for the next release.

Couldn't find any good info on this:

Can skin files change a ship's tech and engine styles?

edit: Nevermind, stumbled into it eventually. The lack of documentation for skins is driving me mad.

In lieu of that, here's the source for the method that loads skin files:

Spoiler
   private static void loadHullSkin(String path) throws IOException, JSONException {
      JSONObject json = LoadingUtils.getMergedJSON(path);
      
      String baseId = json.getString("baseHullId");
      String skinId = json.getString("skinHullId");
      
      if (ShipHullSpecStore.hasHullSpec(skinId)) return;
      
      if (StarfarerSettings.isRunningTC()) {
         if (!ShipHullSpecStore.hasHullSpec(baseId)) {
            log.info("Skipping skin [" + path + "], assuming it's a core skin not used in total conversion.");
            return;
         }
      }
      
      
      ShipHullSpec hullSpec = SpecStore.getSpec(ShipHullSpec.class, baseId).clone();
      int baseOP = hullSpec.getOrdnancePoints(null);
      
      hullSpec.getTags().clear();
      JSONArray tags = json.optJSONArray("tags");
      if (tags != null) {
         for (int i = 0; i < tags.length(); i++) {
            String tag = tags.getString(i);
            tag = tag.trim();
            if (tag.isEmpty()) continue;
            hullSpec.addTag(tag);
         }
      }
      
      
      hullSpec.setHullId(skinId);
      hullSpec.setBaseHullId(baseId);
      hullSpec.setShipFilePath(path);
      
      boolean compatible = true;
      
      if (json.has("coversColor")) {
         Color c = JSONUtils.getColor(json, "coversColor");
         hullSpec.setCoversColor(c);
      }
      
      if (json.has("spriteName")) {
         hullSpec.getSpriteSpec().setSpriteName(json.getString("spriteName"));
      }
      if (json.has("hullName")) {
         hullSpec.setHullName(json.getString("hullName"));
      }
      if (json.has("hullDesignation")) {
         hullSpec.setDesignation(json.getString("hullDesignation"));
      }
      if (json.has("manufacturer")) {
         hullSpec.setManufacturer(json.getString("manufacturer"));
      } else if (json.has("tech")) {
         hullSpec.setManufacturer(json.getString("tech"));
      }
      if (json.has("fleetPoints")) {
         hullSpec.setFleetPoints(json.getInt("fleetPoints"));
      } else if (json.has("fpMod")) {
         hullSpec.setFleetPoints(hullSpec.getFleetPoints() + json.getInt("fpMod"));
      }
      
      hullSpec.setRestoreToBase(json.optBoolean("restoreToBaseHull", false));
      
      if (json.has("fighterBays")) {
         hullSpec.setFighterBays(json.getInt("fighterBays"));
      }
      if (json.has("ordnancePoints")) {
         hullSpec.setOrdnancePoints(json.getInt("ordnancePoints"));
         if (baseOP != hullSpec.getOrdnancePoints(null)) {
            compatible = false;
         }
      }
      if (json.has("baseValue")) {
         hullSpec.setBaseValue(json.getInt("baseValue"));
      }
      
      if (json.has("baseValueMult")) {
         hullSpec.setBaseValue((int) (hullSpec.getBaseValue() * json.getDouble("baseValueMult")));
      }
      if (json.has("descriptionId")) {
         hullSpec.setDescriptionId(json.getString("descriptionId"));
      } else {
         hullSpec.setDescriptionId(baseId);
      }
      if (json.has("descriptionPrefix")) {
         String prefix = json.getString("descriptionPrefix");
         if (!prefix.endsWith(".")) prefix += ".";
         hullSpec.setDescriptionPrefix(prefix);
      } else {
         hullSpec.setDescriptionPrefix(null);
      }
      
      if (json.has("systemId")) {
         hullSpec.setShipSystemId(json.getString("systemId"));
      }
      
//      "removeWeaponSlots":[],
//      "removeEngineSlots":[],
      if (json.has("removeWeaponSlots")) {
         JSONArray arr = json.getJSONArray("removeWeaponSlots");
         for (int i = 0; i < arr.length(); i++) {
            String slotId = arr.getString(i);
            for (WeaponSlotSpec slot : hullSpec.getAllWeaponSlots()) {
               if (slot.getId().equals(slotId)) {
                  hullSpec.getAllWeaponSlots().remove(slot);
                  compatible = false;
                  break;
               }
            }
         }
      }
      if (json.has("removeEngineSlots")) {
         JSONArray arr = json.getJSONArray("removeEngineSlots");
         List<EngineSlotSpec> remove = new ArrayList<EngineSlotSpec>();
         for (int i = 0; i < arr.length(); i++) {
            int slotIndex = arr.getInt(i);
            if (slotIndex >= 0 && slotIndex < hullSpec.getEngineSlots().size()) {
               remove.add(hullSpec.getEngineSlots().get(slotIndex));
            }
         }
         hullSpec.getEngineSlots().removeAll(remove);
      }
      
//      "removeBuiltInMods":[],
//      "removeBuiltInWeapons":[],
      if (json.has("removeBuiltInMods")) {
         JSONArray arr = json.getJSONArray("removeBuiltInMods");
         for (int i = 0; i < arr.length(); i++) {
            String modId = arr.getString(i);
            hullSpec.getBuiltInMods().remove(modId);
            compatible = false;
         }
      }
      if (json.has("removeBuiltInWings")) {
         JSONArray arr = json.getJSONArray("removeBuiltInWings");
         for (int i = 0; i < arr.length(); i++) {
            String wingId = arr.getString(i);
            hullSpec.getBuiltInWings().remove(wingId);
            compatible = false;
         }
      }
      if (json.has("removeBuiltInWeapons")) {
         JSONArray arr = json.getJSONArray("removeBuiltInWeapons");
         for (int i = 0; i < arr.length(); i++) {
            String slotId = arr.getString(i);
            hullSpec.getBuiltInWeapons().remove(slotId);
            compatible = false;
         }
      }
      
//      "removeHints":[CIVILIAN],
//      "addHints":[],
      if (json.has("removeHints")) {
         JSONArray arr = json.getJSONArray("removeHints");
         for (int i = 0; i < arr.length(); i++) {
            ShipTypeHints hint = ShipTypeHints.valueOf(arr.getString(i));
            hullSpec.getHints().remove(hint);
         }
      }
      if (json.has("addHints")) {
         JSONArray arr = json.getJSONArray("addHints");
         for (int i = 0; i < arr.length(); i++) {
            ShipTypeHints hint = ShipTypeHints.valueOf(arr.getString(i));
            hullSpec.getHints().add(hint);
         }
      }
      
      
//      "builtInMods":["tow_cable"],
      if (json.has("builtInMods")) {
         JSONArray arr = json.getJSONArray("builtInMods");
         for (int i = 0; i < arr.length(); i++) {
            String modId = arr.getString(i);
            hullSpec.addBuiltInMod(modId);
            //compatible = false;
         }
      }
      
      if (json.has("builtInWings")) {
         JSONArray arr = json.getJSONArray("builtInWings");
         for (int i = 0; i < arr.length(); i++) {
            String wingId = arr.getString(i);
            hullSpec.addBuiltInWing(wingId);
            compatible = false;
         }
      }
      
//      "builtInWeapons":{
//          "WS 016":"tpc",
//          "WS 017":"tpc",
//       },
      if (json.has("builtInWeapons")) {
         JSONObject builtInWeapons = json.getJSONObject("builtInWeapons");
         if (JSONObject.getNames(builtInWeapons) != null) {
            for (String slotId : JSONObject.getNames(builtInWeapons)) {
               String weaponId = builtInWeapons.getString(slotId);
               hullSpec.addBuiltInWeapon(slotId, weaponId);
               compatible = false;
            }
         }
      }

//      "weaponSlotChanges":{
//         "WS 001":{
//            #"angle": 0,
//               #"arc": 210,
//               #"mount": "TURRET",
//               #"size": "SMALL",
//               "type": "BALLISTIC"
//         }   
//      },
      if (json.has("weaponSlotChanges")) {
         JSONObject changes = json.getJSONObject("weaponSlotChanges");
         if (JSONObject.getNames(changes) != null) {
            for (String slotId : JSONObject.getNames(changes)) {
               WeaponSlotSpec slot = hullSpec.getWeaponSlot(slotId);
               JSONObject data = changes.getJSONObject(slotId);
               if (data.has("angle")) {
                  slot.setAngle((float) data.getDouble("angle"));
               }
               if (data.has("arc")) {
                  slot.setArc((float) data.getDouble("arc"));
               }
//               JSONUtils.mapToEnum(weaponSlotSpecJson, "type", WeaponAPI.WeaponType.class, null),
//               JSONUtils.mapToEnum(weaponSlotSpecJson, "size", WeaponAPI.WeaponSize.class, null),
//               JSONUtils.mapToEnum(weaponSlotSpecJson, "mount", WeaponSlotType.class, null),
               if (data.has("mount")) {
                  slot.setSlotType(JSONUtils.mapToEnum(data, "mount", WeaponSlotType.class, null));
               }
               if (data.has("size")) {
                  slot.setSlotSize(JSONUtils.mapToEnum(data, "size", WeaponAPI.WeaponSize.class, null));
               }
               if (data.has("type")) {
                  slot.setWeaponType(JSONUtils.mapToEnum(data, "type", WeaponAPI.WeaponType.class, null));
               }
               compatible = false;
            }
         }
      }
      
//      "engineSlotChanges":{
//      "0":{
//         #"width": 0,
//          #"length": 210,
//          #"angle": 210,
//          #"style": "SMALL",
//      }   
//   },
      
      if (json.has("engineSlotChanges")) {
         JSONObject changes = json.getJSONObject("engineSlotChanges");
         if (JSONObject.getNames(changes) != null) {
            for (String slotId : JSONObject.getNames(changes)) {
               int index = Integer.parseInt(slotId);
               EngineSlotSpec slot = hullSpec.getEngineSlots().get(index);
               
               JSONObject data = changes.getJSONObject(slotId);
               if (data.has("style")) {
                  String style = data.getString("style");
                  CustomEngineData custom = SpecStore.getSpec(CustomEngineData.class, style);
                  slot.setStyle(Style.CUSTOM);
                  slot.setCustomData(custom);
               }
               if (data.has("width")) {
                  slot.setWidth((float) data.getDouble("width"));
               }
               if (data.has("length")) {
                  slot.setLength((float) data.getDouble("length"));
               }
               if (data.has("angle")) {
                  slot.setAngle((float) data.getDouble("angle"));
               }

            }
         }
      }
      
      hullSpec.setCompatibleWithBase(compatible);
      
      
      ShipHullSpecStore.putSpec(skinId, hullSpec);
      
      if (firstTime) {
         //if (!hullSpec.isDHull()) {
         //if (!hullSpec.isDHullOldMethod()) {
            ShipHullSpecLoader.addDHull(hullSpec);
         //}
         
         HullVariantSpec empty = new HullVariantSpec(skinId + "_Hull", hullSpec);
         if (hullSpec.getAllWeaponSlots().isEmpty()) {
            empty.setVariantDisplayName("Standard");
         } else {
            empty.setVariantDisplayName("Custom");
         }
         empty.setSource(VariantSource.HULL);
         ShipVariantStore.addVariant(empty);
      }
   }
[close]
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6035 on: February 03, 2020, 04:47:59 PM »

We can't change the hull's style?

Converted that code into an example.txt, attached. 8)

EDIT: put it on pastebin https://pastebin.com/GgRCn26p

[attachment deleted by admin]
« Last Edit: February 03, 2020, 05:47:10 PM by SafariJohn »
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6036 on: February 04, 2020, 12:15:16 AM »

While I'm working on it, is there an easy way to "buff" ships only for the campaign battle autoresolve plugin? I have a faction that is mostly balanced in real time battles, but get stomped virtually 100% of the time even with a 2:1 fleet-point advantage against vanilla factions.

I tried to have a hullmod that increases all damage deal and reduces all damage taken while on the campaign layer:
Code
member.getStats().getHullDamageTakenMult().modifyMult(ID, 0.1f);
member.getStats().getBallisticWeaponDamageMult().modifyPercent(ID, 1000);
member.getStats().getEnergyWeaponDamageMult().modifyPercent(ID, 1000);
member.getStats().getMissileWeaponDamageMult().modifyPercent(ID, 1000);
and tried to increase all damage to ships:
Code
member.getStats().getDamageToCapital().modifyPercent(ID, 1000);
member.getStats().getDamageToCruisers().modifyPercent(ID, 1000);
member.getStats().getDamageToDestroyers().modifyPercent(ID, 1000);
member.getStats().getDamageToFrigates().modifyPercent(ID, 1000);

but neither of these affected the results.
« Last Edit: February 04, 2020, 12:34:54 AM by Tartiflette »
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6037 on: February 04, 2020, 08:26:36 AM »

The strength is based on the ship's fleet point value, with a component of that being assigned based on the fraction of spent ordnance points. ... and since that's not capped, if you were to set the OP used to, say, double the maximum (by perhaps assigning an ungodly number of vents or capacitors), that should increase the autoresolve strength substantially.

but get stomped virtually 100% of the time even with a 2:1 fleet-point advantage against vanilla factions.

Oh, wait, missed this part. Hmm. See: BattleAutoresolverPluginImpl.computeDataForMember() for reference. I wonder if the game is thinking those ships are civilian, for some reason, or that they can't be deployed for combat? I'd suggest trying to step through that method in a debugger (or setting up something similar on your end and printing out what gets computed); seems like something's going wrong there - if the FP value is higher, the ship should be that much better in autoresolve.

Ah - another possibility. If these are, say, SHIP_WITH_MODULES, and the actual hulls have a lot of unspent OP, that would reduce the strength a lot.



We can't change the hull's style?

Converted that code into an example.txt, attached. 8)

EDIT: put it on pastebin https://pastebin.com/GgRCn26p

Nice! (I guess not, hmm.)
Logged

scmp

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6038 on: February 04, 2020, 12:11:25 PM »

Is there a way to render models outside of the game? I'm trying to get the rings for Saturn in my mod to look right, and having to open the game and start a new game every change is making it quite the effort.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6039 on: February 04, 2020, 07:30:53 PM »

Just roughly, you'd give the patrol fleet an intercept assignment with whatever text override was appropriate. And... you'd have to do *something* to make it actually do a customs inspection - there are rules regarding this in rules.csv; I forget exactly what the trigger is, you can look at the tOffPatrolBeginNoTalk rule and the ones around there. As far as what's illegal, that would be defined in the faction's file. You could also re-rig the entire interacton via rules if you need something truly custom, if it's worth the effort.
Hmm... I was thinking of setting a hullmod to be illegal; but I don't think I've seen a field like that in the faction file...

I also have another question - how do I properly destroy a ship (code-wise) that I dynamically spawned in combat?

I am using a dummy ship which I search for during combat and then replace it with the correct variant of the ship I want. However, I find that this method seems to cause an error in battle, where it is impossible for me to retreat (all ships have retreated - all fighters destroyed, full retreat is on, but battle won't end). My suspicion is that some 'remnant' of these ships/fighters are the cause of this...

here is the replacer code
Code
	
private void resolveDroneReplace(ShipAPI ship) {

String variantID = SHIP_ID_PAIR.get(ship.getHullSpec().getBaseHullId());
        Vector2f location = new Vector2f(ship.getLocation());
        float angle = ship.getFacing();
        int owner = ship.getOwner();

if(variantID == null) {
return;
}

if(variantID.contentEquals("select_dronepod")) {
variantID = DRONEPOD_PICKER.pick();
}


   FleetMemberAPI shipMember;
   if(variantID.contentEquals(FIREBASE_ID)){
   shipMember = Global.getFactory().createFleetMember(FleetMemberType.SHIP, variantID);
   }else {
   shipMember = Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, variantID);
   }
       
       

           
       shipMember.getRepairTracker().setCrashMothballed(false);
       shipMember.getRepairTracker().setMothballed(false);
       shipMember.getCrewComposition().addCrew(shipMember.getNeededCrew());
       shipMember.getRepairTracker().setCR(ship.getCurrentCR());
       shipMember.setOwner(owner);
       shipMember.setAlly(ship.isAlly());
       
       boolean suppress = engine.getFleetManager(owner).isSuppressDeploymentMessages();
       engine.getFleetManager(owner).setSuppressDeploymentMessages(true);
       ShipAPI newShip = engine.getFleetManager(owner).spawnFleetMember(shipMember, location, angle, 0f);
       newShip.setCollisionClass(CollisionClass.FIGHTER);

       shipMember.setShipName(newShip.getHullSpec().getHullName());

   float axis;
   float range;
       switch(variantID) {
  case FIREBASE_ID:
       axis = (float)Math.random()*360;
     range = 100f;
         
         Vector2f randomHeading = MathUtils.getPointOnCircumference(ZERO, range, axis);

            newShip.getVelocity().set(randomHeading);
            newShip.setFacing(axis);
break;
    case KONPEITO_GUNPOD_ID:
    case RINTEL_GUNPOD_ID:
    case CANNON_GUNPOD_ID:
    case INF_1DIV_ID:
    case INF_2DIV_ID:
    case INF_3DIV_ID:

            ShipAIConfig droneAI = new ShipAIConfig();
            droneAI.alwaysStrafeOffensively = true;
            droneAI.backingOffWhileNotVentingAllowed = false;
            droneAI.turnToFaceWithUndamagedArmor = true;
            droneAI.burnDriveIgnoreEnemies = false;
            droneAI.personalityOverride = "reckless";
   
            newShip.setShipAI(Global.getSettings().createDefaultShipAI(newShip, droneAI));

            newShip.getVelocity().set(ship.getVelocity());
break;
default:
           newShip.getVelocity().set(ship.getVelocity());
       }
       
       
       newShip.setAngularVelocity(ship.getAngularVelocity());
       
       for (ShipAPI child : newShip.getChildModulesCopy()) {
           child.setCollisionClass(CollisionClass.FIGHTER);
       }

       newShip.setInvalidTransferCommandTarget(true);
       engine.getFleetManager(owner).setSuppressDeploymentMessages(suppress);
       

       engine.removeEntity(ship);
}
[close]

Right now, I just use engine.removeEntity(ship); to destroy the dummy and let the spawned unit die on its own via normal combat. Perhaps I am not doing something I should be?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24123
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6040 on: February 04, 2020, 08:33:33 PM »

Is there a way to render models outside of the game? I'm trying to get the rings for Saturn in my mod to look right, and having to open the game and start a new game every change is making it quite the effort.

You could set up a basic main class of your own with a render loop and so on, though that'd require probably doing more scaffolding work than is reasonable.

If you run the game's jvm in debug mode and connect to it from your IDE, it might be able to do hot code replace/hotswap/whatever your IDE calls it. Meaning you can - within certain limits - change the code, save, and it should be reflected in the already-running game. I'm not 100% sure if it's possible to set this up with the game as it is; it might require replacing the JRE the game comes with, with a JDK, and you might run into other problems. Not having done this myself - I just run the game from the IDE directly - I'm not certain if this can be made to work with the release version of the game or not.

Hmm... I was thinking of setting a hullmod to be illegal; but I don't think I've seen a field like that in the faction file...

For this, you'd need to write your own version of CargoScan.java, basically.

Right now, I just use engine.removeEntity(ship); to destroy the dummy and let the spawned unit die on its own via normal combat. Perhaps I am not doing something I should be?

Yeah - the corresponding DeployedFleetMemberAPI needs to be cleaned out of that side's CombatFleetManagerAPI, iirc.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6041 on: February 04, 2020, 10:23:42 PM »

Yeah - the corresponding DeployedFleetMemberAPI needs to be cleaned out of that side's CombatFleetManagerAPI, iirc.
Hmm... I couldn't seem to find a method in CombatFleetManagerAPI that removes a DeployedFleetMemberAPI, however there was a code that the module retreat cleaner used from CombatFleetManager:

Will this do the trick?

Code
       CombatFleetManager manager = (CombatFleetManager) engine.getFleetManager(ship.getOwner());
       
       manager.getDeployed().remove(manager.getDeployedFleetMember(ship));

EDIT: It did work, and it seems the retreating bug has been fixed! Thanks again, Alex!
« Last Edit: February 04, 2020, 11:03:11 PM by creature »
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6042 on: February 05, 2020, 12:26:06 AM »

The strength is based on the ship's fleet point value, with a component of that being assigned based on the fraction of spent ordnance points. ... and since that's not capped, if you were to set the OP used to, say, double the maximum (by perhaps assigning an ungodly number of vents or capacitors), that should increase the autoresolve strength substantially.

So I checked the autoresolve plugin results for those ships, and my super fast, super fragile, no-dissipation-all-vent ships come around one third of the ship strength of vanilla hulls for the getMemberStrength() calculation... Pretty bad.

I tested to add triple the max vents via script, and that technically works, but given the amount of possible ways such boosted ships could make it into the player's hands I'm a bit worried about using such blunt approach (not mentioning the myriad of UI weirdness). And as long as fleets use fleetpoints to get generated, I can't really play on that front either since it only leads to undersized fleets... Unless I also massively boost fleet sizes too but that comes with its own horde of issues and inconsistencies.

Would it be possible to add a ship_strength_multiplier mutable stat somewhere?
« Last Edit: February 05, 2020, 01:15:15 AM by Tartiflette »
Logged
 

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6043 on: February 05, 2020, 04:30:22 AM »

How can I check from inside a hullmod if a ship belongs to the player? I've tried checking the owner, but it seems all ships in the campaign map have an owner of 0. I tried getting the fleet member, but ship.getFleetMember() always returns false, even for AI ships in the campaign. Finally, I tried removing the mod directly off the player's fleet list:

Code
for(FleetMemberAPI member: Global.getSector().getPlayerFleet().getFleetData().getMembersListCopy()) {
   
    log.info("Removing mod from player fleet " + this.spec.getId());
member.getVariant().removeMod(this.spec.getId());
    }

...but it doesn't seem to remove the mod at all.

My only goal is to make a hullmod that only applies to AI ships and will be auto-removed if the player ever lays their hands on the ship.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6044 on: February 05, 2020, 07:15:19 AM »

Is there a way to render models outside of the game? I'm trying to get the rings for Saturn in my mod to look right, and having to open the game and start a new game every change is making it quite the effort.

IIRC, when I was doing a big ring system I used GIMP and put each ring graphic on its own layer. The graphics are grouped in rings_X.PNGs in graphics/planets. I marked the center and edges of each ring with short lines. Then I could move them left/right until they looked how I wanted and use the distance tool to measure the offsets I needed.
Logged
Pages: 1 ... 401 402 [403] 404 405 ... 710