Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 199 200 [201] 202 203 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3000 on: December 19, 2016, 06:24:14 PM »

Yeah, it's a no.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3001 on: December 23, 2016, 10:22:17 PM »

Alex, is there a way to fix this issue?
I was hoping to make it immediately update to the new price (after undock and redock) by forcing a updateCargoPrePlayerInteraction() call (with reset timer) after the stability loss event, but this has no effect.

If it can't be fixed by a mod, will it go away with the 0.8 economy system?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3002 on: December 23, 2016, 10:32:54 PM »

What's the actual issue? I mean, I have the rough picture from that thread, but that doesn't tell me what's actually going on behind the scenes, what agents do, why the price goes up on re-docking, etc.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3003 on: December 23, 2016, 11:27:04 PM »

What's the actual issue? I mean, I have the rough picture from that thread, but that doesn't tell me what's actually going on behind the scenes, what agents do, why the price goes up on re-docking, etc.

So far as I can tell, the underlying problem is that changing a market's demand for a commodity doesn't change its price until time passes in the Sector, although changing the market's stability changes its prices instantly.

Spoiler
To recap:
1) Before doing anything, prices of hand weapons/drugs in market are X
2) Use agent to cause a stability penalty event (similar to Recent Unrest but longer-lived)
3) Prices of guns/drugs are now Y, where Y < X
4) Undock and redock
5) Prices of guns/drugs are now Z, where Z > X

After doing some fresh searching, I found step 5 results from the code in Population submarket class that increases demand for hand weapons and drugs when stability drops low enough. But calling market.reapplyConditions() after the stability-reducing event doesn't make the prices update to Z before undocking. Are prices updated based on supply/demand only in an EveryFrameScript somewhere?

Spoiler
Code: java
	public void apply(String id) {
float size = market.getSize();
float pop = getPopulation(market);

//[...]

// TODO : modify this to affect all goods illegal in market
float lowStabilityBonus = getLowStabilityBonusMult(market);
float lowStabilityPenalty = getLowStabilityPenaltyMult(market);
float highStabilityBonus = getHighStabilityBonusMult(market);
float highStabilityPenalty = getHighStabilityPenaltyMult(market);

for (CommodityOnMarketAPI com : market.getAllCommodities()) {
if (market.isIllegal(com) && !com.getId().equals(Commodities.ORGANS)) {
market.getDemand(com.getId()).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
}

if (!market.isIllegal(Commodities.DRUGS)) {
market.getDemand(Commodities.DRUGS).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
if (!market.isIllegal(Commodities.HAND_WEAPONS)) {
market.getDemand(Commodities.HAND_WEAPONS).getDemand().modifyMult("stability_" + id, lowStabilityBonus * highStabilityPenalty);
}
if (!market.isIllegal(Commodities.LUXURY_GOODS)) {
market.getDemand(Commodities.LUXURY_GOODS).getDemand().modifyMult("stability_" + id, highStabilityBonus * lowStabilityPenalty);
}

}
[close]
[close]

Can I just tell a market to recalculate its prices?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3004 on: December 23, 2016, 11:39:37 PM »

Ah, yeah, this makes sense. There's an updatePrices() method that wasn't in MarketAPI for some reason, added it there. It gets called in a market's advance() method if the stability changed to catch this stuff, but that doesn't catch the case where stability changes while you're in the dialog.

Is there an advance() method in MarketAPI? There is *now*, but I'm not sure about 0.7.2a. If there is, calling it with 0 as the elapsed time should resolve this as well.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3005 on: December 24, 2016, 12:36:36 AM »

Ah, good!
Is there an advance() method in MarketAPI? There is *now*, but I'm not sure about 0.7.2a. If there is, calling it with 0 as the elapsed time should resolve this as well.
It's not in 0.7.2a. But advancing the whole EconomyAPI (by 0) also seems to work, ha!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3006 on: December 24, 2016, 08:44:22 AM »

Nice :)
Logged

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3007 on: December 25, 2016, 02:50:07 PM »

I am trying to compile some of the java sources from my mod (not the mission .java though)

However, when I start Starsector, it crashes, saying:

Spoiler
9134 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.RWSModPlugin]
java.lang.RuntimeException: Error compiling [data.scripts.RWSModPlugin]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: data.scripts.RWSModPlugin
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
[close]


The crash says class not found, but my code compiled successfully. What is going on?
« Last Edit: December 27, 2016, 09:41:47 AM by gruberscomplete »
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

King Alfonzo

  • Admiral
  • *****
  • Posts: 683
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3008 on: December 27, 2016, 09:28:50 PM »

Just because the compiler compiles, doesn't necessarily mean that the code you've put in is good. You're going to have to sift through the modplugin, and make sure everything is named appropriately (The error could be because it's trying to find a class file that doesn't exist in the .jar file).

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3009 on: December 27, 2016, 09:49:36 PM »

Hmm - this looks like a mismatch between where you're telling the game your ModPlugin is (in mod_info.json) and where it actually is.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3010 on: January 03, 2017, 06:16:12 AM »

Am I understanding these BattleAPI methods correctly?

getPlayerCombined() returns a CampaignFleetAPI consisting of all the fleet members that were on the player's side
getNonPlayerCombined()returns a CampaignFleetAPI consisting of all the fleet members that were on side opposing the player
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3011 on: January 04, 2017, 10:26:11 AM »

Yeah, that's correct. Well, not "were", but "are".
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3012 on: January 05, 2017, 01:56:01 AM »

The faction files have a section that refers to lists of ship names, am I correct in assuming that section refers to the weight with which those ship name lists are chosen? If so, does it account for the size of the lists? That is to say, if I was to say double the size of the GENERAL list, for example, and still want each name in that list to appear about as frequently as names from other lists, would I have to double its weight in every single faction file?
Logged
mmm.... tartiflette

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3013 on: January 06, 2017, 09:30:29 AM »

From the scope of EveryFrameCombatPlugin.advance() is it possible to tell if a projectile has a specific onHitEffect or that a projectile some sort of tag from the JSON you can inspect/look for?

Nick XR

  • Admiral
  • *****
  • Posts: 713
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3014 on: January 06, 2017, 09:48:22 PM »

Does anyone know if it's possible to resize the text panel in an InteractionDialogAPI? I'm trying to write a pure-text dialog, so the space reserved for the visual panel is completely wasted in this case. I'd like the text area to be wider so I can fit more information onto a single page.

The setTextWidth() method doesn't appear to work. The text area doesn't resize, although it does move to the left:
Spoiler
[close]

Yeah, the .setTextWidth() method is all sorts of broken. I'll have to sit down and fix it at some point; unfortunately it's not an easy, obvious kind of broken.

Looks like this is still the case, has anyone found a work-around?

Thanks!
Pages: 1 ... 199 200 [201] 202 203 ... 710