Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 627 628 [629] 630 631 ... 710

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

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9420 on: December 22, 2022, 08:06:13 AM »

Question: How do I get the mouse position during combat? I want to know the relative bearing from a ship to the mouse.

Global.getCombatEngine().getPlayerShip().getMouseTarget(); is what you want

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9421 on: December 23, 2022, 10:46:22 AM »

a recent update to a mod had me digging around in AICoreOfficerPlugin and it gave me a few thoughts -

1 - is it possible to restrict what AI core types can be installed? e.g., if I have a special fancy automated ship and I only want my special fancy AI cores being installed in it, is that possible without janktm?
2 - is it possible to change what skills are available to AI cores? that mod I mentioned does have a custom AI core w/ a custom skill, but it doesn't appear in the picker menu to be reassigned.

(and to get a bit API request-y, if they're not currently possible, can we get methods to do them if they're not too much of a pain to implement?)

For the skill picker, if the skill is npc_only, then it only shows that skill if it also has the "ai_core" tag.

For restricting which AI cores are used, hmm. I don't think it's currently possible without, as you say, jank - if you provide your own custom plugin for the cores you *don't* want on your ship, you'd still have to create a PersonAPI for that core ID, or the game would crash. I've changed it so that the game will skip over that core ID instead.

In the meantime your best bet might be to (jankily) create a person with no skills and a name like "CAN NOT INSTALL" or something :) And also to make sure that your plugin kicks in for *all* commodities with the ai_core tag, so that it can grab priority for your ship... er, hmm, you don't have access to which ship the core is being picked for either, do you? That seems like a problem.

Let me add a FleetMemberAPI parameter to the relevant methods... there, done. Actually, never mind - that has some complications. Sorry!
« Last Edit: December 23, 2022, 12:42:26 PM by Alex »
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 150
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9422 on: December 23, 2022, 01:57:14 PM »

Is it possible to modify the damage a projectile will do right as it hits BEFORE it does it's damage? I want a projectile that loses damage with range.
I did this before by creating a weapon with only 1 damage and then adding the damage I really want afterward in the onHit event. But I'm hoping there is a better way.
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9423 on: December 23, 2022, 03:32:13 PM »

Is it possible to modify the damage a projectile will do right as it hits BEFORE it does it's damage? I want a projectile that loses damage with range.
I did this before by creating a weapon with only 1 damage and then adding the damage I really want afterward in the onHit event. But I'm hoping there is a better way.

yeah, have the weapon's everyFrameEffect add a DamageDealtModifier listener to the ship that checks if the weapon deals damage, then checks for the difference between the projectile's start point & current position

you can look at the old version of the ballistic mastery skill for an example, iirc it should still be in the API (though it might be commented out)

Let me add a FleetMemberAPI parameter to the relevant methods... there, done. Actually, never mind - that has some complications. Sorry!

awww, unfortunate but thanks for giving it a shot!
and re: AI core skills - I was a little unclear in my post, I was thinking (well, hoping heh) more along the lines of providing a list of skills that I'd want the AI to have access to in the aiCoreOfficerPlugin, though I get the feeling that that'd also be annoyingly complicated to implement.

anyway, merry christmas, thanks for letting me pick your brain about this so close to the holidays!
« Last Edit: December 23, 2022, 04:17:26 PM by Ruddygreat »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9424 on: December 23, 2022, 03:40:40 PM »

and re: AI core skills - I was a little unclear in my post, I was thinking (well, hoping heh) more along the lines of providing a list of skills that I'd want the AI to have access to in the aiCoreOfficerPlugin, though I get the feeling that that'd also be annoyingly complicated to implement.

Ahh, I see. Yeah, it's not really set up like that right now, to ask the plugin for available skills. I'll keep that in mind!

anyway, merry christmas, thanks for letting me pick your brain about this so close to the holidays!

You too, thank you!
Logged

6chad.noirlee9

  • Captain
  • ****
  • Posts: 368
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9425 on: December 24, 2022, 03:19:38 AM »

