Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 365 366 [367] 368 369 ... 710

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

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5490 on: October 25, 2019, 11:37:33 AM »

So, I know variants with modules will not install the modules' hullmods when using autofit on the refit screen, instead replacing them with caps/vents. Do variants spawned in enemy fleets have the same problem?
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5491 on: October 25, 2019, 03:43:18 PM »

But line 91 is vanilla code:
Code
			String commodity = ResourceDepositsCondition.COMMODITY.get(mc.getId());

What file is that from in vanilla api? What is mc defined as, has it been properly initialized and what does getId() return? A String I assume?

It's weird because get() from ResourceDepositsCondition in this case returns a String, not an Object, according to IntelliJ. So there shouldn't even be a conversion being attempted there.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5492 on: October 25, 2019, 03:47:28 PM »

What file is that from in vanilla api?
api\impl\campaign\econ\impl\farming.java
Quote
It's weird because get() from ResourceDepositsCondition in this case returns a String, not an Object, according to IntelliJ. So there shouldn't even be a conversion being attempted there.
It's almost enough to make me set up my IntelliJ, but getting Java 7, and finding a good tutorial for actually setting it up...
Yeah, I'll pass :P

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5493 on: October 25, 2019, 05:36:27 PM »

How do i check if a ship is in autopilot again?

Code
ship.getAIFlags() != null

right? I need to make sure my code only works if the player ship is in Autopilot or its fully AI controlled

-edit-

Nevermind it was
Code
getShipAI() != null

thanks to Lazywizard
« Last Edit: October 25, 2019, 05:42:13 PM by Ed »
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5494 on: October 25, 2019, 06:01:50 PM »

So, I know variants with modules will not install the modules' hullmods when using autofit on the refit screen, instead replacing them with caps/vents. Do variants spawned in enemy fleets have the same problem?

(If this is indeed a problem I'd imagine it affects both, but I'm not aware of it either way...)
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5495 on: October 25, 2019, 07:25:09 PM »

I have a system that marks a target and after a while it swaps places with the target, i just noticed there is a problem with the system, since two ships with this system can mark the same target at the same time which would result in quite the mess, i was thinking of possible solutions for this.

The best solution  i thought would be using a stats "buff" with a special name that the second ship using the system would check before marking the target for swapping, so only the first ship would end up marking the target, as a bonus since this is a rescue system i would like the buff to grant a bit of damage reduction until it gets swapped, but I am afraid of possible exploits cancelling the system and keeping the buff. So questions:

How do i check for a specific active stats modification ID?
Is there a way to give a stats modification with a timer? or would the buff remain in the target forever until the swap system removed it manually with unmodify?
« Last Edit: October 25, 2019, 07:27:33 PM by Ed »
Logged
Check out my ships

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 #5496 on: October 25, 2019, 08:00:41 PM »

I feel as though I'm doing something stupid, but I've run into a bit of a problem.

The idea is go to custom entity -> trigger a series of events to occur in rules.csv, similar to the RedPlanet event chain. However, when I go to the entity, instead of triggering the rules.csv event chain, it's under the impression the entity is a research station, and when you break it down, it doesn't give salvage. Am I missing a key feature? The rules.csv looks for a tag, which the station is tagged with, and should go through the event chain. But for some reason it refuses to do this.

Could someone tell me if I'm missing something?

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5497 on: October 25, 2019, 10:22:09 PM »

How do i check for a specific active stats modification ID?
If I understand your question correctly, you might try something like this:
Code
stats.getArmorDamageTakenMult().getFlatMods().containsKey("key_to_check_for")
Of course, you might need to use getMultMods or getPercentMods instead of getFlatMods, depending on how you apply the buff.
I don't know of anything within the API for temporary applying a buff.

Could someone tell me if I'm missing something?
I can't think of anything likely off the top of my head, but then I'm not exactly a rules.csv guru. It might be a good idea to post the relevant rules.csv rows so people can take a look.

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5498 on: October 26, 2019, 05:23:17 AM »

How do i check for a specific active stats modification ID?
If I understand your question correctly, you might try something like this:
Code
stats.getArmorDamageTakenMult().getFlatMods().containsKey("key_to_check_for")
Of course, you might need to use getMultMods or getPercentMods instead of getFlatMods, depending on how you apply the buff.
I don't know of anything within the API for temporary applying a buff.
Oh i see you have to check the type of statmod and get all mods of that type, i thought there would be some kind of getAllActiveMods() for the ship, now i understand, thanks.
If there are no temporary buffs i will have to take some anti exploit measures then
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 #5499 on: October 26, 2019, 04:30:17 PM »

How do I make missiles stop exploding once they flame out? I notice there's maybe some random chance of them still detonating if they hit a ship past their fuel range - how do I make them always collide like inert objects past this point? Oh, and I don't mean all missiles, just a certain missile I'm trying to make.

Also, is there a way to spawn junk hulks into the game? Like if the missile explodes, it leaves its carcass lying around. Or bits and pieces of it.
« Last Edit: October 26, 2019, 05:18:16 PM by creature »
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5500 on: October 26, 2019, 06:45:48 PM »

How do I make missiles stop exploding once they flame out? I notice there's maybe some random chance of them still detonating if they hit a ship past their fuel range - how do I make them always collide like inert objects past this point? Oh, and I don't mean all missiles, just a certain missile I'm trying to make.
I don't know if there's anything in the .proj file for preventing missiles from exploding once they flame out, but you might be able to make that work with this:
Code
myMissile.setArmedWhileFizzling(false);
Also, is there a way to spawn junk hulks into the game? Like if the missile explodes, it leaves its carcass lying around. Or bits and pieces of it.
I'm not sure about this one. It depends on exactly what you want to do. If you want the pieces to have collision physics you'd probably have to resort to crazy hacks, but creating a few particle effects when it's destroyed would probably be pretty simple.

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5501 on: October 26, 2019, 06:58:37 PM »

So, when Global.getSector().doHyperspaceTransition() is used, is there a way to set (or at least get) the amount of time between calling the function and the actual location transition? At first I thought it was constant, but it seems to vary quite a bit based on fleet size.

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 #5502 on: October 26, 2019, 09:30:00 PM »

Could someone tell me if I'm missing something?
I can't think of anything likely off the top of my head, but then I'm not exactly a rules.csv guru. It might be a good idea to post the relevant rules.csv rows so people can take a look.

Here's the section of rules.csv I'm using, and here's the salvage file that's used in the event.

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5503 on: October 27, 2019, 03:09:56 AM »

If I wanted to multiply the supply and production of an industry, what should I call?

Also where is what conditions an industry needs determined?

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 #5504 on: October 27, 2019, 05:03:00 AM »

If I wanted to multiply the supply and production of an industry, what should I call?

Also where is what conditions an industry needs determined?

Supply and Demand of an industry is derived from the industry itself. In mods it's usually in the compiled part of the mod, in src->data->campaign -> econ -> industries. In Vanilla, it's in the starfarer.api folder, in com ->fs -> starfarer -> api -> impl -> campaign -> econ -> impl.

As for conditions, I'm afraid I'm not sure.
Pages: 1 ... 365 366 [367] 368 369 ... 710