Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 412 413 [414] 415 416 ... 461

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

SirHartley

  • Captain
  • ****
  • Posts: 270
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6195 on: March 17, 2020, 01:40:48 PM »

Yep, that worked. IndustryCount doesn't show it, but industries&Structures tooltip does.
Thanks!
Logged

Harpuea

  • Ensign
  • *
  • Posts: 34
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6196 on: March 18, 2020, 10:10:56 AM »

Is there a way to change the sprite of a ship without having to make duplicated Hulls, variant, and CSVs files? I just want to repaint a ship so all the ships in the fleet match colors. I messed around in Eclipse and found Ship.setSprite API, but it seems that will be complicated to write UI in game in order to work for all ships.

For now, I'll try the hullmod approach. But that is rather specific to a ship and isn't a broad stroke approach in order to paint ALL ships.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 1797
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6197 on: March 18, 2020, 04:02:39 PM »

If you are okay with all ships of that class having your paint scheme, you should be able to easily make a mod to change the sprites. Just give your sprites the exact same names (and folders) as the ones you want to replace and (if you are replacing mod sprites) be sure to prefix your mod's ID with "zz" so it loads last.

If you only want your ships to have the paint scheme, then a hullmod will probably work. I've never messed around with dynamically changing sprites, so I'm not sure what you can and can't do there.
Logged

SirHartley

  • Captain
  • ****
  • Posts: 270
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6198 on: March 19, 2020, 01:30:53 AM »

Solved one problem, got the next.
I want to modify the export value for goods provided by a single market.

Is that doable? (please don't say next version :P )
Logged

Harpuea

  • Ensign
  • *
  • Posts: 34
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6199 on: March 19, 2020, 06:00:53 AM »

How exactly does setSprite() work? Any one know? I tried messing around a hullmod and the ship always turn transparent.

Code
{
"graphics":{
"paintjobs":{
"diableavionics_vapor":"graphics/da/ships/diableavionics_vapor_white.png",
},
}
}

Code
package data.hullmods;

import java.util.HashMap;
import java.util.Map;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import com.fs.starfarer.api.combat.CollisionClass;

public class Paintjob extends BaseHullMod {

    private float CenterX = 0f;
private float CenterY = 0f;

@Override
    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
    }
   
    @Override
    public String getDescriptionParam(int index, HullSize hullSize) {
        return null;
    }
   
    @Override
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
    CenterX  = ship.getSpriteAPI().getCenterX();
    CenterY   = ship.getSpriteAPI().getCenterY();
    ship.setSprite("paintjobs", "diableavionics_vapor"); //need settings.sjon file
    ship.getSpriteAPI().setCenterX(CenterX);
    ship.getSpriteAPI().setCenterY(CenterY);
    }
   
    @Override
    public boolean isApplicableToShip(ShipAPI ship)
    {
   
return ( ship.getHullSpec().getHullId().startsWith("diableavionics_vapor"));
    }
}

[attachment deleted by admin]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17244
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6200 on: March 19, 2020, 10:23:39 AM »

Solved one problem, got the next.
I want to modify the export value for goods provided by a single market.

Is that doable? (please don't say next version :P )

Only market.getIncomeMult(), I'm afraid - which affects both exports and baseline colony income. You could also compute it separately and add it as its own item in the monthly income report, but with that approach, it would not show up in "income" field in the colony screen or the colony list.

@Harpuea: hmm, I just tried "ship.setSprite("newGame", "mixed");" and that worked, so I'm not sure. This kind of sounds like the sprite you're using doesn't exist (i.e. a typo in the path?) or is not a 24-bit png or is corrupted in some way etc.
Logged

SirHartley

  • Captain
  • ****
  • Posts: 270
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6201 on: March 19, 2020, 10:49:25 AM »

Only market.getIncomeMult(), I'm afraid - which affects both exports and baseline colony income. You could also compute it separately and add it as its own item in the monthly income report, but with that approach, it would not show up in "income" field in the colony screen or the colony list.

Hm, not the answer I was hoping for, but kinda what I expected.
Any chance of having an API hook for that in the next version? I was trying to assign a dynamic export value to luxury goods, so the export value/unit would increase based on the presence of some conditions.

Thanks,
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17244
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6202 on: March 19, 2020, 10:54:02 AM »

Probably not, to be honest. I'll keep it in mind in case I happen to be doing other stuff in that area of the code, though.
Logged

Harpuea

  • Ensign
  • *
  • Posts: 34
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6203 on: March 19, 2020, 12:13:31 PM »

Quote
@Harpuea: hmm, I just tried "ship.setSprite("newGame", "mixed");" and that worked, so I'm not sure. This kind of sounds like the sprite you're using doesn't exist (i.e. a typo in the path?) or is not a 24-bit png or is corrupted in some way etc.

It was an issue with color mode. Thank you very much.

[attachment deleted by admin]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17244
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6204 on: March 19, 2020, 12:17:20 PM »

Glad you got it working!
Logged

SirHartley

  • Captain
  • ****
  • Posts: 270
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6205 on: March 20, 2020, 03:58:31 PM »

The industry limit can be adjusted via dynamic stat mods in this version (0.9.1a) already, which might prove useful for anyone reading this while searching the thread.
Code
market.getStats().getDynamic().getMod(Stats.MAX_INDUSTRIES).modify...

for my actual question:
I'd like to set Recreational Drugs as legal on a market via a condition.
Code
market.getCommodityData(Commodities.DRUGS).setSupplyLegal(true);
doesn't seem to do it. What am I missing?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17244
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6206 on: March 20, 2020, 04:41:54 PM »

for my actual question:
I'd like to set Recreational Drugs as legal on a market via a condition.
Code
market.getCommodityData(Commodities.DRUGS).setSupplyLegal(true);
doesn't seem to do it. What am I missing?

Taking a quick look at the code, that only works the other way - to make something that would otherwise be legal, illegal. It's not used in vanilla as far as I can tell and I'm not even sure it works correctly.
Logged

SirHartley

  • Captain
  • ****
  • Posts: 270
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6207 on: March 20, 2020, 05:05:58 PM »

I take it there's no current way to achieve that then?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17244
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6208 on: March 20, 2020, 05:12:38 PM »

I don't believe so, but it depends on the specifics of what you're doing. For example if the drugs are being produced by a specific industry, then having it return true from isSupplyLegal() *should* make them legal on that market as far as getting income from exports.

(You could also set the market to free port, though that of course has other implications...)
Logged

MeinGott

  • Ensign
  • *
  • Posts: 20
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6209 on: March 21, 2020, 02:48:27 AM »

Hello, two things:

Is there a way to change when enemy retreats? I fly with big fleet and when I meet small enemy, I deploy matching force of my ships, so that I dont overpower them but keep it fair. Of course enemy retreats because calculations take into account my whole fleet. Same thing when I join a friend in a fight, I deploy only one ship, but enemies turn tails. And so, how do I make AI braver? Its ok if only in battle - fleeing on campaign screen is permitted :) 

Second thing - I suspect Alex actually enjoys helping modders, seeing how often he replies here, what a guy!

Thanks
Logged
Pages: 1 ... 412 413 [414] 415 416 ... 461