Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 440 441 [442] 443 444 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6615 on: July 04, 2020, 12:27:12 PM »

There's no way to do that with the weapon file. However, if you've got a script, you could either block the command to vent flux while that weapon is firing, OR (so that the player still has the option to do it) set AIFlags.DO_NOT_VENT via ship.getAIFlags(). (Check that the return value there isn't null since it may be null for the player's ship.)
Logged

Professor Pinkie

  • Ensign
  • *
  • Posts: 23
  • Best cupcakes in a sector!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6616 on: July 04, 2020, 12:27:59 PM »

It doesn't necessarily have to, just fyi.
Spoiler
1) Copy the hullmod from the source into your own hullmods folder. Add your check to the code. Give it a unique name.

2) Copy the line from hullmods.csv and in the script column point to your unique one instead of the vanilla one. Leave everything else unchanged.

3) For your mod id, add some "??" before it.

csv files merge and any duplicate entries of vanilla ids outside of vanilla (so from other mods trying to edit this as well - vanilla will be overridden in any case) are loaded and overridden reverse-alphabetically. Adding the "??" ensures that you will be the first one loaded and so the first one overridden if another mod also edits it.

That should handle any incompatibility with other mods - though it will in-turn allow the user to equip both hullmods when it is built-in in the case that another mod does override your check so be aware of that for troubleshooting purposes.
[close]

Yes, mister, that works. I did so initially, but I do not like this method. A little earlier or a little later this will lead to this:
Spoiler
[close]

I really should make magiclib work. Well, I'll go ask in the appropriate thread.

Anyway, thanks!
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6617 on: July 04, 2020, 05:13:39 PM »

It doesn't necessarily have to, just fyi.
Spoiler
1) Copy the hullmod from the source into your own hullmods folder. Add your check to the code. Give it a unique name.

2) Copy the line from hullmods.csv and in the script column point to your unique one instead of the vanilla one. Leave everything else unchanged.

3) For your mod id, add some "??" before it.

csv files merge and any duplicate entries of vanilla ids outside of vanilla (so from other mods trying to edit this as well - vanilla will be overridden in any case) are loaded and overridden reverse-alphabetically. Adding the "??" ensures that you will be the first one loaded and so the first one overridden if another mod also edits it.

That should handle any incompatibility with other mods - though it will in-turn allow the user to equip both hullmods when it is built-in in the case that another mod does override your check so be aware of that for troubleshooting purposes.
[close]

Bad Morrokain! Bad, bad, bad! Only TCs and rebalances have the privilege to override vanilla.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6618 on: July 05, 2020, 12:57:02 AM »

Bad Morrokain! Bad, bad, bad! Only TCs and rebalances have the privilege to override vanilla.

*Whimpers mournfully* I did bad?
Logged

toastyblitz

  • Ensign
  • *
  • Posts: 44
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6619 on: July 05, 2020, 05:41:08 AM »

Is there an import I should be using at the top of my system generator to allow me to assign my faction a planet/market? the FactionAPI only lists vanilla factions, and while the log is saying the game is reading my .faction file, I'm not sure how to go about this. I was trying to use planet.setFaction and market.setFaction.


*edit again*

figured it out, i was using planet.setFaction(Factions.myfaction) when it should have been planet.setFaction("myfaction")
« Last Edit: July 05, 2020, 10:48:41 AM by toastyblitz »
Logged

Cabbs

  • Ensign
  • *
  • Posts: 24
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6620 on: July 05, 2020, 01:07:34 PM »

Follow-up question!

If I set an officers skills to zero, is that the same as him/her not having those skills?

this code:   person.getStats().getSkillsCopy();

returns a 'List<SkillLevelAPI>' , including skills that I reduced to zero and the aptitudes.  Is this an artifact of how they're adapted from the player skills?
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6621 on: July 05, 2020, 02:12:28 PM »

Only TCs and rebalances have the privilege to override vanilla.

Ok all silliness aside, I took and look and it turns out that lots of mods override vanilla... You even have one for Pilums. I understand that the more people do this the more complex the modiverse gets, but this seems unnecessarily strict in this case considering all of the examples to the contrary.

