Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 491 492 [493] 494 495 ... 710

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

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7380 on: May 12, 2021, 11:30:48 AM »

I have a beam weapon spawning an explosion with engine.spawnDamagingExplosion. I would like this explosion damage to be scaled with the captain's skills.
can I use engine.applyDamageModifiersToSpawnedProjectileWithNullWeapon(..) after spawning the explosion? And if yes, how do I get the proper damageAPi from the explosion.

if that doesn't work, how do I get all modifier that apply on a damage type if I want to scale the damage before calling spawnDamagingExplosion.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7381 on: May 12, 2021, 12:10:32 PM »

How does the game handle replacement rate of a bay if I explicitly set it to below minimum?
Does it just bounce back magically? Or does it simply stop dropping from lost fighter ticks?

I ask this because in my Modern Carriers mod there is a hullmod Load Balancer that shifts the replacement rates around different bays. It strucks me when I think of the possibility of deliberately leaving a empty bay to fuel other bays’ replacement rate. If the game allows replacement rate lower than minimum for regular bays, there is some incentive to sacrifice a bay for other bays to remain peak replacement using such hull mod and provide some interesting strategies.

IIRC leaving a bay empty in vanilla will actually help with the replacement rate somewhat since that bay will count as if it had a wing that hadn't suffered any losses.

But, yes, if the rate is set below the minimum it will get clamped up to that basically immediately (or a frame later).

I have a beam weapon spawning an explosion with engine.spawnDamagingExplosion. I would like this explosion damage to be scaled with the captain's skills.
can I use engine.applyDamageModifiersToSpawnedProjectileWithNullWeapon(..) after spawning the explosion? And if yes, how do I get the proper damageAPi from the explosion.

if that doesn't work, how do I get all modifier that apply on a damage type if I want to scale the damage before calling spawnDamagingExplosion.

That should work, yes! You can call getDamage() on the return value of spawnDamagingExplosion(). I'd suggest checking out the javadoc; it makes it easier to look up answers to those sorts of questions.

https://fractalsoftworks.com/starfarer.api/index.html?overview-summary.html
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7382 on: May 12, 2021, 12:29:19 PM »

I have a beam weapon spawning an explosion with engine.spawnDamagingExplosion. I would like this explosion damage to be scaled with the captain's skills.
can I use engine.applyDamageModifiersToSpawnedProjectileWithNullWeapon(..) after spawning the explosion? And if yes, how do I get the proper damageAPi from the explosion.

if that doesn't work, how do I get all modifier that apply on a damage type if I want to scale the damage before calling spawnDamagingExplosion.

That should work, yes! You can call getDamage() on the return value of spawnDamagingExplosion(). I'd suggest checking out the javadoc; it makes it easier to look up answers to those sorts of questions.

https://fractalsoftworks.com/starfarer.api/index.html?overview-summary.html

in the javadoc the only comment for getDamage() is "Do not call for explosions." So I am a bit confused, isnt the DamagingProjectileAPI returned from spawnDamagingExplosion an Explosion?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7383 on: May 12, 2021, 12:51:38 PM »

Ah - I think that comment may be out of date, actually. I'd give it a shot and see if it works correctly or not. In general that's probably a good thing to do...
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7384 on: May 13, 2021, 03:06:20 PM »

Can ELECTRONIC_WARFARE_PENALTY_MULT be modified mid-combat or only before ship creation?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7385 on: May 13, 2021, 03:08:38 PM »

Ah, I don't actually remember offhand; seems like it'd be reasonably easy to test though.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7386 on: May 13, 2021, 03:12:18 PM »

Testing indicated it doesn't. Which seems kinda odd for a "dynamic" stat, but I guess dynamic just means "not hardcoded" in this context.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7387 on: May 13, 2021, 03:19:42 PM »

Yeah, "dynamic" just means that in this context.

Looking at the script, though (ElectronicWarfareScript), it looks like it would be applied based on the current value of the stat.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7388 on: May 13, 2021, 03:48:40 PM »

My bad. Did a test with properly extreme conditions (Gauss Cannon go!) and it does modify dynamically. Discovered I accidentally inverted my EW reduction so it worked better the worse it was supposed to be ;D Math is hard.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7389 on: May 13, 2021, 10:38:22 PM »

Has DELIVER_CREW (and a bunch of other assignments I tried, including ORBIT_PASSIVE, FOLLOW and INTERCEPT) stopped working as a way to tell a fleet to go to player fleet in another star system?

The fleet generated by the following code just flies in a circle if player is not in the same system, or stays perfectly still if player is:
Code: java
runcode 
import com.fs.starfarer.api.impl.campaign.fleets.FleetParamsV3;
import com.fs.starfarer.api.impl.campaign.fleets.FleetFactoryV3;
StarSystemAPI thule = Global.getSector().getStarSystem("Thule");
Vector2f locInHyper = thule.getLocation();
FleetParamsV3 params = new FleetParamsV3(locInHyper,
"persean", null, "patrolMedium",
50,0f,0f,0f,0f,0f,0f);
CampaignFleetAPI fleet = FleetFactoryV3.createFleet(params);
thule.addEntity(fleet);
fleet.setLocation(2000, 2000);
fleet.addAssignment(FleetAssignment.DELIVER_CREW, Global.getSector().getPlayerFleet(), 1000);
If this is intended, what's the new assignment to order a fleet to go to player in a different system (preferably without stopping to engage random enemies along the way)?

