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)

Pages: 1 ... 357 358 [359] 360 361 ... 706

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

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5370 on: October 12, 2019, 12:53:38 PM »

I'd suggest checking out com.fs.starfarer.api.impl.campaign.intel.bases.PirateBaseIntel, since that creates a market-with-a-station that looks like a stand-alone station. The remnant stuff you're looking at is fairly old and if I had to do it again I'd probably use the market approach.

Will do, although I'm still unsure about the patrols. Pirate and Pather bases spawn them from the military base industry I assume, while the remnant station has a separate script. I guess I could make a unique industry and remove the script or something, but there are 3 classes that are involved in the battlestation fleets, namely RemnantSeededFleetManager, RemnantAssignmentAI and RemnantStationFleetManager. I don't want to mess with it too much, so that's why I'm wondering why the script buggs out. Ultimately, I could just make the station have a much stronger finite contingent of ordos and ignore the whole respawning business.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5371 on: October 12, 2019, 02:21:35 PM »

Ah, ok, I see. You could probably stick with that approach, yeah, and just create a fake market with the station set as its primary entity; would take some experimenting to see if it works, though.

Edit: as far as creating the market, PirateBaseIntel should still be a useful point of reference, I think.
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 #5372 on: October 12, 2019, 03:40:31 PM »

Thanks! I suppose the best thing for me to do in this case would be to give all the ranks and posts names such that weird immersion breaking combinations like:

Post: Grand Baron

Rank: Servant

Isn't possible. :P

It sounds a bit backwards - "post" is an assignment, so "Servant" would be a reasonable post, while rank is a military rank, so "Grand Baron" would be a reasonable rank. And, heck, that even makes the combination of "rank: Grand Baron, post: Servant" make sense/feel like maybe there's a story behind it, rather than just looking totally wrong :)

Whoops yep that was off the top of my head in the actual file those are reversed haha. I can see what you mean as far the story portion of it, but not in this particular faction (evil faction). If you are servant as a post you would never be a Baron, let alone a Grand Baron, and a anyone who went from any other post to Servant would lose their military rank altogether (it is essentially slavery in this case since they are a vampire faction).
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5373 on: October 13, 2019, 06:54:52 AM »

I need help here, I am trying to make a quite unique system

I want to make hologram ships, the way i plan to make those is from using the station drone system with the drones being big fighters with the same sprite as the mothership, the problem comes from when they get hit, i want to have the holograms either vanish or glitch out (jittering/variations in the sprite alpha/afterimages) when hit, but I am not sure on how to make those work.

1: Vanish
There are two possible ways to do this one, by retracting the drone instantly like the ship system that teleports fighters back to the ship or by killing it, either way, i am afraid this could cause nullpointers by having the ship vanishing when something is selecting/tracking it/etc...
1 a) Retracting: I haven't checked yet, but i suspect the source code from recall device will not work on these drones, also they are not the ship main system they will be the defensive system.
2 b) Destroying: I would need a way to kill and make the ship vanish without leaving anything behind, nor exploding and in a way it is safe as to not cause nullpointers from anything selecting it

2: Glitching
This is more simple, the player can see the visual effects and notice this is a hologram, but the AI would need a way to figure out this is not a real target and ignore it, is there a way to make the AI completely ignore a ship temporarily?

Either solution is fine, but i need help to reach any of them here.
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5374 on: October 13, 2019, 09:59:57 AM »

Should be fine as far as vanish; no worry of NPEs there - anything targeting it will have its own reference so you wouldn't be able to set that to null even if you tried. Might look at how phase skimmer type systems work - a "jitter" effect to teleport out (and then just disappear) might be neat.

As far as making the AI ignore it: you couldn't do it per-ship, that I can think of, but either of ship.setOwner(100) and setting the ship's stats.getHullDamageTakenMult() to 0 should do the job globally.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5375 on: October 13, 2019, 10:10:41 AM »

Should be fine as far as vanish; no worry of NPEs there - anything targeting it will have its own reference so you wouldn't be able to set that to null even if you tried. Might look at how phase skimmer type systems work - a "jitter" effect to teleport out (and then just disappear) might be neat.

