Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 287 288 [289] 290 291 ... 710

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

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4320 on: February 12, 2019, 06:24:07 PM »

Alex, thank you so much for renderOrderMod, that is a huge thing for us! I honestly thought it would never happen and was content with WEAPONS_FRONT_TO_BACK and WEAPONS_BACK_TO_FRONT but with the latest addition too? That is great, giving full manual control when we want to do something really complex, but also having those two recently added hints as well when we need some control but just want to sledgehammer fix it easily when full manual level of control is more than is needed.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24112
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4321 on: February 12, 2019, 07:43:29 PM »

Awesome, glad to hear this sounds like it'll be useful!
Logged

Blothorn

  • Commander
  • ***
  • Posts: 116
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4322 on: February 13, 2019, 04:25:47 PM »

Is there documentation on the AIFlags? (Right now I am specifically wondering whether I should be setting OK_TO_CANCEL_SYSTEM_USE_TO_VENT in a custom system/system AI for a toggle system.)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24112
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4323 on: February 13, 2019, 09:16:24 PM »

Is there documentation on the AIFlags?

There is not :) However iirc that flag is respected.
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4324 on: February 13, 2019, 11:26:41 PM »

1. Is there any way not to bundle the sound effect(s) in mod (and not to write down sounds.json) if using/referring to only vanilla sounds? 'cause what worked in 0.8.1a doesn't work in 0.9. Specifically:
Code
Global.getSoundPlayer().playSound("ui_char_increase_skill", 1f, 1f, new Vector2f(), new Vector2f());
or
Code
Global.getSoundPlayer().playUISound("ui_char_increase_skill_new", 1f, 1f);
now require me to pack vanilla sound in my mod.
2. Also
Code
for (FactionAPI factionAPI :Global.getSector().getAllFactions()) {
CampaignFleetAPI fleet = FleetFactory.createGenericFleet(factionAPI.getId(), "nothing", 1.5f, 20 ); // (int)((float)Math.random()*500f+500f)
...
fails dramatically with
Code
ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.Faction.pickShip(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShip(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShipAndAddToFleet(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShipAndAddToFleet(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactory.createGenericFleet(FleetFactory.java:361)
Moreover, pickShipAndAddToFleet and pickShip are hardcoded and not exposed and can't be debugged futher (at least with my current skills).
That also worked in 0.8.1a.
Any help is highly appreciated, thank you!
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4325 on: February 14, 2019, 03:47:53 AM »

2. Also
Code
for (FactionAPI factionAPI :Global.getSector().getAllFactions()) {
CampaignFleetAPI fleet = FleetFactory.createGenericFleet(factionAPI.getId(), "nothing", 1.5f, 20 ); // (int)((float)Math.random()*500f+500f)
...
fails dramatically with
Code
ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.Faction.pickShip(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShip(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShipAndAddToFleet(Unknown Source)
at com.fs.starfarer.campaign.Faction.pickShipAndAddToFleet(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactory.createGenericFleet(FleetFactory.java:361)
pickShip() crashes if it can't find a ship for a particular role it wants. I suspect it wouldn't work in general for the "fake" factions like neutral and poor.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24112
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4326 on: February 14, 2019, 09:04:01 AM »

1. Is there any way not to bundle the sound effect(s) in mod (and not to write down sounds.json) if using/referring to only vanilla sounds? 'cause what worked in 0.8.1a doesn't work in 0.9. Specifically:
Code
Global.getSoundPlayer().playSound("ui_char_increase_skill", 1f, 1f, new Vector2f(), new Vector2f());
or
Code
Global.getSoundPlayer().playUISound("ui_char_increase_skill_new", 1f, 1f);
now require me to pack vanilla sound in my mod.

Hmm - that doesn't seem right; it's really hard for me to see how that might happen. The game calls Global.getSoundPlayer().playSound() and Global.getSoundPlayer().playUISound() in numerous places, and that works - and functionally, that's equivalent from those getting called from a mod. I suspect something else is probably going wrong here.
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4327 on: February 15, 2019, 01:58:10 AM »

Hmm - that doesn't seem right; it's really hard for me to see how that might happen. The game calls Global.getSoundPlayer().playSound() and Global.getSoundPlayer().playUISound() in numerous places, and that works - and functionally, that's equivalent from those getting called from a mod. I suspect something else is probably going wrong here.
Here is a plain test case, mod tries to play sound right after game loaded:
Code
public class Es_ModPlugin extends BaseModPlugin
{
...
public void onGameLoad(boolean newGame){
Global.getSoundPlayer().playUISound("colony_industry_shutdown", 1f, 1f);
Without explicit description in sounds.json yields:
Code
89878 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 32
89879 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 33
90491 [Thread-8] INFO  sound.O  - Cleaning up music with id [miscallenous_main_menu.ogg]
90639 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Sound set with id [colony_industry_shutdown]  not found
java.lang.RuntimeException: Sound set with id [colony_industry_shutdown]  not found
at com.fs.starfarer.Object.I.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatMain$3.playUISound(Unknown Source)
at data.scripts.Es_ModPlugin.onGameLoad(Es_ModPlugin.java:30)

That issue aside,
Is there a way to add some (short) text to "onmouseover-ship's-stats-systems-weapons" overlay (like in fleet, market and recovery menus) https://imgur.com/a/tFbWmnl?
« Last Edit: February 15, 2019, 06:32:47 AM by Iridescens »
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4328 on: February 15, 2019, 06:36:42 AM »



shield.setInnerRotationRate(shield.getRingRotationRate());


Hello, this method do not seems to work, or i use it badly. (I tried to give on the below shield, the same rotation)

Thank.


Also, the rotation become weird and sometime seems "glitch"
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24112
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4329 on: February 15, 2019, 08:57:18 AM »

Hmm - that doesn't seem right; it's really hard for me to see how that might happen. The game calls Global.getSoundPlayer().playSound() and Global.getSoundPlayer().playUISound() in numerous places, and that works - and functionally, that's equivalent from those getting called from a mod. I suspect something else is probably going wrong here.
Here is a plain test case, mod tries to play sound right after game loaded:
Code
public class Es_ModPlugin extends BaseModPlugin
{
...
public void onGameLoad(boolean newGame){
Global.getSoundPlayer().playUISound("colony_industry_shutdown", 1f, 1f);
Without explicit description in sounds.json yields:
Code
89878 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 32
89879 [Thread-4] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Loading stage 33
90491 [Thread-8] INFO  sound.O  - Cleaning up music with id [miscallenous_main_menu.ogg]
90639 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Sound set with id [colony_industry_shutdown]  not found
java.lang.RuntimeException: Sound set with id [colony_industry_shutdown]  not found
at com.fs.starfarer.Object.I.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatMain$3.playUISound(Unknown Source)
at data.scripts.Es_ModPlugin.onGameLoad(Es_ModPlugin.java:30)

The sound id is ui_shutdown_industry, not colony_industry_shutdown. When I change it to ui_shutdown_industry in a test mod, it works fine.

Is there a way to add some (short) text to "onmouseover-ship's-stats-systems-weapons" overlay (like in fleet, market and recovery menus) https://imgur.com/a/tFbWmnl?

There isn't, no - that bit of the UI is not set up to be configurable.


shield.setInnerRotationRate(shield.getRingRotationRate());

Hello, this method do not seems to work, or i use it badly. (I tried to give on the below shield, the same rotation)

Are you calling shield.setRadius()? That would reset the rotation rates.

Also, the rotation become weird and sometime seems "glitch"

I'm not sure what you mean so I can't really suggest anything.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4330 on: February 15, 2019, 12:21:38 PM »

Well, thank, same if this thing do not work same with the fix, strangely. Maybe because this is a omni shield? (This is a bubble where i need to change the radius many times too ><)

Thank you. I will just keep my shield like that, so ^^.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24112
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4331 on: February 15, 2019, 12:45:42 PM »

(This is a bubble where i need to change the radius many times too ><)

If you call setRadius(), that should be fine if you call setInnerRotationRate() and setRingRotationRate() afterwards. It's ok to do this continually.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4332 on: February 15, 2019, 12:47:41 PM »

(This is a bubble where i need to change the radius many times too ><)

If you call setRadius(), that should be fine if you call setInnerRotationRate() and setRingRotationRate() afterwards. It's ok to do this continually.

True, but a bit "boring" to need to reput also each frame, the sprite of the shield, who is reset just after a setRadius. But maybe because the shield do not save it, so maybe this is not very important. And i will do what you say ^^.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

Asauski

  • Ensign
  • *
  • Posts: 29
  • I'm fluent in google translate
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4333 on: February 15, 2019, 06:58:28 PM »

Is there any way to get the current target of point defense weapons?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4334 on: February 15, 2019, 08:09:08 PM »

Yes; if the weapon is not under player control, get the AI instance, then call getTargetShip(); if that returns null, then the target is a CombatEntityAPI, and (unfortunately) you'll have to determine that by using getTarget() and then finding the CombatEntityAPI closest to that point (which is quite expensive).
Logged
Please check out my SS projects :)
Xeno's Mod Pack
Pages: 1 ... 287 288 [289] 290 291 ... 710