Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 376 377 [378] 379 380 ... 706

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

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5655 on: November 12, 2019, 03:41:37 PM »

How can I affect the likelihood that items with a certain tag will show up in a given market, without changing their availability to the faction that owns it?
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5656 on: November 12, 2019, 03:42:13 PM »

How can I check if the current ship is being piloted by the player?

How do i get the Peak Performance duration of a ship?
You can get it via getPeakCRDuration() from a ship's mutable stats:

e.g.
   
Code
 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
       stats.getPeakCRDuration();
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5657 on: November 12, 2019, 03:48:36 PM »

How can I check if the current ship is being piloted by the player?

How do i get the Peak Performance duration of a ship?
You can get it via getPeakCRDuration() from a ship's mutable stats:

e.g.
   
Code
 public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
       stats.getPeakCRDuration();
How do i convert the StatBonus to float?
Logged
Check out my ships

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5658 on: November 12, 2019, 03:54:34 PM »

How do i convert the StatBonus to float?
I'm not sure if there's a function that calculates the full stat bonus but all of these functions return float

Code
        stats.getPeakCRDuration().getFlatBonus(source).value;
        stats.getPeakCRDuration().getMultBonus(source).value;
        stats.getPeakCRDuration().getPercentBonus(source).value;
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5659 on: November 12, 2019, 07:21:22 PM »

I figured it out - this is a problem with how I'm applying the industry that adds the submarket. Every time I was entering the screen the industry was getting Unapplied and then Applied again, refreshing the stock. At least, I think that's what's going on, since commenting out the unapply code fixed the refreshing.

Ahh yes, the Open Market added by Commerce has/had the same problem. I don't remember if it's fixed in 0.9.1a or just in my dev build, though, but, yeah.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5660 on: November 13, 2019, 10:03:59 PM »

How can I check if the current ship is being piloted by the player?
Pretty sure you can use ship.getShipAI() == null for this
http://fractalsoftworks.com/forum/index.php?topic=5061.msg269533#msg269533

How do i get the Peak Performance duration of a ship?
I think this might be a simpler and potentially more reliable way to do it:
Code
ship.getMutableStats().getPeakCRDuration().computeEffective(ship.getHullSpec().getNoCRLossTime())

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5661 on: November 14, 2019, 04:29:27 AM »

What's the best way to implement a shipsystem taking a chunk (or rapidly increasing loss of) CR?

MutableShipStats has a few entires I tried playing with, but no actual CR loss seems to occur.
Logged

Innominandum

  • Commander
  • ***
  • Posts: 166
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5662 on: November 14, 2019, 09:49:43 AM »

Where would one go, if one wanted to have a look under the hood in regards to AI combat profiles, like the standard ship combat behaviour and the Officers traits overriding them?
Logged
"The early worm catcheth the bird."

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5663 on: November 14, 2019, 10:19:02 AM »

Where would one go, if one wanted to have a look under the hood in regards to AI combat profiles, like the standard ship combat behaviour and the Officers traits overriding them?

It's all in core code, so unfortunately there isn't anything exposed you could really look at.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5664 on: November 14, 2019, 03:52:01 PM »

What's the best way to implement a shipsystem taking a chunk (or rapidly increasing loss of) CR?

MutableShipStats has a few entires I tried playing with, but no actual CR loss seems to occur.
Without knowing what you're trying to do it's hard to guess what the best way to implement it is, but as a last resort you can always brute-force it with ship.setCurrentCR()

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5665 on: November 14, 2019, 06:55:05 PM »

I am not sure if i already asked this before, but is there a way to tell nearby enemy AI "hey i gonna do something dangerous, stay away from me"? I wanna make a self-destruct system. But want to make sure the AI can react to it.
Logged
Check out my ships

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5666 on: November 15, 2019, 04:52:24 AM »

What's the best way to implement a shipsystem taking a chunk (or rapidly increasing loss of) CR?

MutableShipStats has a few entires I tried playing with, but no actual CR loss seems to occur.
Without knowing what you're trying to do it's hard to guess what the best way to implement it is, but as a last resort you can always brute-force it with ship.setCurrentCR()

Either ship taking a big CR hit on shipsystem activation OR a ship having a greatly increased CR drain while it's active.I tired the second one, but it doesn't look like CR is decreasing at all. Or does it only affect a ship after Peak time?
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5667 on: November 15, 2019, 05:27:46 AM »

What's the best way to implement a shipsystem taking a chunk (or rapidly increasing loss of) CR?

MutableShipStats has a few entires I tried playing with, but no actual CR loss seems to occur.
Without knowing what you're trying to do it's hard to guess what the best way to implement it is, but as a last resort you can always brute-force it with ship.setCurrentCR()

Either ship taking a big CR hit on shipsystem activation OR a ship having a greatly increased CR drain while it's active.I tired the second one, but it doesn't look like CR is decreasing at all. Or does it only affect a ship after Peak time?

Check the code for my Wurgandal Tyrant's Maw, I do CR reduction in there.
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5668 on: November 15, 2019, 09:49:21 AM »

I am not sure if i already asked this before, but is there a way to tell nearby enemy AI "hey i gonna do something dangerous, stay away from me"? I wanna make a self-destruct system. But want to make sure the AI can react to it.

Hmm. The only thing that comes to mind is deploying a fake enemy fleet member, keeping its position on your ship, and putting an "Avoid" order on it. Might have some side effects, not really sure.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5669 on: November 15, 2019, 12:29:36 PM »

hey, API question: in http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/CombatFleetManagerAPI.html

 getTaskManager(boolean ally)

what does that boolean flag do? I'm trying to debug the Edith escort script

[edit] Aaaand as soon as I post I remember to search here and not just google. let me just leave this here...
I think you want:
combatFleetManagerAPI.getTaskManager(false)

Passing true there gives you the task managed for allied forces (for an ongoing battle), not the player's.


[More edits!] Ah darn, but now I'm confused again. According to the above, the following line:

Code
engine.getFleetManager(FleetSide.PLAYER).getTaskManager(true).setPreventFullRetreat(true);

Would only set the allied fleet to the players to no retreat, but the players could still retreat? Because that is not the behavior I see in mission.
« Last Edit: November 15, 2019, 12:34:06 PM by Thaago »
Logged
Pages: 1 ... 376 377 [378] 379 380 ... 706