Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 433 434 [435] 436 437 ... 564

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20047
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6510 on: June 07, 2020, 09:49:46 AM »

I'm creating a proof-of-concept campaign feature where two temporary, random fleets are generated and the player uses one of them to fight the other. The player does not use their own ships or officers acquired in campaign.

Right now, I can display the fleets and launch a battle from a rules-based interaction dialog. But there are two problems:
- The player's campaign fleet is added to the temporary player fleet and available for deployment in-battle, even though the campaign fleet isn't added to the BattleAPI
- I don't know how to detect battle completion and display its outcome

So, my question is: Is it feasible to do this sort of thing purely within the rules-based dialog, and if so, how do I fix the above issues?
(I would prefer not to deal with the complexity of the regular fleet interaction dialog if I don't have to)

I'd say that using SectorAPI.setPlayerFleet() (assumnig this is exposed in the current release?) to temporarily change what the player fleet is is your best bet. The implementation of BattleAPI checks whether a fleet is the player fleet in a number of places to figure out whether a side is the player side, etc.


Is there any simple way to override the effect of setPhase() disabling weapons?

There isn't, no.
Logged

SirHartley

  • Captain
  • ****
  • Posts: 480
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6511 on: June 09, 2020, 12:12:08 PM »

Sincere apologies for asking a question as broad as this, but -
I am trying to add an industry that behaves as campaign layer comm relay without actually adding a relay to the system.
The implementation of Campaign Objectives stumps me (there are two concurrent systems for handling them?)

To boil it down - is it possible to make a star system think it has a comm relay while it doesn't have one - and if yes, where do I start?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20047
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6512 on: June 09, 2020, 12:30:59 PM »

There's only one system for it; I'm not sure what you mean. Perhaps you're also looking at the combat-level comm relays?

Take a look at CommRelayCondition and CommRelayEntityPlugin. The former does most of the work, the latter populates its list of relays.

The easiest thing would IMO for the industry to add/remove a hidden comm relay somewhere. You could also have a different custom entity function as a relay as long as its plugin was similar enough to CommRelayEntityPlugin - that is, as long as it adds the condition/adds the entity to the condition's list of relays.
Logged

shoi

  • Captain
  • ****
  • Posts: 423
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6513 on: June 10, 2020, 10:03:08 PM »

Is there anyway to directly modify the replacement rate % for carriers in combat? I saw some mults for fighter replacement but I dont think those are doing what I want
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2049
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6514 on: June 11, 2020, 12:28:36 AM »

Is there anyway to directly modify the replacement rate % for carriers in combat? I saw some mults for fighter replacement but I dont think those are doing what I want

That should be what you use from my experience. What's your target implementation? I'll try and help. I don't think you can go below 30% replacement rate in general though for any individual carrier.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1293
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6515 on: June 11, 2020, 03:00:19 AM »

Hmm - something like:

String key = SINK_DATA_KEY + "_" + ship.getId();

And then using key instead of SINK_DATA_KEY in the rest of the method should do the job. I've changed it to this on my end, but for the moment you'd need to override the hullmod with your own implementation to get this effect.
I'm trying something like this for one of my mods that would also suffer this, but my tools for reasons outside of my control are... Notepad++. That's it XD.

When it tries to compile I get
"Unknown variable or type "ship""

I figure there's something else I'll have to import?

shoi

  • Captain
  • ****
  • Posts: 423
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6516 on: June 11, 2020, 02:03:19 PM »

Is there anyway to directly modify the replacement rate % for carriers in combat? I saw some mults for fighter replacement but I dont think those are doing what I want

That should be what you use from my experience. What's your target implementation? I'll try and help. I don't think you can go below 30% replacement rate in general though for any individual carrier.

I'm working on a hullmod that launches a drone from a carrier when a ship that has it gets close, and I just want to decrease the carriers replacement rate as the drone is repairing the ship..if you could help , i'd appreciate it
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2049
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6517 on: June 11, 2020, 03:06:59 PM »

I'm working on a hullmod that launches a drone from a carrier when a ship that has it gets close, and I just want to decrease the carriers replacement rate as the drone is repairing the ship..if you could help , i'd appreciate it

I think a way you could do this would be to set up a timer under:

Code
	@Override
public void advanceInCombat(ShipAPI ship, float amount) {

}

Then to periodically reduce replacement rate you would use something like:

Code
  
*(outside timer)*     
float reduction = 0f;
MutableShipStatsAPI stats = ship.getMutableStats();
*(outside timer)*

*(drone repairing returns true)*
*(inside timer)*

reduction = 10f;
stats.getFighterRefitTimeMult().modifyPercent(id, 100 - reduction);
*(increment timer)*

*(drone repairing returns true)*
reduction = 20f;
stats.getFighterRefitTimeMult().modifyPercent(id, 100 - reduction);
*(increment timer)*

etc, until:

 *(drone repairing returns false)*
 *(reset replacement rate)*
 *(reset timer)*
 reduction = 0f;

*(inside timer)*

Hopefully that make sense I'm not sure how well I explained it. Then you can use increments that fit the behavior you would like to see. For instance here I go by 10% with an implied timer of ~5 seconds to create roughly a 2% decay per second.

If you just want a flat decrease while repairing you wouldn't even really need the timer. That would more be like:

Code
while (drone repairing) {
    float reduction = 50f;
    ship.getMutableStats().getFighterRefitTimeMult().modifyPercent(id, reduction);
}

You might have to play around with the various modifiers to getFighterRefitTimeMult() to see what works the best. For instance to increase the replacement rate I use:

getFighterRefitTimeMult().modifyMult(id, 1f - REFIT_TIME_PERCENT / 100f);

Hope that helps! :)
Logged

