Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 377 378 [379] 380 381 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5670 on: November 15, 2019, 02:34:20 PM »

That's correct, yeah. At least, unless I'm missing something obvious. So if that's not working, that seems like it might be a bug.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7214
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5671 on: November 15, 2019, 10:16:14 PM »

Thanks! The bit that I was working on is working now, even though I'm still not 100% on that boolean.

The code snippet I posted seems to be working for the player ships, but there could also be something else going on; I didn't do a complete search.
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 #5672 on: November 16, 2019, 05:14:55 AM »

So I've brought this up before, but after messing with the code on multiple occasions it seems that having a modified time mult on a ship is still somehow blocking the shield deploy command of both the fortress shield AI and any manually coded such commands in the ship system code. So, unless I missed something at this point, I think this might be a vanilla bug of sorts. I even tried suspending the time mult during system activation, but clearly the mult remains active on the first frame of the system activation, resulting in the code not executing properly and the system shutting off immediately as there's no shield.
Logged
My mods: Tahlan Shipworks - ScalarTech Solutions - Trailer Moments
It's all in the presentation

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5673 on: November 16, 2019, 12:04:03 PM »

Dug into this, and, right, you're right! Fixed this on my end. (It's... complicated. The fast-time stuff has some, ah, interesting code.)

As far as what you might do, hmm. The only thing that comes to mind is using ship.getShield().toggleOn() somewhere - that should work, fast-time or not.
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5674 on: November 16, 2019, 03:36:16 PM »

so I'm trying to set up one of the industrial structures I'd created with a variable upgrade path, basically so that when the player chooses to do an upgrade they can select which particular structure they want to upgrade to. checking the vanilla industries this looks like it's handled by the tags in the industries.csv, specifically parent_item and sub_item, and was wondering if anyone had some insight in how to get these to work; the best I've managed so far is to get it not crash when trying to do an upgrade (the selected structure literally upgrades into itself.)
« Last Edit: November 16, 2019, 03:55:51 PM by MShadowy »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5675 on: November 16, 2019, 05:12:14 PM »

These only work for the initial industry selection, i.e. how for orbital stations you pick which kind to build. It's not set up to handle multiple possible upgrades to choose from; among other things, there's no UI for that.

Probably the closest thing you could do is have multiple installable items and have the industry change behavior depending on which you install. I think you should be able to set it up - using an InstallableIndustryItemPlugin - so that the item is consumed when used, and that once you do it once, the options to install/uninstall an item don't show up.
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 #5676 on: November 17, 2019, 04:46:34 AM »

Dug into this, and, right, you're right! Fixed this on my end. (It's... complicated. The fast-time stuff has some, ah, interesting code.)

As far as what you might do, hmm. The only thing that comes to mind is using ship.getShield().toggleOn() somewhere - that should work, fast-time or not.

Heh. Leave it to a modder like me who uses the fast time stuff more than they should to find the bugs with those. Anyhow, that method seems to work so hurray and thanks o7
Logged
My mods: Tahlan Shipworks - ScalarTech Solutions - Trailer Moments
It's all in the presentation

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5677 on: November 17, 2019, 09:41:53 AM »

Glad that did it, and thanks for bringing it up again!
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 #5678 on: November 18, 2019, 02:50:44 PM »

Well... I seem to have messed something up considerably haha.

This thread has the reported error and I'm not seeing this in my campaign, so I'm wondering at the details of how this could even happen?:

https://fractalsoftworks.com/forum/index.php?topic=17278.0

Brief summary:

It was fine until I noticed that some of the planets were broken. The supply and demand column was completely empty in the colony info, so it sold no resources and had very low stability due to food shortages. There was also no administrator or people on the comm list. This affected Askonia, Maysura, Cannan, and Corvus, but the new faction planets were completely unaffected.

The glitch affected port Tse, mairaath, lost astropolis, volturn, askonia, crour, Asher, gilled, umbra, nortia, jangle, and asharu. Sorry about the confusion over which markets were affected.

My market implementation:

95% - JSON files under:

"data\campaign\econ"

Available here:
https://www.dropbox.com/sh/ekmxcujb6lhg6v1/AABCAh9aTuTtMjB7w22gvxZla?dl=0

5% Java in the jar for a market in Eldrus that acts very similar to Derinkyu station in that it is linked to the TutorialEvent.

Code
        SectorEntityToken eldrus = system.getEntityById("eldrus");

        eldrus.getMarket().addIndustry("spaceport");
        eldrus.getMarket().addIndustry("mining");
        eldrus.getMarket().addIndustry("grounddefenses");
        eldrus.getMarket().addIndustry("patrolhq");
        eldrus.getMarket().addIndustry("waystation");

        PersonAPI stationCommander = Global.getSector().getFaction("archean_order").createRandomPerson();
        stationCommander.setPostId("baseCommander");
        stationCommander.setRankId("groundGeneral");
        eldrus.getMarket().getCommDirectory().addPerson(stationCommander);
        eldrus.setActivePerson(stationCommander);

        PersonAPI portmaster = Global.getSector().getFaction("archean_order").createRandomPerson();
        portmaster.setPostId("portmaster");
        portmaster.setRankId("groundCaptain");
        eldrus.getMarket().getCommDirectory().addPerson(portmaster);

        PersonAPI supplyManager = Global.getSector().getFaction("archean_order").createRandomPerson();
        supplyManager.setPostId("supplyOfficer");
        supplyManager.setRankId("groundLieutenant");
        eldrus.getMarket().getCommDirectory().addPerson(supplyManager);

        PersonAPI administrator = Global.getSector().getFaction("archean_order").createRandomPerson();
        administrator.setPostId("administrator");
        administrator.setRankId("citizen");
        eldrus.getMarket().getCommDirectory().addPerson(administrator);

        Global.getSector().getEconomy().addMarket(eldrus.getMarket(), false);