So what defines a "rebalance" - is Lightshow considered one? Or Better Colonies? Boardable Unboardables? How is that any different from adding a hullmod check to a vanilla hullmod other than it's a new mod and not an existing one??

We need to be consistent here and not play favorites so I'd like some clarification as to what you mean and when you consider this "appropriate". It had better not be "well those are established good mods" or some crap like that.  >:(

-------------------------------------------

Is there an import I should be using at the top of my system generator to allow me to assign my faction a planet/market? the FactionAPI only lists vanilla factions, and while the log is saying the game is reading my .faction file, I'm not sure how to go about this. I was trying to use planet.setFaction and market.setFaction.


*edit again*

figured it out, i was using planet.setFaction(Factions.myfaction) when it should have been planet.setFaction("myfaction")

Some API hooks won't accept a string for a faction ID and requires the enum to be used. You can add you own enum class to accommodate this.

Example:

package archeus.campaign.ids;

public class ArcheusFactions extends com.fs.starfarer.api.impl.campaign.ids.Factions{

   
   public static final String ARCHEUS = "archean_order";
   public static final String ADAMANTINE = "adamantine_consortium";
   public static final String TRADERGUILDS = "trader_guilds";
   public static final String SCICORPS = "scicorps";

}

Follow-up question!

If I set an officers skills to zero, is that the same as him/her not having those skills?

this code:   person.getStats().getSkillsCopy();

returns a 'List<SkillLevelAPI>' , including skills that I reduced to zero and the aptitudes.  Is this an artifact of how they're adapted from the player skills?

I don't think it's the same, but it might functionally work the same way, I'm not really sure.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6622 on: July 05, 2020, 07:59:24 PM »

Moved the discussion about overriding vanilla stuff to another thread:

http://fractalsoftworks.com/forum/index.php?topic=18787.0


Follow-up question!

If I set an officers skills to zero, is that the same as him/her not having those skills?

this code:   person.getStats().getSkillsCopy();

returns a 'List<SkillLevelAPI>' , including skills that I reduced to zero and the aptitudes.  Is this an artifact of how they're adapted from the player skills?

I don't think it's the same, but it might functionally work the same way, I'm not really sure.

I think that's correct, yeah.   
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6623 on: July 07, 2020, 03:20:49 PM »

So I recently learned that I can add/remove a faction's known ships/weapons/fighters using the API and that's great! It means I won't have to override vanilla factions anymore - locking those files away from other modders when mod merging.

First off, I was wondering if the same could be done with blueprints? I currently override vanilla ships/weapons/fighters in the csvs - but only to add "no drop, no sell" or "UNBOARDABLE", etc and remove the blueprint tags so they are not included in blueprint packages/rare_bp drops. This is problematic when mod merging for a number of reasons.

My thought was to do this through code instead by creating a database of vanilla stuff then iterating through all of it at the start of a campaign before anything is added to markets and add/remove the necessary tags/remove them from blueprints. What would be the best point for that? OnNewGame?

Alternatively, I could create mod-specific blueprint packages and prevent vanilla blueprints from dropping. That would take more work but would be more ideal. However, it only would work if I could remove known blueprints from a faction.

Any general advice? I'm going to all of this trouble so that I can create settings configuration to be able to "enable/disable" vanilla content very, very easily and without any technical skill. So I can preserve the TC experience as the default whilst simultaneously providing a user the option to have a full toybox if that is what they would prefer.

In the far off future, this will also allow me to add vanilla balanced ships through a separate ship entry, and similarly toggle functionality between a fully vanilla balanced setting and the TC experience while keeping everything "under one house" so to speak. I don't particularly want to modulize too much as checking the forums/creating the forum pages alone would provide a lot more work/maintenance than I would want to tackle.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6624 on: July 07, 2020, 03:27:45 PM »

Take a look at ShipHullSpecAPI.addTag(). If you want to remove the tag, you could call getTags().remove(tag). IIRC weapon and fighter wing specs have similar methods. You'd want to do this kind of modification... probably in the onApplicationLoad() method of your mod plugin, since you only need to do this once, and it's not tied to the campaign. And, in fact, these methods are provided specifically with your kind of use case in mind!
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6625 on: July 07, 2020, 03:32:51 PM »