hello! having an issue with my favorite save
is it, saveable?
pun intended
Spoiler
61074 [Thread-3] INFO  exerelin.campaign.intel.merc.MercDataManager  -   Loading merc company: rocketStars
61076 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error loading
61076 [Thread-3] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  - Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : exerelin.campaign.intel.merc.MercContractIntel.readResolve()
class               : exerelin.campaign.intel.merc.MercContractIntel
required-type       : exerelin.campaign.intel.merc.MercContractIntel
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 15831
class[1]            : java.util.ArrayList
converter-type[1]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[2]            : java.util.LinkedHashMap
converter-type[2]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[3]            : com.fs.starfarer.campaign.rules.Memory
class[4]            : com.fs.starfarer.campaign.econ.Market
class[5]            : com.fs.starfarer.campaign.CampaignPlanet
class[6]            : com.fs.util.container.repo.ObjectRepository
class[7]            : com.fs.starfarer.campaign.StarSystem
class[8]            : com.fs.starfarer.campaign.CircularOrbit
class[9]            : com.fs.starfarer.campaign.CircularOrbitPointDown
class[10]           : com.fs.starfarer.campaign.CustomCampaignEntity
class[11]           : exerelin.campaign.ai.concern.PirateActivityConcern$RageEntry
class[12]           : java.util.HashSet
class[13]           : exerelin.campaign.ai.concern.PirateActivityConcern
class[14]           : exerelin.campaign.ai.MilitaryAIModule
class[15]           : exerelin.campaign.ai.StrategicAI
class[16]           : com.fs.starfarer.campaign.Faction
class[17]           : exerelin.campaign.ai.concern.HostileInSharedSystemConcern
class[18]           : exerelin.campaign.ai.concern.DevelopRelationsConcern
class[19]           : exerelin.campaign.ai.DiplomaticAIModule
class[20]           : com.fs.starfarer.campaign.econ.Submarket
class[21]           : com.fs.starfarer.campaign.econ.reach.ReachEconomy
class[22]           : com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper
class[23]           : com.fs.starfarer.campaign.econ.Economy
class[24]           : com.fs.starfarer.campaign.StarSystem$UpdateFromHyperspaceLocation
class[25]           : com.fs.starfarer.campaign.BaseLocation$LocationToken
class[26]           : com.fs.starfarer.campaign.Hyperspace
class[27]           : com.fs.starfarer.campaign.CampaignEngine
converter-type[3]   : com.fs.starfarer.campaign.save.oooO
version             : not available
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: Failed calling method
---- Debugging information ----
message             : Failed calling method
cause-exception     : java.lang.NullPointerException
cause-message       : null
method              : exerelin.campaign.intel.merc.MercContractIntel.readResolve()
class               : exerelin.campaign.intel.merc.MercContractIntel
required-type       : exerelin.campaign.intel.merc.MercContractIntel
converter-type      : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
line number         : 15831
class[1]            : java.util.ArrayList
converter-type[1]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[2]            : java.util.LinkedHashMap
converter-type[2]   : com.thoughtworks.xstream.converters.collections.MapConverter
class[3]            : com.fs.starfarer.campaign.rules.Memory
class[4]            : com.fs.starfarer.campaign.econ.Market
class[5]            : com.fs.starfarer.campaign.CampaignPlanet
class[6]            : com.fs.util.container.repo.ObjectRepository
class[7]            : com.fs.starfarer.campaign.StarSystem
class[8]            : com.fs.starfarer.campaign.CircularOrbit
class[9]            : com.fs.starfarer.campaign.CircularOrbitPointDown
class[10]           : com.fs.starfarer.campaign.CustomCampaignEntity
class[11]           : exerelin.campaign.ai.concern.PirateActivityConcern$RageEntry
class[12]           : java.util.HashSet
class[13]           : exerelin.campaign.ai.concern.PirateActivityConcern
class[14]           : exerelin.campaign.ai.MilitaryAIModule
class[15]           : exerelin.campaign.ai.StrategicAI
class[16]           : com.fs.starfarer.campaign.Faction
class[17]           : exerelin.campaign.ai.concern.HostileInSharedSystemConcern
class[18]           : exerelin.campaign.ai.concern.DevelopRelationsConcern
class[19]           : exerelin.campaign.ai.DiplomaticAIModule
class[20]           : com.fs.starfarer.campaign.econ.Submarket
class[21]           : com.fs.starfarer.campaign.econ.reach.ReachEconomy
class[22]           : com.fs.starfarer.campaign.econ.reach.ReachEconomyStepper
class[23]           : com.fs.starfarer.campaign.econ.Economy
class[24]           : com.fs.starfarer.campaign.StarSystem$UpdateFromHyperspaceLocation
class[25]           : com.fs.starfarer.campaign.BaseLocation$LocationToken
class[26]           : com.fs.starfarer.campaign.Hyperspace
class[27]           : com.fs.starfarer.campaign.CampaignEngine
converter-type[3]   : com.fs.starfarer.campaign.save.oooO
version             : not available
[close]
Logged
edit: edit: maybe were just falling with style LOL.  make a bubble, make the space in front of it smaller and just fall forward

alaricdragon

  • Commander
  • ***
  • Posts: 162
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9426 on: December 24, 2022, 01:30:56 PM »

Hello once again all. i have come with some more questions.

1) how does one change text on a commodity? (like marries and showing what combat XP they have for example)
2) how does one change the image of a commodity? (like crew and marries for example; when you get more of them, they have a new image with more of them in the background.)
3) i want to make a industry that outputs commodity's to my supply point / to the market that it is built on, but i don't quite understand the documentation or the code. does anyone know were I might find some examples of this?
4) is it possible to make a industry have more then one option for what it can upgrade into? if so how would I do that?

