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 ... 37 38 [39] 40 41 ... 706

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

CrashToDesktop

  • Admiral
  • *****
  • Posts: 3876
  • Quartermaster
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #570 on: July 16, 2013, 09:55:20 AM »

It's not so much tweaking it.  It's that the base weapons for both are exactly the same (aside from the stuff inside the weapons.cvs file), and it'd save me a few headaches when coding into the game.
Logged
Quote from: Trylobot
I am officially an epoch.
Quote from: Thaago
Note: please sacrifice your goats responsibly, look up the proper pronunciation of Alex's name. We wouldn't want some other project receiving mystic power.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #571 on: July 16, 2013, 10:00:00 AM »

Spoiler
This part of the code I'm working on gives me a lot of errors.

Spoiler

139116 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.StackOverflowError
java.lang.StackOverflowError
   at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at com.fs.starfarer.campaign.fleet.FleetData.ÖøÕ000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)

[close]

------------------------------------------------------------------------------

        private void Cycle (CampaignFleetAPI fleet) {   
                float a = (float) Math.random();
                if (a > 0.3)    {
                    fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, null, (int) Math.random()*10 + 5);
                    } else {
                    fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), (int) Math.random()*10 + 5);
                    }   
                Script script = null;
      script = createArrivedScript(fleet, getAnchor());
                fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, getAnchor(), 10, script);
                }
       

   private Script createArrivedScript(final CampaignFleetAPI fleet, final SectorEntityToken station ) {
      return new FleetScript(fleet, station) {
                    public void run() {
                    Cycle(fleet);

...
... various checks on the fleet using many local variables and parameters changing the cargo of the fleet and the fleet composition. ...
...
                }
            };
   }

------------------------------------------------------------------------------

Is there any way I can make it prettier or less prone to crashes? It seems that this things I try to do gets smashed quickly by StackOverflow.
[close]

Changing the fleet composition is what's triggering this. It's a bug in the game, fixed it a little while ago actually.


Is is possible to have one .wpn file be the base for different weapons?  For example, I've got "mmm_1.wpn" and I want to make two different versions of it, same sprite, etc. but one has more ammo than the other.  That possible without having to copy the "mmm_1.wpn" twice?

No.
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #572 on: July 16, 2013, 12:10:55 PM »

Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray

It is using "projectile" tag, and therefor it is using charge up for projectile weapons.

It uses the "advance" and pre-set timers while its "weapon.IsFiring()", once a timer condition is met, the actual animation loop is changed.
The reason im using a beam for this would be because i can keep track of how long its been firing and also i can use the beam brightness to check if it stopped firing.
If you try the ship on a mission you can understand how the code works. Theres a small problem tho, when you release (fire) it still shoots a few extras due to the brightness condition still triggering.
Logged

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #573 on: July 17, 2013, 04:24:35 AM »

Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray

It is using "projectile" tag, and therefor it is using charge up for projectile weapons.

It uses the "advance" and pre-set timers while its "weapon.IsFiring()", once a timer condition is met, the actual animation loop is changed.
The reason im using a beam for this would be because i can keep track of how long its been firing and also i can use the beam brightness to check if it stopped firing.
If you try the ship on a mission you can understand how the code works. Theres a small problem tho, when you release (fire) it still shoots a few extras due to the brightness condition still triggering.

I am not sure we are talking about same version, the newest version of star control II, uses 4 weapons to define variable blaster, each of them just energy PROJECTILE with default chargup mechanism for projectile weapons, not using any scripts. (basicly there are 4 different PROJECTILE blasters in one group, with different charge up time, no script etc).

And by the way, is there way how to modify engines other then engine_styles.json ?
« Last Edit: July 17, 2013, 04:53:10 AM by Ravendarke »
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #574 on: July 17, 2013, 03:39:16 PM »

Theres 2 Mods of SC2, one made by Trylobot: http://fractalsoftworks.com/forum/index.php?topic=171.0
And a newer one by me: http://fractalsoftworks.com/forum/index.php?topic=3984.0

Im very sure you downloaded Try's mod, thats why its lacking the scripts and weapons
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #575 on: July 17, 2013, 04:26:40 PM »

I've got a small question. In my Bushi mod there's a dark matter weapon available, which charges up when you fire it and then releases its projectile.
The problem is: If you rapidly click your fire button, the sounds will overlap eachother, like you're firing a ton of shots, but the weapon only has 1 ammunition. Ofcourse it only fires once.

Is there a way to stop the charge-up sound from playing if you're out of ammo? Or some other way to only have the sound play once?
Logged
  

Silver Silence

  • Admiral
  • *****
  • Posts: 980
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #576 on: July 17, 2013, 04:59:03 PM »

I'd like to know as well, so that I can go off and fix every weapon that has this issue. IFed Mass Drivers, IFed Hadrons, Thule Barbarossas, Hiigaran Singularity Cannons, to name a few.

