Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: Skill Changes, Part 2 (07/15/21)

Pages: 1 ... 456 457 [458] 459 460 ... 519

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18906
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6855 on: October 16, 2020, 12:17:37 PM »

Ah - that's basically just never going to work. The ship is created from the variant once, and if you change the variant's weapons, that's not going to re-create the ship. You'd need to spawn another ship and replace this one with it, though that might have implications e.g. for things already targeting the "old" version etc, though in theory that should work.
Logged

shoi

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6856 on: October 16, 2020, 05:35:32 PM »

That's actually exactly what I did, I changed the variant then forced the fighter to redock, which let it spawn in with the new weapons.

Alas, i'll just take this since i can't find a better  solution. This is for a ship that isn't very common anyway so it's probably fine
Logged

Tokanova

  • Ensign
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6857 on: October 16, 2020, 06:48:56 PM »

Hi there, I was just wondering, why are there such strict modding guidelines?
IE, why all the effort to try and balance mods?
I was just wondering, because I was thinking of getting into modding and just making OP BS for the heck if it,  and when I read the 'guidelines' thread I was a bit worried.

These are just mods right? Can't users decide if they themselves want to play with OP mods or not, instead of putting the burden of balance on the modders?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18906
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6858 on: October 16, 2020, 07:04:20 PM »

Hi! The guidelines are for if you want to make a mod that "fits in" nicely with vanilla/other mods and is balanced etc, so it's there to help you do that *if you want*, not to restrict what you can do.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2061
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6859 on: October 16, 2020, 07:24:20 PM »

If you know you are making OP BS and that is your goal, then I say go for it! There is quite a bit of silly stuff lurking around the modiverse.

The guidelines thread is to help new modders avoid breaking things, because if you push stats, systems, etc. too far then the ship or whatever becomes boring or the AI can't use it or what-not.

The idea of balancing mods is to keep vanilla and "balanced" mod content at the same relative power. For example, if every mod makes their capital ship the same strength as the Paragon battleship, then the Paragon stops being special because it is not relatively strong anymore.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6860 on: October 17, 2020, 10:10:27 AM »

Trying to make a hullmod that increases range of modules on a ship

Code
        List<ShipAPI> children = ship.getChildModulesCopy();
        if(children != null && !children.isEmpty()) {
        for (ShipAPI module : children) {
        module.getMutableStats().getBallisticWeaponRangeBonus().modifyMult(id, 1 + RANGE_MULT);
        }
        }

Does not work when put in applyEffectsAfterShipCreation, but does in advanceInCombat

I don't want it in advanceInCombat because it becomes more combat bloat, how to fix it? using customdata to make it run once also doesn't help because the game still has to check for the custom value and in the end also becomes bloat
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18906
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6861 on: October 17, 2020, 03:45:43 PM »

Well, the game handles this sort of thing by putting the hullmod on all the modules. See for example the "Targeting Supercomputer" that stations have, which is built into every station module that has guns, etc.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6862 on: October 17, 2020, 08:00:48 PM »

Well, the game handles this sort of thing by putting the hullmod on all the modules. See for example the "Targeting Supercomputer" that stations have, which is built into every station module that has guns, etc.
I want to reuse the modules on different ships, and not all of them will have this hullmod
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18906
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6863 on: October 17, 2020, 08:13:10 PM »

Hmm - then you can either:
1) Use the advanceInCombat() method, which will have minimal impact if, say, you set a flag once you've applied the stats change and check this flag and exit out early, or
2) Make multiple variants of these modules

Ah, I see you said this regarding #1:
I don't want it in advanceInCombat because it becomes more combat bloat, how to fix it? using customdata to make it run once also doesn't help because the game still has to check for the custom value and in the end also becomes bloat

If you just put a boolean into customdata and check if it's present, that's nothing to be concerned about at all unless you're doing it thousands of times (or perhaps considerably more) every frame. A single check like that, you really, really don't need to worry about! That's pretty much a standard approach to "not doing things".
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3270
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6864 on: October 17, 2020, 08:27:17 PM »