thank you all for the help in the past times. it has been so useful to my understanding of the games code and code in general.
« Last Edit: December 24, 2022, 01:36:17 PM by alaricdragon »
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9427 on: December 25, 2022, 05:26:21 PM »

question
what exactly kills the station core with vast bulk hullmod when all modules are destroyed? there's nothing that would do that in the hullmod code itself, just the damage mults.
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

rogerbacon

  • Commander
  • ***
  • Posts: 150
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9428 on: December 25, 2022, 08:18:58 PM »

I want to make sure a specific weapon has a restrictive firing arc on any ship it's put on. In it's script I have
Code
for (WeaponAPI weapon : ship.getAllWeapons())
{

if (weapon.getId().contains("SFB_PlasmaMauler"))
{
weapon.getSlot().setArc(1f);
}

}

After it runs, the firing arc is graphically updated to reflect the new one degree arc but the weapon can still traverse the old firing arc. This script gets called after the weapon fires for the first time. Is that too late to alter the arc? What am I doing wrong?

[edit]
While I'd still like to know why my code didn't work, I realized I can (and should) just give the weapon a turn rate of zero and that solves the problem.
« Last Edit: December 26, 2022, 06:56:07 AM by rogerbacon »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9429 on: December 26, 2022, 12:40:37 PM »

hello! having an issue with my favorite save
is it, saveable?
pun intended

Ah, sorry, this isn't the right thread for that - would you mind making a new post in the Bug Reports & Support (modded) subforum?

1) how does one change text on a commodity? (like marries and showing what combat XP they have for example)

See:
PlayerFleetPersonnelTracker

In particular, its implementation of the CommodityTooltipModifier and CommodityIconProvider interfaces.

2) how does one change the image of a commodity? (like crew and marries for example; when you get more of them, they have a new image with more of them in the background.)

This is hardcoded for personnel only, irrc.

3) i want to make a industry that outputs commodity's to my supply point / to the market that it is built on, but i don't quite understand the documentation or the code. does anyone know were I might find some examples of this?

(Not sure, sorry!)

4) is it possible to make a industry have more then one option for what it can upgrade into? if so how would I do that?

It's not, iirc. You'd have to go around the system to do that - i.e. some kind of dialog somewhere that then does stuff behind the scenes to achieve what you want.

question
what exactly kills the station core with vast bulk hullmod when all modules are destroyed? there's nothing that would do that in the hullmod code itself, just the damage mults.

A check in vanilla code; it blows up when it has no surviving module attached that has weapons or fighters.


After it runs, the firing arc is graphically updated to reflect the new one degree arc but the weapon can still traverse the old firing arc. This script gets called after the weapon fires for the first time. Is that too late to alter the arc? What am I doing wrong?

Yeah, I think it's too late at that point. Also, of note: I believe your code would change the firing arc on that mount for ALL ships of that type.
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9430 on: December 27, 2022, 09:53:38 AM »

Seems like "Dismiss" button in commodity market share screen uses either 16 or possibly 21 size Victor font, while in TooltipMakerAPI there's only setButtonFontVictor14(). Is there any way to work around this to get 100% vanilla button look?

[attachment deleted by admin]
Logged
   

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 231
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9431 on: December 28, 2022, 09:41:45 AM »

Are industries transient? AKA, can I store data in them?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9432 on: December 28, 2022, 11:14:19 AM »

Seems like "Dismiss" button in commodity market share screen uses either 16 or possibly 21 size Victor font, while in TooltipMakerAPI there's only setButtonFontVictor14(). Is there any way to work around this to get 100% vanilla button look?

It's 20pt Orbitron, actually! Added to TooltipMakerAPI:

   void setButtonFontOrbitron20();
   void setButtonFontOrbitron20Bold();
   void setButtonFontOrbitron24();
   void setButtonFontOrbitron24Bold();

Are industries transient? AKA, can I store data in them?

You can, yes! (This should be fairly trivial to check, no? You can e.g. see it happening in OrbitalStation, and you could try a simple string with a custom value to see if it's in the savefile.)
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 231
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9433 on: December 29, 2022, 07:47:16 AM »

Is there any way to mark a special item as installable in any industry that outputs commodities? Ideally, I'd just be able to use a API method for this, because I have something specific in mind, e.g. it should be installable in anything that either produces commodities or outputs production capacity.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9434 on: December 29, 2022, 09:12:19 AM »

Is there any way to mark a special item as installable in any industry that outputs commodities? Ideally, I'd just be able to use a API method for this, because I have something specific in mind, e.g. it should be installable in anything that either produces commodities or outputs production capacity.

I don't think so, not without editing the industry code - what's installable in an industry is governed by that industry.
Logged
Pages: 1 ... 627 628 [629] 630 631 ... 710