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 ... 496 497 [498] 499 500 ... 706

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

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7455 on: May 26, 2021, 09:37:37 AM »

In variant, if I don’t set target variant to true, can they still spawn?
I want a challenging merc specific variant but doesn’t want to bloat the player shown suggested variant list.
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7456 on: May 26, 2021, 10:27:45 AM »

- LazyLib contains this method:
...
Here's the thing: I can use this to spawn a ship on the enemy side, as per the above console command. But when it dies, the "<shipname> disabled" message in the top-left uses the green color of friendly ships. Is this a bug in the base game's combat engine?

Hmm - I think the LazyLib method is missing something like:
if (side == FleetSize.PLAYER) {
   member.setOwner(0);
} else {
   member.setOwner(1);
}

- Could this bug be looked at? I realize it's a pretty rare issue specific to particular mod circumstances, but the crash log indicates it's happening within base game code.

Fixed both up. I'm not honestly sure why it was crashing there - didn't dig into it enough. It's something to do with showing a fleet info panel in the new game dialog sequence, though, when a campaign engine doesn't yet exist. I'm not 100% that another similar crash might not crop up, but this specific sequence, at least, now goes through fine.


Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

Hmm - I think SoundAPI.stop() should do it? And the various playSound() methods return a SoundAPI.

In variant, if I don’t set target variant to true, can they still spawn?
I want a challenging merc specific variant but doesn’t want to bloat the player shown suggested variant list.

Yes, that should be fine.
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 #7457 on: May 26, 2021, 04:41:25 PM »

And another question - any example of fleet spawning script? Can someone point me to a mod that has scripts that spawn fleets that are viewable (I know a few, but all the scripts are in a .jar)

Check out "src\archeus\campaign\tutorial\AOGuardMiscFleetManager in my mod.

It has a few examples of this. Bear in mind that this code isn't actually used at the moment since I haven't finished the tutorial so there is a chance it won't work as expected.
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7458 on: May 26, 2021, 11:44:17 PM »

Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

Hmm - I think SoundAPI.stop() should do it? And the various playSound() methods return a SoundAPI.

I'm not sure you understand - starting a sound or playing it isn't the real issue - making the sound loop naturally is.
Basically, within an EveryFrame scrip, and within the main fire squence (powerup and powerdown work) I have to know when the sound finished playing to start playing it again, for as long as the weapon is fireing.

The weapon itself can fire for 10 seconds (or less, depending on flux level). Since it's a builtin weapon, I COULD just  remove any ties to flux and make it so it will ALWAYS fire for 10 seconds, but I don't like that solution.
I could also edit the fire sound ot be exactly 10 second long and only play it once, but again...seems like a bad solution.
Logged

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7459 on: May 27, 2021, 06:27:58 AM »

Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

Hmm - I think SoundAPI.stop() should do it? And the various playSound() methods return a SoundAPI.

I'm not sure you understand - starting a sound or playing it isn't the real issue - making the sound loop naturally is.
Basically, within an EveryFrame scrip, and within the main fire squence (powerup and powerdown work) I have to know when the sound finished playing to start playing it again, for as long as the weapon is fireing.

The weapon itself can fire for 10 seconds (or less, depending on flux level). Since it's a builtin weapon, I COULD just  remove any ties to flux and make it so it will ALWAYS fire for 10 seconds, but I don't like that solution.
I could also edit the fire sound ot be exactly 10 second long and only play it once, but again...seems like a bad solution.

If a looping sound is what you're after, you should look into
Code
Global.getSoundPlayer().playLoop()
and its overloads. These all allows a looping sound to be played on command, and you can change their properties such as pitch and volume as they loop. Needs to be called once per frame to keep the loop going, but otherwise it sounds like exactly what you're looking for.

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7460 on: May 27, 2021, 06:33:40 AM »

Is there a method for getting unassigned officers?
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7461 on: May 27, 2021, 08:29:58 AM »

Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

Hmm - I think SoundAPI.stop() should do it? And the various playSound() methods return a SoundAPI.

I'm not sure you understand - starting a sound or playing it isn't the real issue - making the sound loop naturally is.
Basically, within an EveryFrame scrip, and within the main fire squence (powerup and powerdown work) I have to know when the sound finished playing to start playing it again, for as long as the weapon is fireing.

The weapon itself can fire for 10 seconds (or less, depending on flux level). Since it's a builtin weapon, I COULD just  remove any ties to flux and make it so it will ALWAYS fire for 10 seconds, but I don't like that solution.
I could also edit the fire sound ot be exactly 10 second long and only play it once, but again...seems like a bad solution.

If a looping sound is what you're after, you should look into
Code
Global.getSoundPlayer().playLoop()
and its overloads. These all allows a looping sound to be played on command, and you can change their properties such as pitch and volume as they loop. Needs to be called once per frame to keep the loop going, but otherwise it sounds like exactly what you're looking for.

So I need to replace this: Global.getSoundPlayer().playSound("vns_Reflex_fire", 1f, 1f, point, ZERO);

