Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 324 325 [326] 327 328 ... 462

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

Imp0815

  • Lieutenant
  • **
  • Posts: 51
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4875 on: August 24, 2019, 05:29:58 AM »


I'm also not really sure what the everyFrameEffect and .java file do. I again based mine off the original Solenoid and guessed what the file was doing.


I think everything in their fires every frame.
Logged
Quantity instead of precision

Melissia

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4876 on: August 24, 2019, 09:56:26 AM »

Is there a simple way to change the normal map size and star count, and have more star systems and such to explore?  I admit to being new to modding this game, though I have owned it and played it off and on for a long time now (since may 2013 in fact!).  I at least figured out how to install preexisting mods.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17259
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4877 on: August 24, 2019, 11:01:27 AM »

Currently giving a market the NO_DECIV_KEY memory flag also makes it not die from saturation bombardment when size <= 4 (even though the dialog text claims it's destroyed).
Could this be changed?

Fixed!


Right now I have a script that spawns fleets at specific entities. If the entity is not found, it crashes the game. This is a pretty stupid question, but what I want to do is kill the script if the particular entity can't be found, without crashing the game. I'm not sure how to handle this problem, or even what the 'kill' command is to begin with. Could anyone help me out please?

Generally you want to check something like "if (entity == null) return null" or some such, but it depends on exactly where and with what error.

I'm a little bored of the existing player flags, and I was trying to mess around with adding more. I added a flag and a crest to the directory in core/graphics, and added some new lines to player.faction. All very cool, but is there a way to do this with a mod file so its easier to distribute? From what I read only .csv's and .json's can be merged by the game.

The .faction are json files under the hood and are treated as such as far as merging, so it should be fine.


@SwissArmyKnife: not actually sure offhand what's going on. Might be another error message somewhere earlier in the log? This sort of thing might happen if your script is doing something Janino (the compiler the game uses for loose scripts) doesn't support, or if the class doesn't have a default constructor, but none of that seems to be the problem in your code.


Is there a simple way to change the normal map size and star count, and have more star systems and such to explore?  I admit to being new to modding this game, though I have owned it and played it off and on for a long time now (since may 2013 in fact!).  I at least figured out how to install preexisting mods.

Hi - take a look here:

http://fractalsoftworks.com/forum/index.php?topic=16127.0
Logged

Melissia

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4878 on: August 24, 2019, 11:04:56 AM »

Thank you.
Logged

SwissArmyKnife

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4879 on: August 24, 2019, 02:15:54 PM »


@SwissArmyKnife: not actually sure offhand what's going on. Might be another error message somewhere earlier in the log? This sort of thing might happen if your script is doing something Janino (the compiler the game uses for loose scripts) doesn't support, or if the class doesn't have a default constructor, but none of that seems to be the problem in your code.


Thanks for taking a look at it. This may be a dumb question but I couldn't find a good answer anywhere and it's making me think the solution is simpler than it seems.

If I want to add a .java file to an existing mod's .jar file. For instance adding my new guns animation .java file to DiableAvionics  .jar file. How do I do that? Do I need to use something like netbeans to package and compile the whole thing again from src?

Do I even need to do that in the first place?

Update: Figured it out! Not ideally but it works which is good enough for a small personal mod. Ended up putting the java file in Diable's data/scripts/weapons instead of trying to add into into it's jar file.

Now my only issue is getting it to animate properly. Right now it's just cycling through the frames over and over. I need it to pause on frame 5 during firing but I'm not sure how to do that. I have no real idea what I'm doing so I looked at a bunch of different guns and couldn't find one that did the above.

I assumed that  if (!weapon.isFiring()) would dicate what it was doing while firing but adding animeSetFrame(5); in there just locks it to frame 5 in it's resting state. Firing animation still cycles through all 13 on a loop.

Here's the anim code again.
Spoiler
Code
// By Deathfly
package data.scripts.weapons;

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

public class EldosAnimation implements EveryFrameWeaponEffectPlugin {

    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
        AnimationAPI anime = weapon.getAnimation();
       
        if (anime == null){
            return;
        }
        if (!weapon.isFiring()) {
            chargeLevel = 0;
            anime.setFrameRate(-12);
            if (anime.getFrame() == 0) {
                anime.setFrameRate(0);
            }
        } else {
            if (weapon.getChargeLevel() >= chargeLevel) {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() < validFrames) {
                    anime.setFrameRate(12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(13);
                }
            } else {
                chargeLevel = weapon.getChargeLevel();
                if (anime.getFrame() > 0) {
                    anime.setFrameRate(-12);
                } else {
                    anime.setFrameRate(0);
                    anime.setFrame(0);
                }
            }
            if (weapon.getShip().getFluxTracker().isOverloadedOrVenting()){
                weapon.setRemainingCooldownTo(weapon.getCooldown());
            }
        }
    }
}
[close]
« Last Edit: August 24, 2019, 03:33:03 PM by SwissArmyKnife »
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1143
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4880 on: August 24, 2019, 03:06:48 PM »