With these replaced:

Code
         "data\\campaign\\econ/aztlan.json",
         "data\\campaign\\econ/arcadia.json",
         "data\\campaign\\econ/askonia.json",
         "data\\campaign\\econ/eos.json",
         "data\\campaign\\econ/isirah.json",
         "data\\campaign\\econ/canaan.json",
         "data\\campaign\\econ/algebbar.json",
         "data\\campaign\\econ/kumarikandam.json",
         "data\\campaign\\econ/magec.json",
         "data\\campaign\\econ/naraka.json",
         "data\\campaign\\econ/valhalla.json",
         "data\\campaign\\econ/samarra.json",
         "data\\campaign\\econ/mayasura.json",
         "data\\campaign\\econ/thule.json",
         "data\\campaign\\econ/tyle.json",
         "data\\campaign\\econ/yma.json",
         "data\\campaign\\econ/zagan.json",
         "data\\campaign\\econ/corvus.json",

Any nudges in the right direction greatly appreciated! I'm looking into this more later tonight.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5679 on: November 18, 2019, 08:25:36 PM »

Is there a way to force the AI to just set a weapon (or weapon group) to autofire and not operate it manually? Like a weapon tag, maybe? Setting ships to autopilot makes the AI take over the autofire stuff and does a bad job of manually controlling the weapons.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5680 on: November 19, 2019, 08:17:02 AM »

@Morrokain: are all the .json files in your mod_info.json "replace" section? "markets" is an array so if not you'll end up with those being appended to the core files and who even knows what'll happen then.

Is there a way to force the AI to just set a weapon (or weapon group) to autofire and not operate it manually?

You could have a script turn autofire on for that group every frame. It may flicker off for a frame when the AI decides to turn it off but functionally this should be about the same as it being permanently on.
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 #5681 on: November 19, 2019, 10:09:55 AM »

@Morrokain: are all the .json files in your mod_info.json "replace" section? "markets" is an array so if not you'll end up with those being appended to the core files and who even knows what'll happen then.

Yes they are replaced. See the bottom of my post for the code snippet of the replace array in case I messed something up there.

I had originally thought it was another one of those operating-system-specific deliminator issues like from .9 but the really weird thing is that it only affects some markets according to the report rather than all markets defined in the file. You'd think it would be universal to the markets if it wasn't being replaced and all of them were being appended.

It works fine for me though so I'm kind of at a loss as to how to proceed with troubleshooting.  :-\

I'll try a few more things to reproduce it a bit later.
Logged

Armithaig

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
    • Amaranth
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5682 on: November 19, 2019, 10:24:52 AM »

Blocking ship fire in a ShipSystemStatsScript.apply() appears ineffectual whichever way'm cutting it except the deprecated USE_SELECTED_GROUP command.
Assume'd be because the scripts're advanced after weapons are, but might be out on a bicycle tourney.

Idea was to both dodge the screen clipping status effect list ya get from blocking most ship control (Maybe 3-state enums in csv instead of bool, e.g. DEFAULT|DISABLE|HIDDEN) and have weapons fire only blocked during a specific portion.

*cough* pardon the russian
Code
class SomeSystemStats : BaseShipSystemScript() {
    override fun apply(stats: MutableShipStatsAPI, id: String, state: State, effect: Float) {
        ship.blockCommandForOneFrame(ShipCommand.FIRE)
        ship.isHoldFireOneFrame = true
    }
}
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5683 on: November 19, 2019, 10:28:21 AM »

Yes they are replaced. See the bottom of my post for the code snippet of the replace array in case I messed something up there.

I had originally thought it was another one of those operating-system-specific deliminator issues like from .9 but the really weird thing is that it only affects some markets according to the report rather than all markets defined in the file. You'd think it would be universal to the markets if it wasn't being replaced and all of them were being appended.

It works fine for me though so I'm kind of at a loss as to how to proceed with troubleshooting.  :-\

I'll try a few more things to reproduce it a bit later.

Ah, my bad, missed that. ... really not sure, then, sorry!

Blocking ship fire in a ShipSystemStatsScript.apply() appears ineffectual whichever way'm cutting it except the deprecated USE_SELECTED_GROUP command.
Assume'd be because the scripts're advanced after weapons are, but might be out on a bicycle tourney.

Idea was to both dodge the screen clipping status effect list ya get from blocking most ship control (Maybe 3-state enums in csv instead of bool, e.g. DEFAULT|DISABLE|HIDDEN) and have weapons fire only blocked during a specific portion.

*cough* pardon the russian
Code
class SomeSystemStats : BaseShipSystemScript() {
    override fun apply(stats: MutableShipStatsAPI, id: String, state: State, effect: Float) {
        ship.blockCommandForOneFrame(ShipCommand.FIRE)
        ship.isHoldFireOneFrame = true
    }
}

The .FIRE command is just LMB-equivalent and won't stop autofire, perhaps this is the issue? You could also try calling setHoldFireOneFrame() which should prevent autofire for one frame as well.
Logged

Armithaig

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
    • Amaranth
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5684 on: November 19, 2019, 10:38:32 AM »

Ah my bad about the russian, the ship.isHoldFireOneFrame = true is some syntactical kotlin glue for ship.setHoldFireOneFrame(true);
Will make an effort to convert things to java in the future.
Logged
Pages: 1 ... 377 378 [379] 380 381 ... 710