The hullmod could automatically propagate itself to the modules (and remove itself from modules if the parent hull no longer has it). A bit like how the Interferences modded hullmod automatically adds itself when needed.
Logged

shoi

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6865 on: October 20, 2020, 02:52:20 PM »

Code
				

for(DamagingProjectileAPI proj : explodingProjectiles)
{
if(interval2.intervalElapsed())
{
DamagingProjectileAPI newProj = (DamagingProjectileAPI)
engine.spawnProjectile(ship, null, "armaa_einhanderGunS",proj.getLocation(), shotAngle, proj.getVelocity());
engine.spawnProjectile(ship, null, "armaa_einhanderGunS",proj.getLocation(), shotAngle2, proj.getVelocity());
shotAngle+=30;
shotAngle2+=30;
}


if(proj.isFading())
{
toRemove.add(proj);

}
}

explodingProjectiles.removeAll(toRemove);

I have this running in a for loop for a list of projectiles.
So it spawns bullets in a certain pattern until it starts to fade, then I add it to another arraylist to be deleted once the loop ends. Once the projectile gets removed, the engine stops spawning bullets at its location.

BUT

if the projectile hits something first, it just spawns bullets endlessly. So clearly it isn't being removed from the array because it never faded. My question is, what can I evaluate to remove an "expired" bullet from the arraylist? I tried checking if proj == null to no success :(


fix:onHit script that just deletes bullet
« Last Edit: October 21, 2020, 01:38:39 AM by shoi »
Logged

shoi

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6866 on: October 21, 2020, 10:32:14 PM »

weapon.getCooldownRemaining() works fine normally, but when  I use it to check cooldown time is 0 on something under some type of time mod (say temporal shell) it starts firing off inconsistently. Is there something extra I need to do for those cases?
Logged

Arngrim

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6867 on: October 22, 2020, 04:16:31 PM »

Hey, I was wondering if it´s possible to make animated projectiles? Let´s say the projectile is a circle and I want to make it rotate as it travels.
Logged

PureTilt

  • Ensign
  • *
  • Posts: 24
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6868 on: October 26, 2020, 05:07:06 AM »

i want to make option to change portrait mid game, is it possible to use portrait picking window from new game menu?
Logged




Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18906
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6869 on: October 26, 2020, 03:07:41 PM »

weapon.getCooldownRemaining() works fine normally, but when  I use it to check cooldown time is 0 on something under some type of time mod (say temporal shell) it starts firing off inconsistently. Is there something extra I need to do for those cases?

(Sorry for the delay!)

Hmm, that's not really enough info. What's "inconsistently", vs what are your expectations? It would also help to see your code - or, rather, a minimal snippet that produces the behavior.


Hey, I was wondering if it´s possible to make animated projectiles? Let´s say the projectile is a circle and I want to make it rotate as it travels.

It's possible, but the details... I'm not 100% sure on off the top of my head, maybe someone more versed in modding this stuff in can chime in. The good news is it'll be significantly easier in the next release - there are plugins more or less explicitly for that sort of thing.


i want to make option to change portrait mid game, is it possible to use portrait picking window from new game menu?

I don't think this is exposed via the API, no. You'd have to code up a custom selector - doable (see: com.fs.starfarer.api.impl.campaign.ExampleCustomUIPanel), but some work.


What are the odds of having a `beforeGameLoad` hook added to `ModPlugin`?

The use case I'm thinking of is detecting save-breaking mod updates and showing an user-friendly message before the save file is deserialized and blows up.

The game already shows a "mod compatibility warning" when you try to load the game (I'm not 100% sure if this is in 0.9.1a, actually), and will also show the saved with/current versions for all the mods involved in the save game's tooltip, so I think this should be covered?
Logged
Pages: 1 ... 456 457 [458] 459 460 ... 519