As far as making the AI ignore it: you couldn't do it per-ship, that I can think of, but either of ship.setOwner(100) and setting the ship's stats.getHullDamageTakenMult() to 0 should do the job globally.
Thanks, i will try it tonight
Logged
Check out my ships

TysonMcnuggets

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5376 on: October 13, 2019, 12:05:47 PM »

Hey guys, I am trying to update the old Battlestar Galactica Mod and I am running into a roadblock with an error that is preventing the game from loading. I've deleted all of the old shipsystems from all of the ships that I am trying to update and have re-done them all in the ship editor. I did the same with the variants and the weapons. I tried removing all references to the CEC_Z12 weapon from the mod files to see if that was the issue but it just had the same error. Any solutions? Thanks in advance.

Spoiler
2267 [Thread-4] INFO  com.fs.starfarer.loading.WeaponSpecLoader  - Loading weapon [data\weapons\CEC_Z12.wpn]
2268 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.AlGebbar
2268 [Thread-4] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading JSON from [DIRECTORY: C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\BattleStar Galactica Update (data\weapons\CEC_Z12.wpn)]
2271 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.Arcadia
2275 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.Askonia
2282 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.Aztlan
2288 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.loading.specs.N.setProjectileSpec(Unknown Source)
   at com.fs.starfarer.loading.WeaponSpecLoader.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.WeaponSpecLoader.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.SpecStore.ÒO0000(Unknown Source)
   at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
2289 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.Canaan
2293 [Thread-7] INFO  com.fs.starfarer.loading.scripts.new  - Loading class: data.scripts.world.systems.Duzahk
[close]

EDIT: Just figured it out, forgot to copy over the proj file from the old mod. While I am here does anyone know how I can put the mod ships into the simulator so I can pit them against each other?
« Last Edit: October 13, 2019, 12:13:44 PM by TysonMcnuggets »
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 #5377 on: October 13, 2019, 01:29:47 PM »

Quote
97339 [Thread-4] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading JSON from [DIRECTORY: C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\Archean Order TC v1.3.4 (data\campaign\econ/mordreath.json)]
98718 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IllegalArgumentException: n must be positive
java.lang.IllegalArgumentException: n must be positive
   at java.util.Random.nextInt(Unknown Source)
   at com.fs.starfarer.api.impl.campaign.intel.BaseEventManager.updateMax(BaseEventManager.java:37)
   at com.fs.starfarer.api.impl.campaign.intel.BaseEventManager.<init>(BaseEventManager.java:29)
   at com.fs.starfarer.api.impl.campaign.intel.PersonBountyManager.<init>(PersonBountyManager.java:16)
   at com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.addScriptsIfNeeded(CoreLifecyclePluginImpl.java:421)
   at com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.onNewGameAfterEconom yLoad(CoreLifecyclePluginImpl.java:662)
   at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.dialogDismissed(Unknown Source)
   at com.fs.starfarer.ui.N.dismiss(Unknown Source)
   at com.fs.starfarer.ui.impl.K.dismiss(Unknown Source)
   at com.fs.starfarer.campaign.save.if.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.newnew.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.I.0000(Unknown Source)
   at com.fs.starfarer.ui.I.processInput(Unknown Source)
   at com.fs.starfarer.ui.O0Oo.o00000(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

A player of my mod is getting this error on sector generation and I cannot reproduce it. I took a look at the file before the crash and I don't see anything obvious so maybe this error is unrelated?

I don't override BaseEventManager so I am not sure why there would be a negative value there being passed into Random.nextInt
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5378 on: October 13, 2019, 01:37:35 PM »

This will happen if, in settings.json, "minPersonBounties" is set higher than "maxPersonBounties".
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 #5379 on: October 13, 2019, 06:39:01 PM »

This will happen if, in settings.json, "minPersonBounties" is set higher than "maxPersonBounties".

Ah yeah that makes sense, thanks. My mod only overrides the maxPersonBounties setting so any player custom modifying the core setting for both might inadvertently have that issue. I'll see if that is the case.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5380 on: October 13, 2019, 07:47:29 PM »

How do i remove the red molten metal from the ship sprite? Since I a trying to make a hologram i need to have it go back to pristine hull status after glitching out (or at least mimic the status of the real ship)
Also how do i make the hologram vanish without leaving a hulk when the main ship is destroyed and the hologram goes with it?
Logged
Check out my ships

RustyCabbage

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5381 on: October 14, 2019, 12:13:39 AM »

Hi all, I've got this block of code implemented in EveryFrameScript:
Code: java
    public void applyCRPerDayChanges() {   
        for (FleetMemberAPI member : Global.getSector().getPlayerFleet().getFleetData().getMembersListCopy()) {
            String source = "sl_crpd";
            if (!member.getStats().getBaseCRRecoveryRatePercentPerDay().getMultMods().containsKey("sl_crpd")) {
                if (member.isFrigate()) {
                    member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_FRIGATE);
                }
                else if (member.isDestroyer()) {
                    member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_DESTROYER);
                }
                else if (member.isCruiser()) {
                    member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_CRUISER);
                }
                else if (member.isCapital()) {
                    member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_CAPITAL);
                }
            }
        }
    }