with the below?

void    playLoop(java.lang.String id, java.lang.Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel)


What would be a playingEntity? I'm not sure what goes there.
« Last Edit: May 27, 2021, 08:34:02 AM by ElPresidente »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7462 on: May 27, 2021, 09:22:20 AM »

Is there a method for getting unassigned officers?

Not as such, but you can figure it out by calling playerFleet.getFleetData().getOfficerData() and then seeing which if them are, in fact, not assigned to any of the player's ships.



(Right, yes, playLoop - I was assuming you didn't want to use that for some reason, and since you said you had a fixed maximum duration for the sound...

You should just pass in the ship for the playing entity. The game uses that parameter to track what's playing the loop so that it knows that the subsequent playLoop calls on other frames in fact refer to the same loop being played and aren't a new looping sound to play.)
Logged

Nicke535

  • Commander
  • ***
  • Posts: 240
  • Degenerate Core
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7463 on: May 27, 2021, 11:07:48 AM »

Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

Hmm - I think SoundAPI.stop() should do it? And the various playSound() methods return a SoundAPI.

I'm not sure you understand - starting a sound or playing it isn't the real issue - making the sound loop naturally is.
Basically, within an EveryFrame scrip, and within the main fire squence (powerup and powerdown work) I have to know when the sound finished playing to start playing it again, for as long as the weapon is fireing.

The weapon itself can fire for 10 seconds (or less, depending on flux level). Since it's a builtin weapon, I COULD just  remove any ties to flux and make it so it will ALWAYS fire for 10 seconds, but I don't like that solution.
I could also edit the fire sound ot be exactly 10 second long and only play it once, but again...seems like a bad solution.

If a looping sound is what you're after, you should look into
Code
Global.getSoundPlayer().playLoop()
and its overloads. These all allows a looping sound to be played on command, and you can change their properties such as pitch and volume as they loop. Needs to be called once per frame to keep the loop going, but otherwise it sounds like exactly what you're looking for.

So I need to replace this: Global.getSoundPlayer().playSound("vns_Reflex_fire", 1f, 1f, point, ZERO);

with the below?

void    playLoop(java.lang.String id, java.lang.Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel)


What would be a playingEntity? I'm not sure what goes there.

The playingEntity would be your weapon or ship (don't remember, someone correct me here); it's used so that two of the same "source" with a looping sound doesn't result in two different sounds.

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7464 on: May 28, 2021, 05:48:52 AM »

how would I get all the stats affecting spread and accuracy of weapons? I have an inaccurate beam I do via script, and I wanted to apply these stats to it.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7465 on: May 28, 2021, 10:45:09 AM »

MutableShipStatsAPI:
public MutableStat getMaxRecoilMult();
public MutableStat getRecoilPerShotMult();
public MutableStat getRecoilDecayMult();
MutableStat getRecoilPerShotMultSmallWeaponsOnly(); <- not actually used by anything in vanilla, but still respected by the weapons
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7466 on: May 30, 2021, 12:22:24 AM »

So if officer_manager is commented out in the events.json

Does that mean officer_manager can no longer be touched or is there an alternative way? A pity if so.  :-\
It's just added as a script now.

So this means I would have to use it with mod_file.json's replace to replace the file?  :o

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7467 on: May 30, 2021, 09:16:27 AM »

Advice wanted. I have a shipsystem that doubles the range of all weapons, but the ship cannot move nor have shields raised while it's active.

Works great for he player, but the AI turns on the system...and never turn it off... Thus cannot move.
The aiType used is weapon boost. Didn't write my own AI because I struggle with even basic code, let alone writing AI.

Code
{
"id":"sc_gunboost",
"type":"STAT_MOD",
"aiType":"WEAPON_BOOST",

"statsScript":"data.shipsystems.scripts.sc_gunboost",

#"weaponGlowColor":[0,0,50,100],
#"weaponTypes":[BALLISTIC],

"useSound":"system_ammo_feeder",
"outOfUsesSound":"gun_out_of_ammo",
}

This is the ship_systems.scv entry:
Gunbooster,sc_gunboost,2,,,,,0.25,,0.05,0.5,20,0.5,20,,,,,,,TRUE,TRUE,TRUE,,graphics/icons/hullsys/missile_autoforge.png

Any suggestions on how to best address it? I'm not sure what half the values do anymore.


EDIT: Seem the last change I made (removed toggle TRUE and added duration) made the AI not derp.
« Last Edit: May 30, 2021, 10:17:51 AM by ElPresidente »
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7468 on: May 30, 2021, 08:10:34 PM »

Does copying an entity's memory copy its tags or are they stored separately?
Logged

Stormy Fairweather

  • Commander
  • ***
  • Posts: 193
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7469 on: May 30, 2021, 08:43:11 PM »

I made a comment in this thread once, and ever since i have had this on my 'new replies to my posts' page every time i log, and cannot find any way to stop it. hell, i couldnt even delete my posts to see if that worked.
Logged
Pages: 1 ... 496 497 [498] 499 500 ... 706