Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 389 390 [391] 392 393 ... 709

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

prav

  • Captain
  • ****
  • Posts: 388
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5850 on: December 22, 2019, 09:39:17 AM »

To make sure, is the correct orientation for a graphicslib normal map XYZ inverted?

And if I want to auto-generate a whole bunch, is there a simpler method than the nvidia photoshop plugin? It seems to screw up when I try to use it with batch actions.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5851 on: December 22, 2019, 10:37:54 AM »

How to show dialog while I am in CARGO core tab :(
I have a special item that could right click and remove to get some blueprints, so I want to use "show loot" to interact with showloot listener.

Here is my code before which is not related to dialog.
Code: java
    @Override
    public void performRightClickAction() {
        LockBoxData data = LockBoxData.getData();
        if (data.isTotallyUnlocked()) {
            List<DropData> dropRandomList = new ArrayList<>();

            DropData drop = new DropData();
            drop.group = "ship_bp";
            drop.chances = 6;
            dropRandomList.add(drop);
            CargoAPI extra = SalvageEntity.generateSalvage(random, 1, 1, 1, null, dropRandomList);
            extra.addSpecial(new SpecialItemData(Items.SHIP_BP, "AL_doctor"), 1f);
            CargoAPI cargo = stack.getCargo();
            cargo.addAll(extra);
        }
    }
But if I click it in others[4], it will disappear after I switch to all[1] or [2], because the cargo is not the real cargo.

Hmm, I'm not sure I understand what you're trying to do. Why wouldn't it be the real cargo?

I'm not sure what you're trying to do, but have you considered using showCargoPickerDialog()? It might be a better fit, depending. That's what's used for handing in AI cores in vanilla.
Logged

shoi

  • Admiral
  • *****
  • Posts: 657
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5852 on: December 22, 2019, 01:59:21 PM »

So I don't know if this is a dumb question, but how do I go about setting up an environment to create a new ship system?

I made the script easily enough. Starsector throws an error saying it can't compile it and closes. My assumption here is that it's because the .java file doesn't have a .class file to go with it..simple, right?

The hurdle I am facing is getting the damned thing to compile. it throws a billion errors and if I pull a copy of the API in the same directory, I get a million errors about lwjgl instead.

I'm sure im overlooking something simple. Right now the directory im working with looks like this:

myShipSystem.java
com(starfarer api)

Any help would be appreciated ):

edit:  nevermind, figured it out :). I needed to include lwjgl in the directory as well
« Last Edit: December 22, 2019, 05:23:04 PM by shoi »
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5853 on: December 22, 2019, 07:13:46 PM »

How would I uhh determine if a code has a nanoforge or not for an ability I am creating

Code
getFleet().getCargo().getCommodityQuantity(Items.CORRUPTED_NANOFORGE)

seems to always return 0 despite i can add myself 1000 of these things.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5854 on: December 22, 2019, 07:15:04 PM »

Unlike AI cores, those aren't commodities. Try something like:

cargo.getQuantity(CargoItemType.SPECIAL, Items.CORRUPTED_NANOFORGE);
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5855 on: December 22, 2019, 07:41:22 PM »

Hmm, I'm not sure I understand what you're trying to do. Why wouldn't it be the real cargo?

I'm not sure what you're trying to do, but have you considered using showCargoPickerDialog()? It might be a better fit, depending. That's what's used for handing in AI cores in vanilla.
My first question is, how to call out an interaction dialog in performRightClickAction()

About the code:
If I clicked the item when players cargo is sorted(not all[1], but others[4] in core tab(i)), stack.getCargo() seems to return the sorted part cargo. Blueprints exists in other[4], but if I clicked other sort tabs, they disappeared.
Logged
My mods


Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5856 on: December 22, 2019, 09:50:56 PM »

Unlike AI cores, those aren't commodities. Try something like:

cargo.getQuantity(CargoItemType.SPECIAL, Items.CORRUPTED_NANOFORGE);
ahhh that make sense

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5857 on: December 23, 2019, 09:32:49 AM »

My first question is, how to call out an interaction dialog in performRightClickAction()

I'm not sure if it's possible or not. I'd try something like:
Global.getSector().getCampaignUI().showInteractionDialog(plugin, interactionTarget)

With a custom plugin, but I'm not sure if that'll work 100% or if that might cause problems depending on whether it's called from the in-flight cargo screen vs the at-a-colony cargo screen. I'd definitely test both cases since they're meaningfully different.

About the code:
If I clicked the item when players cargo is sorted(not all[1], but others[4] in core tab(i)), stack.getCargo() seems to return the sorted part cargo. Blueprints exists in other[4], but if I clicked other sort tabs, they disappeared.

Ah yes, you can't really rely on stack.getCargo(), it's ... I don't know if I'd say bugged, but it only works in a few very specific cases. I did actually change this to work reliably in the dev version, btw, since it was necessary for some vanilla features.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5858 on: December 23, 2019, 08:46:05 PM »