EDIT: While I'm here, a couple more questions:
- Can the Janus jump destination window be repurposed for another feature?
- Is there a way to mark a ship as unable to be refitted or sold/scuttled/stored?

EDIT 2: Bug report. If you add a button to the TooltipMakerAPI created by a beginImageWithText call, the button doesn't respond to mouse input.
« Last Edit: May 14, 2021, 02:49:14 AM by Histidine »
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7390 on: May 14, 2021, 11:28:19 AM »

Getting this error when I try to fire a weapon:

Code
4359460 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.combat.entities.ship.super.G.ÖO0000(Unknown Source)
at com.fs.starfarer.combat.entities.ship.super.G.createBeam(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.class.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.String.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.String.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.ship.trackers.class.super(Unknown Source)
at com.fs.starfarer.combat.entities.ship.super.G.advance(Unknown Source)
at com.fs.starfarer.combat.systems.G.advanceLinked(Unknown Source)
at com.fs.starfarer.combat.systems.G.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.fire(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.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.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


The weapon in question:
Code
{
"specClass":"beam",
"id":"vns_reflex_cannon",
"type":"ENERGY",
"size":"LARGE",
"displayArcRadius":2000,

"turretUnderSprite":"",
"turretSprite":"graphics/weapons/animated/vns_reflexcannon/vns_reflex_Cannon_00.png",
"turretGlowSprite":"",
"hardpointSprite":"graphics/weapons/animated/vns_reflexcannon/vns_reflex_Cannon_00.png",
"hardpointGlowSprite":"",

"numFrames":12,
"frameRate":10,
"interruptibleBurst":true,
"turretOffsets":[12, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[12, 0],
"hardpointAngleOffsets":[0],

"fringeColor":[250,250,0,100],
"coreColor":[5,0,10,155],
"glowColor":[220,180,0,0],
"width":100.0,
#"textureType":ROUGH,
"textureType":["graphics/fx/vns_beam_core_1.png","graphics/fx/plasmabeam.png"],
"textureScrollSpeed":-100.0,
"pixelsPerTexel":5.0,

"animationType":"GLOW",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
"pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER],
"fireSoundOne":"Macross_beam_warmup",
"fireSoundTwo":"Macross_beam_cycle",
"fireSoundThree":"Macross_beam_powerdown",
}


It has 12 numbered sprites for the fire squence. What gives?


EDIT:
Fixed it.
IT was teh sound. Turn out the sounds have a different name in the sounds.json file.
« Last Edit: May 14, 2021, 11:39:38 AM by ElPresidente »
Logged

Üstad

  • Commander
  • ***
  • Posts: 131
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7391 on: May 14, 2021, 11:47:32 AM »

Is it possible to make a weapon or certain hullmod only avaible to player?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7392 on: May 14, 2021, 11:52:42 AM »

Has DELIVER_CREW (and a bunch of other assignments I tried, including ORBIT_PASSIVE, FOLLOW and INTERCEPT) stopped working as a way to tell a fleet to go to player fleet in another star system?

Looks like it has, yeah - the AI no longer "knows" what location the player is in unless it's seen them jump. It freezing up when the player is in-system is a bug, though; fixed up that aspect of it.

If this is intended, what's the new assignment to order a fleet to go to player in a different system (preferably without stopping to engage random enemies along the way)?

I don't think any assignment would help; the only thing that comes to mind is creating a location token and making that stick to the player fleet via a script.


- Can the Janus jump destination window be repurposed for another feature?

I believe so - IIRC it's a pretty configurable way to let the player pick some kind of entity. It's even possible to have multiple entities per star system; they're shown in a dropdown).

See: GateCMD.selectDestination() for the vanilla implementation of the plugin it takes.

- Is there a way to mark a ship as unable to be refitted or sold/scuttled/stored?

There's Tags.SHIP_CAN_NOT_SCUTTLE (which should be added to the variant, iirc), but I don't believe there's anything for preventing sold/stored.

EDIT 2: Bug report. If you add a button to the TooltipMakerAPI created by a beginImageWithText call, the button doesn't respond to mouse input.

Did you call .setForceProcessInput(true) on that TooltipMakerAPI?



Getting this error when I try to fire a weapon:

Hard to say what the issue is. I'd suggest narrowing it down by editing the weapon file until it goes away to identify exactly what causes the problem.

(From the stack trace, it looks like it crashes trying to create the beam, but that could probably be caused by different things...)


Is it possible to make a weapon or certain hullmod only avaible to player?

Just not making it available to factions should do the job. isAlwaysUnlocked() hullmods will be known to all factions, though - but unless their variants use it, they're not just going to randomly start using it.
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7393 on: May 14, 2021, 03:23:15 PM »

So if officer_manager is commented out in the events.json

Does that mean officer_manager can no longer be touched or is there an alternative way? A pity if so.  :-\

Special_Eddies

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7394 on: May 14, 2021, 06:38:34 PM »

Tried adding a ship to the game and came out with this error, wanted to see if anyone had any pointers as to what i've done wrong

at com.fs.util.Object.Object(Unknown Source)
   at com.fs.util.Object.Ô00000(Unknown Source)
   at com.fs.graphics.TextureLoader.String(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.H.o00000(Unknown Source)
   at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)




Logged
Pages: 1 ... 491 492 [493] 494 495 ... 710