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 ... 224 225 [226] 227 228 ... 706

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

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3375 on: May 23, 2017, 05:47:40 AM »

Question - I want to make a booster module. As in, attach a solid fuel rocket to your ship for a temporary speed boost. The idea is that it would give you +X speed for Y seconds in battle.

Making a hullmod to give extra speed it easy. But how to turn it off after Y seconds?
Quote
private IntervalUtil time_off = new IntervalUtil(1,1);
public void advanceInCombat(ShipAPI ship, float amount){
  // Code for active the flag "active" and put more speed to ship
     if(active){
          time_off.advance(amount);
          if(time_off.intervalElapsed()){
            //Code for put per default the speed of the ship.
           // And put the flag active to false;
    }
 }
}
Maybe that? I am maybe on wrong.  Amount  per frame is between 0.017 and 0.023 so put more than that on the intervalutil.
For enable per a button the flag "active", I do not know, sorry.
« Last Edit: May 23, 2017, 05:49:30 AM by Snrasha »
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.

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3376 on: May 24, 2017, 08:24:59 PM »

Which part in the script/data file is responsible for spawnimg high-tech [REDACTED]s?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3377 on: May 24, 2017, 08:27:27 PM »

Which part in the script/data file is responsible for spawnimg high-tech [REDACTED]s?

com.fs.starfarer.api.impl.campaign.procgen.themes.RemnantThemeGenerator.java
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3378 on: May 24, 2017, 09:14:15 PM »

Thanks for the prompt reply!

Aaaaand... which part is responsible for their behavior? Like, engage even when severely outnumbered, no jump to Hyperspace, etc.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3379 on: May 24, 2017, 09:38:50 PM »

com.fs.starfarer.api.impl.campaign.procgen.themes.RemnantSeededFleetManager
initRemnantFleetProperties()
addRemnantInteractionConfig()
addRemnantAICoreDrops()
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3380 on: May 24, 2017, 11:10:04 PM »

Question - is that AI hard-coded for a faction "remnant" or can it be used on others?
Logged

c0nr4d1c4l

  • Commander
  • ***
  • Posts: 103
  • Local forum transient
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3381 on: May 25, 2017, 10:12:09 PM »

How does one make a ship NPC only?
Logged
"Slap slap slap, clap clap clap"

Head salesman and CEO of the Discount Shipyard

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3382 on: May 26, 2017, 01:19:49 AM »

How does one make a ship NPC only?

Like the Remnant droneships? They have an "UNBOARDABLE" tag in the ship_data.csv.

Only works for factions that don't have markets though. If you had a faction with an unboardable ship, but an accessible market there's a chance the ship could spawn in the market and be purchaseable.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3383 on: May 26, 2017, 09:02:24 AM »

Is there a case where BattleAPI.getPlayerSideSnapshot() should/would be null? I'm getting an NPE with my custom FleetInteractionDialogPluginImpl after an engagement round in a battle.

Code
320436 [Thread-5] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.api.impl.campaign.FleetInteractionDialogPluginImpl.backFromEngagement(FleetInteractionDialogPluginImpl.java:431)
at exerelin.campaign.NexFleetInteractionDialogPluginImpl.backFromEngagement(NexFleetInteractionDialogPluginImpl.java:62)
at com.fs.starfarer.campaign.CampaignState.prepare(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Question - is that AI hard-coded for a faction "remnant" or can it be used on others?
The AI flags can be set for any fleet in a mod's code.
(You could even call initRemnantFleetProperties directly, but since it also causes AI core drops you probably don't want to do this)

Spoiler
Code: java
public static void initRemnantFleetProperties(Random random, CampaignFleetAPI fleet, boolean dormant) {
fleet.removeAbility(Abilities.EMERGENCY_BURN);
fleet.removeAbility(Abilities.SENSOR_BURST);
fleet.removeAbility(Abilities.GO_DARK);

// to make sure they attack the player on sight when player's transponder is off
fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_SAW_PLAYER_WITH_TRANSPONDER_ON, true);
fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PATROL_FLEET, true);

fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_MAKE_AGGRESSIVE, true);
fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_NO_JUMP, true);