I'm not sure if it's possible or not. I'd try something like:
Global.getSector().getCampaignUI().showInteractionDialog(plugin, interactionTarget)

With a custom plugin, but I'm not sure if that'll work 100% or if that might cause problems depending on whether it's called from the in-flight cargo screen vs the at-a-colony cargo screen. I'd definitely test both cases since they're meaningfully different.
That didn't work, I have tried it before.

Ah yes, you can't really rely on stack.getCargo(), it's ... I don't know if I'd say bugged, but it only works in a few very specific cases. I did actually change this to work reliably in the dev version, btw, since it was necessary for some vanilla features.
Okay...So I should just add these things to fleet cargo now.
Logged
My mods


Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5859 on: December 24, 2019, 07:13:10 AM »

Unlike AI cores, those aren't commodities. Try something like:

cargo.getQuantity(CargoItemType.SPECIAL, Items.CORRUPTED_NANOFORGE);

Upon testing the code above.

Code
import com.fs.starfarer.api.campaign.*;
import com.fs.starfarer.api.fleet.FleetMemberViewAPI;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
import com.fs.starfarer.api.impl.campaign.abilities.BaseToggleAbility;
import com.fs.starfarer.api.impl.campaign.ids.Commodities;
import com.fs.starfarer.api.impl.campaign.ids.Items;
import com.fs.starfarer.api.ui.LabelAPI;
import com.fs.starfarer.api.ui.TooltipMakerAPI;
import com.fs.starfarer.api.util.Misc;

    public boolean hazpristine() {
        if (getFleet().getCargo().getQuantity(CargoItemType.SPECIAL, Items.CORRUPTED_NANOFORGE) > 0)
            return true;
        return false;
    }
Seems to never return true.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5860 on: December 24, 2019, 10:27:07 AM »

That didn't work, I have tried it before.

Then I don't *think* it's possible, hmm.

Okay...So I should just add these things to fleet cargo now.

Riight.


Upon testing the code above.

Code
    public boolean hazpristine() {
        if (getFleet().getCargo().getQuantity(CargoItemType.SPECIAL, Items.CORRUPTED_NANOFORGE) > 0)
            return true;
        return false;
    }
Seems to never return true.

Ah, my bad! It should be something like:

getFleet().getCargo().getQuantity(CargoItemType.SPECIAL, new SpecialItemData(Items.CORRUPTED_NANOFORGE, null))

If you're curious, the second parameter to the SpecialItemData constructor - the one that's null for this - would be the blueprint ID for blueprints.
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5861 on: December 24, 2019, 12:07:40 PM »

Ah, my bad! It should be something like:

getFleet().getCargo().getQuantity(CargoItemType.SPECIAL, new SpecialItemData(Items.CORRUPTED_NANOFORGE, null))

If you're curious, the second parameter to the SpecialItemData constructor - the one that's null for this - would be the blueprint ID for blueprints.
Cheers!

MeinGott

  • Ensign
  • *
  • Posts: 35
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5862 on: December 25, 2019, 09:17:42 AM »

When in combat near a planet, in background there is the planet visible, but its always small/distant. Is there a config somewhere I can edit to make it 2-3 times bigger?
thank you
Logged

boggled

  • Admiral
  • *****
  • Posts: 1128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5863 on: December 25, 2019, 06:36:24 PM »

I'm trying to create an industry where the image can change based on market conditions (like farming/aquaculture, light industry, etc.). My code below throws a null exception if installedOnStation() is true:

Code
@Override
    public String getCurrentImage()
    {
        if(installedOnStation())
        {
            return (this.getSpec().getImageName()).replaceAll("mass_driver.png", "drone_control.jpg");
        }
        else
        {
            return this.getSpec().getImageName();
        }
    }
Same with this code:
Code
@Override
    public String getCurrentImage()
    {
        if(installedOnStation())
        {
            return Global.getSettings().getSpriteName("industry", "drone_control");
        }
        else
        {
            return this.getSpec().getImageName();
        }
    }

 Does anyone know how to get this to work? Thank you!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5864 on: December 26, 2019, 10:07:25 AM »

When in combat near a planet, in background there is the planet visible, but its always small/distant. Is there a config somewhere I can edit to make it 2-3 times bigger?
thank you

It's not easily configurable, but the implementation is in BattleCreationPluginImpl, which you can provide a custom version of  in CampaignPlugin.pickBattleCreationPlugin. (The planets aren't bigger because it gets harder to see what's going on, btw...)

My code below throws a null exception if installedOnStation() is true:

Hmm - stack trace? If there's an exception, the stack trace is pretty much mandatory to look at in trying to figure it out.
Logged
Pages: 1 ... 389 390 [391] 392 393 ... 709