Do I need to use something like netbeans to package and compile the whole thing again from src?
That would work. An IDE can make your life a lot easier. .jar files don't contain .java files, so no, you can't simply add a .java to a .jar. Jars contain .class files, which are the compiled versions of the java source.

Do I even need to do that in the first place?
I don't think so. A loose script should work unless it contains something Janino doesn't support, which I think is the case here. You might try making sure that all values assigned to floats are followed by an f (e.g. 42f instead of 42). I'm pretty sure Janino has a hard time dealing with int/float value mismatches.
Code
    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

King Alfonzo

  • Admiral
  • *****
  • Posts: 577
  • -- D O C T O R --
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4881 on: August 24, 2019, 08:49:12 PM »

Thanks for the reply Alex!

I did put in a check for that, with Get_Messy being the method to find the entity;

Code
		
SectorEntityToken spawnEntityMess = Get_Messy();
if (spawnEntityMess == null) {
return null;
}

However the problem persists. Am I doing it in the wrong area?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17259
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4882 on: August 24, 2019, 08:51:29 PM »

@King Alfonzo: I don't know! Take a look at the exception, and it should give you a line number, that's where you should look in your script. If you post the exception, I (or someone else here) can help you interpret it.
Logged

SwissArmyKnife

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4883 on: August 24, 2019, 10:39:10 PM »

I don't think so. A loose script should work unless it contains something Janino doesn't support, which I think is the case here. You might try making sure that all values assigned to floats are followed by an f (e.g. 42f instead of 42). I'm pretty sure Janino has a hard time dealing with int/float value mismatches.
Code
    private final float validFrames = 13;
//    private final float animeMAXchargelvl = 0.8f;
    private float chargeLevel = 0;

You were completely right, loose script worked fine and janino compiled fine. Starsector launches etc. I just don't know what I'm doing with java scripting and copying existing scripts has only gotten me so far.

Once again I think I'm overcomplicating this. I want the anim to start, play until it gets to say frame 5 where the barrel is open and "hot" and pause while the beam is firing, then continue playing to the end when the gun charges down.

Here's where it's at now.
Spoiler
[close]

Anyone able to help a complete noob out?
Logged

dgs6686

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4884 on: August 25, 2019, 05:35:54 PM »

Hi all, fairly new to the game and forums but I was considering making a mod to adjust / remove some of the skills available in the game... (particularly Electronic Warfare). I know there is a skills overhaul coming soon anyways but I just wanted to try my hand at this and see how modifying some of these affects combat.

I am fairly new to modding overall and only moderately fluent in Java but I figured this shouldn't be TOO difficult. I was wondering if anyone knew where I would start for something like this? I see the skills files under character/skills and I see the api calls that it appears to make but I'm not quite sure where to look after that.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4868
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4885 on: August 25, 2019, 06:16:21 PM »

The Skills are in starfarer.api\com\fs\starfarer\api\impl\campaign\skills.  To implement new ones, you'll need to create a directory (preferably in /scripts) and move one of the Skill java files there, change the reference in the .skill file, etc.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 4868
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4886 on: August 25, 2019, 09:50:44 PM »

OK, here's a weird issue.  What would stop a given Weapon from being stocked / created at a Market?

I have a "weapon" that costs 0 OPs and does some Special Stuff. 

When I force it into a Market's inventory via a restocking-script, all is well.  When I don't, it doesn't generate, even though it's Known to the Faction involved and some Variants require it to be built.  It isn't being stocked and those Variants never show up in the game.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 332
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4887 on: August 26, 2019, 01:42:08 AM »

What's the best way to record FleetMemberAPI in Persistent Data?
And how to check "FleetMemberAPI" is no longer exists and remove it from the hashmap?
Logged
My mods


Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4888 on: August 26, 2019, 03:55:50 AM »

Where could i find the recovery chance for derelicts? Do the cases in pickDerelictCondition from DerelictShipEntityPlugin affect that chance or is it only for loadout, dmods, etc.?
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1314
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4889 on: August 26, 2019, 08:58:54 AM »

I made a whole pack of custom images/flags for the player faction (in graphics/factions/custom). How do I make them show up in-game? I don't see the vanilla images referenced in the setting.json
Logged
Pages: 1 ... 324 325 [326] 327 328 ... 462