Take a look at ShipHullSpecAPI.addTag(). If you want to remove the tag, you could call getTags().remove(tag). IIRC weapon and fighter wing specs have similar methods. You'd want to do this kind of modification... probably in the onApplicationLoad() method of your mod plugin, since you only need to do this once, and it's not tied to the campaign. And, in fact, these methods are provided specifically with your kind of use case in mind!

Amazing! Thanks! I wasn't sure if the ShipHullSpecAPI was technically loaded at OnApplicationLoad() so glad that I can just do it immediately. Ah I'm excited by this!  :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6626 on: July 07, 2020, 04:39:44 PM »

Nice, good luck :)
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6627 on: July 10, 2020, 03:59:13 AM »

Hi, I don't know if this is the right place to ask, but is there any way we could get API support for playable fighters?

You might have remembered me asking about this a few months ago. By setting hull and collisionclass to FIGHTER, you get a broadly playable analog that behaves how you'd expect - but there are two major impediments to this approach that had me initially give up the concept. Instead I made "hybrid" ship, with frigate hullsize and fighter collision, but this had unintended effect of breaking lot of custom AI and other things, so I revisited this topic and was able to make something that was playable, outside of a few issues. I think if this support could be added, it would make it a lot easier for people to explore in the future and also eliminate the weird edge cases I experienced.

The main  issue is that the game crash when ship tries to retreat from battles. I don't 100% know why except its caused by RetreatManuever(?), I assume there is no "retreat manuever" for fighters?.

The second issue is there is no real UI/HUD for fighters - for instance, a piloted fighter only appears as a green triangle on the command UI, so if you were to swap to another ship, swapping back to it, or commanding it is impossible.

In the mod I made, I was able to circumvent this by turning the "fighter" back into a frigate when it was within the retreat radius, and when the Command UI was open. But there are a few other edge cases where things get weird - this particular mod ship, for example, cannot be "disabled" like a normal ship can. It can be blown up in combat, and be knocked down to 0% hull, but always is recoverable, so I also had to add a condition where once HP is below 2% threshold, the hullsize reverts back to FRIGATE so it can be properly disabled.

Onto to the less pressing issues, there are no warnings for the end of peak performance/low CR and overloading(Either the warning that appears at the top of the screen, or over the ship), and no hull/flux indicators over the ship. With scripting and MagicLIB it's easy enough to atleast loosely replicate a hull/flux indicator, as well as an overload pop-up over affected ships, though.

Anyway, I have a simple(i think) proposal that should make a lot easier to implement for people who want to play around with this concept.

is there anyway to add something like a FIGHTER tag (like CARRIER tag) that could be used to give "playable" fighters special behavior?  What MesoTroniK suggest, was if there was a condition evaluated (like if(ship.isPlayableFighter)), the default behavior of fighters could be preserved, but the boolean returning as true would allow for slightly different behavior. I'm just guessing since I have no idea whats under the hood of the AI implementation for retreat, but with something like this, I'd imagine something simple like switching the ship to frigate hullsize before it retreated or such could be done, or just having it do the same method normal ships do on retreat, as well as serving as a toggle that would let ships like this appear in the Command UI and retain a HUD Status bar.

Sorry again if this is not really the right place to ask.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6628 on: July 10, 2020, 07:12:31 AM »

if I add a custom drop group to a vanilla entity in salvage_entity_gen_data.csv, will it get overridden by other mods that also add groups to the same entity but are later in load order? Or do they get merged?
« Last Edit: July 10, 2020, 07:42:10 AM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6629 on: July 10, 2020, 08:43:36 AM »

@shoi: Ah, I can't really do that - as you've found out, there are a lot of places where these are handled differently, so it'd be a ton of work. More importantly, there's no vanilla use case, which means that 1) it's unlikely I would find all the cases that need changing, and 2) there's a solid chance I would break something at a later date without realizing it. Apologies!

if I add a custom drop group to a vanilla entity in salvage_entity_gen_data.csv, will it get overridden by other mods that also add groups to the same entity but are later in load order? Or do they get merged?

CSV rows never get merged, only one of the rows will be used. (I always forget whether it's first or last in load order, but one of those.)
Logged
Pages: 1 ... 440 441 [442] 443 444 ... 710