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 ... 322 323 [324] 325 326 ... 706

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

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4845 on: August 23, 2019, 01:01:14 AM »

Are phase systems not considered shields for the ShieldAPI and thus returning null?
You guessed it.
Code
ship.getPhaseCloak().isActive()

bowman

  • Commander
  • ***
  • Posts: 101
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4846 on: August 23, 2019, 01:23:00 AM »

@Sundog that did it, thank you :)

now I just need to sprite a new ship for it..
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4847 on: August 23, 2019, 01:40:26 AM »

No problem! I look forward to seeing what you come up with  :)

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4848 on: August 23, 2019, 02:49:56 AM »

How does economyIntervalnGameDays affect patrols? I noticed that it may have something to do with battles lost.
Logged

NoFoodAfterMidnight

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4849 on: August 23, 2019, 06:25:51 AM »

How are buffs to fighters handled? Right now I'm giving a combat buff to all ships within a fleet using .getFleetData().getMembersListCopy(), which is working for the ships but not the fighters. I've looked at the fighter-specific skills, which led me to the skill effect type but no reference as to how it's affecting fighters.

Also where are derelict ships created after combat (the ones floating through space), and where is ship recovery handled?
Logged

Hoon

  • Ensign
  • *
  • Posts: 11
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4850 on: August 23, 2019, 08:33:20 AM »

Is it possible Im importing the wrong things?
It looks to me like you've got all your bases covered as far as imports are concerned. My guess at this point is that there's something wrong with your hull_mods.csv file. If you want to zip up your mod and send it to me I'd be happy to take a look.