shoi

  • Captain
  • ****
  • Posts: 423
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6518 on: June 11, 2020, 07:06:50 PM »

Thanks! I (think) it works; when I tried it replacement rate seemed to decrease faster after taking fighter casualties, its too bad I can't directly set the replacement rate % though. This should be good enough either way :)
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2049
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6519 on: June 11, 2020, 10:22:48 PM »

I'm trying something like this for one of my mods that would also suffer this, but my tools for reasons outside of my control are... Notepad++. That's it XD.

When it tries to compile I get
"Unknown variable or type "ship""

I figure there's something else I'll have to import?

Ah that sucks an IDE is much easier to use with this sort of thing. If you link me the code I'll plug it in real quick and see what I find as it may be something simple.

Thanks! I (think) it works; when I tried it replacement rate seemed to decrease faster after taking fighter casualties, its too bad I can't directly set the replacement rate % though. This should be good enough either way :)

Glad that helped! There might be a method to set the refit rate as a flat amount. (I *think* this would essentially be your preferred way of setting replacement rate % directly but I don't think I've ever used it so I'm not sure.)
« Last Edit: June 11, 2020, 10:25:30 PM by Morrokain »
Logged

TheWetFish

  • Commander
  • ***
  • Posts: 138
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6520 on: June 13, 2020, 12:35:52 AM »

Can we interact with the process of splitting a hulk into pieces?
Either overriding how it splits up or adding arbitrary shaped additional splits in it?
Logged

Mongreal

  • Ensign
  • *
  • Posts: 46
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6521 on: June 13, 2020, 01:59:13 AM »

Pulse weapons are extremely deprecated so I'd recommend not using them. Unless you just mean adding a chargeup time  to a weapon firing? Or do you mean the (very, very old) "hold button to charge, release to fire" behavior?

It's the old behavior that I'm referencing, yes. I've been trying different script on some weapon so that their effect varies depending on the charge level before the shot (my mains attempts were : increasing the speed and range for a large kinetic railgun, increasing the explosive power and adding some AoE to a large explosive artillery, and more recently, I tried using the charge level to increase the size of the burst fired by a medium fragmentation weapon, a sort of volleygun which could either fire a few rounds at a time at a quick firerate, or a large batch of projectile if charged for some time).

Is there actually a way to make this work, even with scripting ? I don't really know how, maybe checking the charging rate to spot the frame where its decreasing, meaning that the fire button has been released ? But then, can I make a weapon fire by forcing its charge level to 1 ?
Logged

MeinGott

  • Ensign
  • *
  • Posts: 30
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6522 on: June 13, 2020, 02:30:43 AM »

Hello,
What parameter do I add/remove/change in xml save file if I want Legio Infernalis market destroyed (alternatively susceptible to saturation bombardment and abandonment)?
I updated Tahlan mod so I could disables sieges, but there are plenty leftover Legio stations in hyperspace that cant be defeated (cant invade, saturate, destroy, nothing).
thank you

EDIT
actually better place for this question would be Nia Tahl's thread, sorry
« Last Edit: June 13, 2020, 03:05:59 AM by MeinGott »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20047
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6524 on: June 13, 2020, 04:16:04 PM »

It's the old behavior that I'm referencing, yes. I've been trying different script on some weapon so that their effect varies depending on the charge level before the shot (my mains attempts were : increasing the speed and range for a large kinetic railgun, increasing the explosive power and adding some AoE to a large explosive artillery, and more recently, I tried using the charge level to increase the size of the burst fired by a medium fragmentation weapon, a sort of volleygun which could either fire a few rounds at a time at a quick firerate, or a large batch of projectile if charged for some time).

Is there actually a way to make this work, even with scripting ? I don't really know how, maybe checking the charging rate to spot the frame where its decreasing, meaning that the fire button has been released ? But then, can I make a weapon fire by forcing its charge level to 1 ?

Hmm, offhand, I'm not quite sure. I mean, you could have the weapon script launch a custom effect/shot and have the normal weapon shot be entirely invisible, so that might be the way to go. Regardless, though, the ship AI won't be aware of it - either using this or defending against it - so it seems... well, it could be alright in some specific circumstances, but you'd want to be very careful it doesn't become something that can easily cheese the AI because it doesn't know about it.

How do I stop custom inbuilt weapons from dropping blueprints from, say, Tech Mining?

SYSTEM hint in the csv should do it.
Logged
Pages: 1 ... 433 434 [435] 436 437 ... 564