Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [0.9a] Toggle slow motion in-combat!  (Read 7515 times)

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
[0.9a] Toggle slow motion in-combat!
« on: August 26, 2016, 12:48:46 PM »

Link (1.03)

This is a simple mod which lets you slow down combat (down to 65% of normal speed by default, you can change the number in the script). You can press "B" to toggle between normal time and slow motion.
« Last Edit: December 04, 2018, 02:21:17 AM by jamplier »
Logged

Alexander86

  • Lieutenant
  • **
  • Posts: 51
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #1 on: August 26, 2016, 02:54:17 PM »

Thank you very much for this mod :) this community is the best.
Logged

Alexander86

  • Lieutenant
  • **
  • Posts: 51
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #2 on: August 26, 2016, 11:06:22 PM »

67198 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at data.scripts.plugins.SlowMotionScript.advance(SlowMotionScript.java:42)
   at com.fs.starfarer.title.C.o0oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO$Oo.o00000(Unknown Source)
   at com.fs.starfarer.combat.A.B.o00000(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.advance(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

I am getting this error though
Logged

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #3 on: August 27, 2016, 02:15:38 AM »

Weird, for me it's working fine in all missions. Are you using the latest version of starsector? Was there anything in particular you were doing when you got this error, or was it just when the game loaded? Does it do the same with no other mods enabled?
« Last Edit: August 27, 2016, 02:32:54 AM by jamplier »
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #4 on: August 27, 2016, 03:57:21 AM »

To me it looks like the issue is your empty "id" string.
Logged
 

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #5 on: August 27, 2016, 05:55:16 AM »

Ah, yes, that could very well be a source of errors. I'm not sure what I could do to get rid of it, since it's required by that one function? And to be fair, I honestly don't even know what the string argument in that function is supposed to do ( it was modifyMult(string, float) as far as i remember, can't look at any code right now)
« Last Edit: August 27, 2016, 06:01:16 AM by jamplier »
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #6 on: August 27, 2016, 08:41:10 AM »

The string is an identifier; it's used to make it easy to turn various factors on and off (since you can remove a modifier by id instead of needing to figure out the exact counter-modifier to add); it's also used to prevent modifiers from stacking up infinitely - i.e., if you call modifyMult( "someID", .5 ) on every frame, you get a modification of 1/2, not 1/2 the first frame, 1/4 the second, 1/8 the third, etc.

So basically you just need to use a reasonably-unique non-empty string.  I'd suggest just using the name of your mod.
Logged
Wyvern is 100% correct about the math.

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #7 on: August 27, 2016, 10:09:34 AM »

That makes sense, I'll change that string. Still, I'm not convinced that's the cause of the problem, since modifyMult doesn't change the time multiplier by a percentage, or even a flat amount, it just changes it straight to 0.65f on every frame it's called. Oh, whatever, I hope that will fix it. Thank you for your help!
« Last Edit: August 27, 2016, 10:17:10 AM by jamplier »
Logged

Weltall

  • Admiral
  • *****
  • Posts: 774
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #8 on: August 27, 2016, 10:17:53 AM »

Seeing this mod made me smile :) Bless you jamplier.
Logged
Ignorance is bliss..

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #9 on: August 27, 2016, 03:51:13 PM »

Thanks for the kind words! Now if only it worked for literally anyone else besides me.
Logged

Weltall

  • Admiral
  • *****
  • Posts: 774
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #10 on: August 27, 2016, 04:11:58 PM »

 :-\ Just tested it to see and indeed it gives that error.
Logged
Ignorance is bliss..

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24116
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #11 on: August 27, 2016, 04:25:20 PM »

Weird, works for me.

I'd suggest adding an:

if (engine == null) return;

To the beginning of the advance method. engine being null is the only way it could reasonably be NPE'ing on the line reported.
Logged

Weltall

  • Admiral
  • *****
  • Posts: 774
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #12 on: August 27, 2016, 05:19:17 PM »

Tried what Alex suggested and it worked perfectly jamplier =) I tested on a modded game.
Logged
Ignorance is bliss..

jamplier

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: [0.7.2a] Toggle slow motion in-combat!
« Reply #13 on: August 28, 2016, 02:18:47 AM »

Thank you very much guys! Indeed, the game would only crash when loading the campaign, but not when loading a mission. Updated the link.
Logged