So long as the trigger is held, the weapon will continue to fire. In the case of the Hadron, it's caused me to take quite significant damage due to being under the impression that the Hadron Accelerator is not in use as I haven't recently heard the long and distinct charge up.

Preferably, there should be an option to force the charge-up sound effect every time the weapon has the ability to fire. I say option because otherwise weapons like vanilla Thumpers would produce ghastly sounds as they whir up and simultaneously fire several times a second.
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #577 on: July 18, 2013, 12:09:54 AM »

I've noticed this as well and it's became a really bother for me in the past.

I'd say that there is no solution from my experience, but perhaps some bright minds know better :)
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

FlashFrozen

  • Admiral
  • *****
  • Posts: 988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #578 on: July 18, 2013, 01:05:28 AM »

MWahahah I'll dig up old relevant quotes,

It's probably not a good idea to have the whole burst in the same sound file - consider what would happen if the ship overloaded / started venting / ran out of flux / etc mid-burst. Also consider that hull mods can change the rate of fire for a weapon.

That said, it shouldn't be playing the pre-burst sound if the weapon is on cooldown or can't fire for any other reason - I'll take a look.

The charge up/fireSoundOne is still imo a little wonky, it can play on chargedown/cooldown, empty ammo, while firing.

It something weird, all I know is that some of the problem comes from releasing the trigger before it fires, but having the weapon still play the sound,
It's fine if it charges up all the way fully (without releasing the trigger), but if you start clicking like mad, it just doesn't work well.
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #579 on: July 18, 2013, 03:31:43 AM »

That's a bummer.  :-\ I'll hope for a fix in the next update then. Thanks.
Logged
  

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #580 on: July 18, 2013, 04:46:18 AM »


And by the way, is there way how to modify engines other then engine_styles.json ?

Like this:

Code
      "style": "CUSTOM",
      "styleSpec": {
        "type": "GLOW",
        "engineColor": [
          68,
          250,
          50,
          255
        ],
        "contrailColor": [
          68,
          250,
          50,
          80
        ],
        "contrailParticleSizeMult": 1.0,
        "contrailParticleDuration": 0.25,
        "contrailMaxSpeedMult": 0.075,
        "contrailAngularVelocityMult": 0.0
      },
Logged

Ravendarke

  • Captain
  • ****
  • Posts: 276
  • Nemesis
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #581 on: July 18, 2013, 06:32:37 AM »


And by the way, is there way how to modify engines other then engine_styles.json ?

Like this:

Code
      "style": "CUSTOM",
      "styleSpec": {
        "type": "GLOW",
        "engineColor": [
          68,
          250,
          50,
          255
        ],
        "contrailColor": [
          68,
          250,
          50,
          80
        ],
        "contrailParticleSizeMult": 1.0,
        "contrailParticleDuration": 0.25,
        "contrailMaxSpeedMult": 0.075,
        "contrailAngularVelocityMult": 0.0
      },

Yep I know about this, I mean other properties, like texture etc, or if this ("engine_styles.json") is all we can redefine for engines.
Logged

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #582 on: July 18, 2013, 06:50:24 AM »

I think engine editing is fairly limited now, but I think I read somewhere that engines and shields will be able to custimized more in the upcoming version.
Please correct me if I'm wrong.
Logged
  

Gotcha!

  • Admiral
  • *****
  • Posts: 1124
    • View Profile
    • Welcome to New Hiigara
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #583 on: July 21, 2013, 06:05:36 PM »

Hello,

This script makes a decorative weapon turn 360 degrees and joy, it sure works. (Code is taken from Ironclads. Hope you don't mind!)
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.ShipAPI;

public class BushiVentilatorRotationEffect implements EveryFrameWeaponEffectPlugin {

private float currDir = Math.signum((float) Math.random() - 0.5f);

public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
if (engine.isPaused()) return;
if (weapon.getShip().isHulk()) return;

float curr = weapon.getCurrAngle();
curr += currDir * amount * 100f;
float arc = weapon.getArc();

weapon.setCurrAngle(curr);
}

public static float normalizeAngle(float angleDeg) {
return (angleDeg % 360f + 360f) % 360f;
}
}

Unfortunately there's magic in it which makes the object turn left or right at a random chance, and I'd like it to only go left.
Does anyone know what magic to remove or adjust in order to get the decoration go left?
Logged
  

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #584 on: July 22, 2013, 01:17:08 AM »

Gotcha!:

The variable currDir is responsible for direction, and is randomly set to 1 or -1 near the top. If you want to rotate counterclockwise, change it to always be 1f. For clockwise, it'd be -1f.

If you want to change the rotation speed, you would change the amount * 100f to amount * <degrees per second>.
Logged
Pages: 1 ... 37 38 [39] 40 41 ... 706