Basically it adjusts the CR%/day of every ship in the player fleet. It works fine, but these changes are unsurprisingly not reflected in the UI. I was wondering if there is a way to reflect these changes in the the stats screen or the mouseover details, ideally without changing the entire implementation into a hull mod. Any thoughts?

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5382 on: October 14, 2019, 09:28:12 AM »

How do i remove the red molten metal from the ship sprite?
I asked the same thing years ago for ICE, and back then there wasn't a way. That may have changed, but you might consider making all projectiles pass through the illusory ships instead. Not sure what the best CollisionClass would be for that. Perhaps:
Code: java
ship.setCollisionClass(CollisionClass.NONE);

Also how do i make the hologram vanish without leaving a hulk when the main ship is destroyed and the hologram goes with it?
Have you tried:
Code
Global.getCombatEngine().removeEntity(myIllusoryShip);

I was wondering if there is a way to reflect these changes in the the stats screen or the mouseover details, ideally without changing the entire implementation into a hull mod.
Pretty sure you just need to add a description of the effect as a third argument for modifyMult, like this:
Code: java
member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_FRIGATE, "reason for modifier");

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5383 on: October 14, 2019, 10:01:43 AM »

How do i remove the red molten metal from the ship sprite?
I asked the same thing years ago for ICE, and back then there wasn't a way. That may have changed, but you might consider making all projectiles pass through the illusory ships instead. Not sure what the best CollisionClass would be for that. Perhaps:
Code: java
ship.setCollisionClass(CollisionClass.NONE);

Also how do i make the hologram vanish without leaving a hulk when the main ship is destroyed and the hologram goes with it?
Have you tried:
Code
Global.getCombatEngine().removeEntity(myIllusoryShip);

But with collisionclass NONE will the NPCs even attempt to hit the illusions? The objective of those little guys is to keep the enemy weapons busy

Oh i didn't search "remove" i was looking for "destroy" instead, thanks

I will try those when i finish work
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5384 on: October 14, 2019, 10:10:19 AM »

How do i remove the red molten metal from the ship sprite?
I asked the same thing years ago for ICE, and back then there wasn't a way. That may have changed, but you might consider making all projectiles pass through the illusory ships instead. Not sure what the best CollisionClass would be for that. Perhaps:
Code: java
ship.setCollisionClass(CollisionClass.NONE);

Hmm, one possible option for this: respawn the hologram?

I was wondering if there is a way to reflect these changes in the the stats screen or the mouseover details, ideally without changing the entire implementation into a hull mod.
Pretty sure you just need to add a description of the effect as a third argument for modifyMult, like this:
Code: java
member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_FRIGATE, "reason for modifier");

That's part of it, but also: ship stats modifiers get cleaned out and recomputed fairly frequently. E.G. for the player fleet it'll happen any time you open the fleet screen, hover over a fleet or ship related tooltip, etc. This means that changing them directly in a script like this is not a good idea - the changes will never be reflected in the UI, and may be overwritten and not used at key moments.

What you want to do is look at FleetMemberAPI.getBuffManager(), and at com.fs.starfarer.api.impl.campaign.terrain.CRRecoveryBuff. EmergencyBurnAbility has an example using this to stop CR recovery temporarily.

The buffs from a BuffManager get applied at the right times and so will be seen in the UI and will actually work properly all the time.
Logged
Pages: 1 ... 357 358 [359] 360 361 ... 706