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 ... 456 457 [458] 459 460 ... 706

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

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6855 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: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6856 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: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6857 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: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6858 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 #6859 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: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6860 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 #6861 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: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6862 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: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6863 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

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6864 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

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6865 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 #6866 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

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6867 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: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6868 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

shoi

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



(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.



Hi, and no worries! Here's a video of what im talking about https://imgur.com/a/9OSiZ7e
You can see the first time I shoot, I think all the bullets spawn correctly. But the next time I use the system, only one bullet is spawned in while firing.

So I have a weapon that fires a burst of 8 shots. The ship this issue is on has a system that replaces these shots with a stronger version of them.
To prevent bullets appearing when they shouldn't, I added (if(weapon.getCooldownRemaining() <= 0)) as a condition, which works flawlessly..or almost always, anyway. BUT when time dilation effect is active, sometimes bullets will spawn, and sometimes they wont.

Puretilt actually helped me with this, because he had a similar issue, and well, I will post my code, and then the conclusion he came to. This is in an every frame weapon effect script.
Code: java
				

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {


for (DamagingProjectileAPI proj : engine.getProjectiles())
{
//if this is one of our projectiles and hasn't been accounted for
if (weapon == proj.getWeapon() && !registeredProjectiles.contains(proj) && !explodingProjectiles.contains(proj))
{
//add it (prevent infinite bullet works)
registeredProjectiles.add(proj);

//If the weapon can actually fire
if(weapon.getCooldownRemaining() <= 0)
{
FluxTrackerAPI fluxLevel = weapon.getShip().getFluxTracker();
//Spawn the new projectile
DamagingProjectileAPI newProj = (DamagingProjectileAPI) engine.spawnProjectile(ship, weapon, "armaa_einhanderGun2", proj.getLocation(), proj.getFacing(), ship.getVelocity());

if(fluxLevel.getCurrFlux()+weapon.getFluxCostToFire() > fluxLevel.getMaxFlux())
{
fluxLevel.forceOverload(0f);
}

else
fluxLevel.setCurrFlux(fluxLevel.getCurrFlux()+weapon.getFluxCostToFire());

//ad the new proj for fx stuff later
explodingProjectiles.add(newProj);
Global.getSoundPlayer().playSound("plasma_cannon_fire", 1f, 0.7f, newProj.getLocation(), newProj.getVelocity());
}
//remove old bullet
Global.getCombatEngine().removeEntity(proj);
}
}
}


I don't 100% remember the specifics of the issue now, but it seemed like there is a delay with spawning bullets under time dilation? What tilt did was add a 2 frame delay to his script, which fixed his issue, but I just disabled being able to use this specific ships right click to get around it for the time being
Logged
Pages: 1 ... 456 457 [458] 459 460 ... 706