if (dormant) {
fleet.setTransponderOn(false);
// fleet.getMemoryWithoutUpdate().unset(MemFlags.MEMORY_KEY_PATROL_FLEET);
// fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE, true); // so they don't turn transponder on
// fleet.addAssignment(FleetAssignment.HOLD, null, 1000000f, "dormant");
fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_MAKE_ALLOW_DISENGAGE, true);
fleet.setAI(null);
fleet.setNullAIActionText("dormant");
}

addRemnantInteractionConfig(fleet);
addRemnantAICoreDrops(random, fleet, 1f);
}
[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3384 on: May 26, 2017, 06:37:37 PM »

Is there a case where BattleAPI.getPlayerSideSnapshot() should/would be null? I'm getting an NPE with my custom FleetInteractionDialogPluginImpl after an engagement round in a battle.

Took a quick look - looks like only if there is no player side in the battle, i.e. if neither side has the player fleet in it.
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3385 on: May 27, 2017, 02:54:25 AM »

In combat, can I spawn:

1. Empty CombatEntity, with location and initial velocity vector defined
2. A ship
3. a drone, not defined by ship system(though technically same as 2)

via script?
« Last Edit: May 27, 2017, 02:56:43 AM by Aron0621 »
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3386 on: May 28, 2017, 01:23:47 PM »

what's the difference between the weapon hints? Specifically:

PD vs PD_ALSO VS ANTI_FTR, PD

STRIKE VS STRIKE, USE_VS_FRIGATES (now that ships use strike weapons on frigates anyway, right?)

also how is FIRE_WHEN_INEFFICIENT calculated?


also: How does the lion's guard subfaction work internally? I can't seem to figure it out by looking at the source files. If I'm say trying to make a sub faction for pirates, how would I go about doing that?
« Last Edit: May 28, 2017, 03:12:40 PM by PCCL »
Logged
mmm.... tartiflette

AxleMC131

  • Admiral
  • *****
  • Posts: 1722
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3387 on: May 28, 2017, 03:27:48 PM »

what's the difference between the weapon hints? Specifically:

PD vs PD_ALSO VS ANTI_FTR, PD


PD: Will target missiles.
PD_ALSO (when combined with PD): Will target missiles, but will prioritize fighters and warships.
ANTI_FTR: Will prioritize fighters.

These can be combined in a couple of ways, although "PD_ALSO" must be combined with "PD".


STRIKE VS STRIKE, USE_VS_FRIGATES (now that ships use strike weapons on frigates anyway, right?)

Umm. I don't know what you mean by "now that ships use strike weapons on frigates anyway". By default, a ship with a STRIKE weapon won't use it against frigates. I think there are some special circumstances where it will (if there are no other enemies on the field, if it's a last-ditch attempt to kill them, etc.) but most of the time they won't.

USE_VS_FRIGATES allows them to do that, or at least allows them to do it more readily.


Can't remember FIRE_WHEN_INEFFICIENT, but I think it has something to do with both the firing ship's flux and the target ship's flux.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3388 on: May 28, 2017, 07:41:39 PM »

also: How does the lion's guard subfaction work internally? I can't seem to figure it out by looking at the source files. If I'm say trying to make a sub faction for pirates, how would I go about doing that?
LionsGuardFleetManager is added to Sindria (the market) and spawns patrol fleets for the Lion's Guard faction (so that it uses their ships, officers, etc.), then transfers the fleet to the Diktat faction.
You can make a pirate subfaction in the same way if so desired, but depending on what you're doing a more complex implementation may be called for.
Logged

Clockwork Owl

  • Admiral
  • *****
  • Posts: 790
    • View Profile
    • Starsector South Korean Community
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3389 on: May 29, 2017, 05:34:02 PM »

How do I affect the AI's threat analysis? I made a "torpedo drone" that goes torpedo mode which disables the weapons on it, and the target ship promptly drops the shield to take torpedo damage in the face.
Logged
Pages: 1 ... 224 225 [226] 227 228 ... 706