@Varya: This stretches the limits of my knowledge a bit (hopefully Alex will correct me if I'm wrong), but...
Looking through decompiled code of createFleetMember, I see that it assigns the instance of the variant you pass it, so it looks to me like it should be the same key. Of course, it's always possible that it's changed later. If you want to make sure, you should be able to check for instance equality like this:
Code
if(if(member.getVariant() == shipData.variant)) {
    // Notify you somehow
}
clone() creates a new instance, which is the method of comparison used by HashMaps for objects that don't override equals() and hashCode(), so each clone should work as a unique key, even if they all have the same values.

sure thing, here is the file. I've tried everything and at this point its just a simple mistake i missed

[attachment deleted by admin]
Logged

Zer0

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4851 on: August 23, 2019, 08:38:56 AM »

Hello!

Recently I have been working on a mod that adds an Industry which effects kick in after a cycle. For that, I made two separate buildings:
  • MyIndustryBuilding - 60 days to build, after it's completion it automatically starts upgrading to (2):
  • MyIndustryBuilding_Complete -360 days to finish upgrading. If the player cancels the upgrade mid-way the construction progress doesn't drop to 0 but it starts decreasing until it reaches 0 and destroys itself. If it finishes upgrading its effects kick in, and when the player wants to shut it down, it goes to (1) from the maximum build progress and starts decreasing it until 0.

When I went to test it, I noticed the left-click (or right-click, I forgot) menu wasn't really what I wanted. For example, when it reaches (2) it says "downgrade to (1)..." but I wish for it to say something else. I had gone digging and haven't found anything regarding said menu or its options. Also, I wanted to have the option "cancel downgrade" added when going from (2) to (1) (or after the upgrade to (2) is cancelled) but I had similar luck and have found nothing that I could use.

My question is how would it be possible (if at all) to rename a context menu option (right/left click menu on a Building), or even perhaps remove, change behaviour or add a new option.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4852 on: August 23, 2019, 09:54:52 AM »

... and I can therefore store data in the hullmod with the ShipVariantAPI as a key

There's only one instance of each HullModEffect *per application session*, and it doesn't go into the savefile, at any rate. I'd say as a general rule, just don't do it period. E.G. if the variant - or whatever data you store keyed off it - references the Sector somewhere down the line, bam, that's a Sector-sized memory leak when you load a game.

If you need to store stuff long-term, use Global.getSector().getMemory() or Global.getSector().getPersistentData(). It's about the same, really, as far as which to use; persistentData is just a straightforward map.


How does economyIntervalnGameDays affect patrols? I noticed that it may have something to do with battles lost.

It used to affect their spawn rate but doesn't anymore. See: averagePatrolSpawnInterval

(You might be looking at some older PatrolFleetManager* classes which are no longer used...)


How are buffs to fighters handled? Right now I'm giving a combat buff to all ships within a fleet using .getFleetData().getMembersListCopy(), which is working for the ships but not the fighters. I've looked at the fighter-specific skills, which led me to the skill effect type but no reference as to how it's affecting fighters.

Fighters don't exist in the campaign in the same way that ships do, so if you're going to buff them, it needs to happen in combat. Probably better to do this for ships, too - what you're doing might be alright, but it's just easier to do something with long-term effects if it's not managed properly. (See: BuffManagerAPI, TempBuff etc...)

For example, using .getFleetData().getMembersListCopy() would only work if you're using that to apply Buffs, not modify stats directly. If you're already doing that, though, and it expires (or doesn't) in the way that you want, you're probably fine.

Also where are derelict ships created after combat (the ones floating through space), and where is ship recovery handled?

See: CoreScript.generateOrAddToDebrisFieldFromBattle()

Also see: ShipRecoverySpecial and SalvageSpecialInteraction


Hello!

Hi!

My question is how would it be possible (if at all) to rename a context menu option (right/left click menu on a Building), or even perhaps remove, change behaviour or add a new option.

Ahh, these really aren't configurable, the upgrading/downgrading works along a pretty set pattern. You might be able to do something with the 2nd building being "upgradeable" to the first, though - then it'd take time to "downgrade" (via an upgrade) so it'd probably be closer to what you want.

But "it takes time to shut down", I can't see how to make work, offhand. Just in general, that menu isn't very configurable, aside from being able to take custom special items.
Logged

Zer0

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4853 on: August 23, 2019, 10:36:37 AM »

My question is how would it be possible (if at all) to rename a context menu option (right/left click menu on a Building), or even perhaps remove, change behaviour or add a new option.

Ahh, these really aren't configurable, the upgrading/downgrading works along a pretty set pattern. You might be able to do something with the 2nd building being "upgradeable" to the first, though - then it'd take time to "downgrade" (via an upgrade) so it'd probably be closer to what you want.

But "it takes time to shut down", I can't see how to make work, offhand. Just in general, that menu isn't very configurable, aside from being able to take custom special items.

Dang, no luck with the menu.
Fortunately, I did manage to do what I wanted to do with the delayed shutdown/effects in a kinda hacky way, but if it works it works!

Anyway, thank you  ;D!
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4854 on: August 23, 2019, 10:53:11 AM »

Stupid question that I know was already answered, but I cannot find it in the thread.

For burst weapon, damage per shot = total damage of the burst?
So a 3 round burst weapon with 300 daamge_per_shot means 100 damage per shot in reality?
Logged

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4855 on: August 23, 2019, 10:53:55 AM »

It used to affect their spawn rate but doesn't anymore. See: averagePatrolSpawnInterval

(You might be looking at some older PatrolFleetManager* classes which are no longer used...)

I see, thank you. One more thing. I know that sound is muted when you can't see the source. I increased zoom distance a bit and when i pan the camera a bit off the center of my ship, due to long range weapons, there is no sound despite the source being in the frame (closer to the edges but still).

Really a minor thing, but i'm wondering if there is a way to adjust it. Did take a glance at the code but figured i might just ask, since i understand that not everything is moddable.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4856 on: August 23, 2019, 11:04:05 AM »

Stupid question that I know was already answered, but I cannot find it in the thread.

For burst weapon, damage per shot = total damage of the burst?
So a 3 round burst weapon with 300 daamge_per_shot means 100 damage per shot in reality?

Per shot is per shot, not per burst. (Edit: to be 100% clear, in your example, it'd be 900 damage per burst.)

(The only sort-of-exception here is multi-barreled beams where the damage per second is the total for all barrels.)


I see, thank you. One more thing. I know that sound is muted when you can't see the source. I increased zoom distance a bit and when i pan the camera a bit off the center of my ship, due to long range weapons, there is no sound despite the source being in the frame (closer to the edges but still).

Really a minor thing, but i'm wondering if there is a way to adjust it. Did take a glance at the code but figured i might just ask, since i understand that not everything is moddable.

Right, yeah, that's another thing that's not moddable - sound playback is based on the distance of the sound from the center of your view, and if it's too far (based on a hardcoded value), it just doesn't play at all.
Logged

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4857 on: August 23, 2019, 11:17:30 AM »

Right, yeah, that's another thing that's not moddable - sound playback is based on the distance of the sound from the center of your view, and if it's too far (based on a hardcoded value), it just doesn't play at all.

Okay. So i guess one way to compensate would be to reduce the max zoom and free the camera pan a bit. Would that be moddable?
Logged

NoFoodAfterMidnight

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4858 on: August 23, 2019, 11:25:08 AM »

So then I should make sure - what is the buff timer counting? game updates/frames, game months, or something else? I have my buffs set to an exorbitant number so they hopefully never expire.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4859 on: August 23, 2019, 11:57:16 AM »

Right, yeah, that's another thing that's not moddable - sound playback is based on the distance of the sound from the center of your view, and if it's too far (based on a hardcoded value), it just doesn't play at all.

Okay. So i guess one way to compensate would be to reduce the max zoom and free the camera pan a bit. Would that be moddable?

Yeah, mods have extensive viewport control, see: ViewportAPI, CombatEngineAPI.getViewport(), etc. Will take a bunch of code and thought, though, I wouldn't call creating something here that works well and feels good to use "easy".


So then I should make sure - what is the buff timer counting? game updates/frames, game months, or something else? I have my buffs set to an exorbitant number so they hopefully never expire.

That ought to be fine, probably. As long as you're not accidentally applying them multiple times with different ids, that sort of thing.
Logged
Pages: 1 ... 322 323 [324] 325 326 ... 706