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 ... 227 228 [229] 230 231 ... 706

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

Protonus

  • Captain
  • ****
  • Posts: 444
  • AAAAAAAAAAAA
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3420 on: June 25, 2017, 07:16:55 AM »

I want to ask if it is possible to code in a Hullmod script that provides bonuses (such as damage) to Faction-specific weapons.

Secondly, are there methods to give weapon scripts additional damage to certain ship sizes?
Logged

The cookies are a weird one, okay.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3421 on: June 25, 2017, 08:38:24 AM »

How do I make the procgen component of a handmade star system use names based on the star instead of the custom names (e.g. "Shaanxi IV" instead of "Tartiflette")? The withSpecialNames arg in this method seems to do nothing:
public static float addOrbitingEntities(StarSystemAPI system, SectorEntityToken parentStar, StarAge age,
                                 int min, int max, float startingRadius,
                                 int nameOffset, boolean withSpecialNames)


Ah, that's actually a bug, then, that the parameter doesn't do anything.

Could you try using NameAssigner.assignStructuralNames()? I think that should work.


@TrashMan: from the stack trace, I'm pretty sure this is due to the warden_Defense variant being referenced from a .faction file. I don't know if you've done it already, but you'll want to "replace" (in mod_info.json) factions.csv.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3422 on: June 25, 2017, 11:15:38 AM »

Quote
I want to ask if it is possible to code in a Hullmod script that provides bonuses (such as damage) to Faction-specific weapons.
That can be done, but it'd be a bit involved; essentially, you'd need an EveryFrameCombatPlugin that, for each shot / Beam / Missile that did damage, checked to see if the WeaponAPI's ShipAPI had a given HullMod installed, and then do some additional damage through additional scripting. 

Note that damage can be gotten to this way, but not range or other major variables; to influence range, you'd have to do some very counter-intuitive things. 

Quote
Secondly, are there methods to give weapon scripts additional damage to certain ship sizes?
Individual weapons, no; again, you're stuck with using the approach outlined above.  If you just want all the weapons of a certain class (say, Kinetic) on a ship to do additional damage based on size class, sure thing, but if you want to tweak individual weapon damages, no.

I really think we should just have access to WeaponAPI base stats to avoid these issues; the global-buff system is less than perfect, because these situations come up a lot and it doesn't cover most edge cases.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3423 on: June 28, 2017, 07:27:47 PM »

Does anyone have any idea what this error could be referring too? I'm at my whits end because my mod does NOTHING to touch the combat engine.

Code
18969 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at com.fs.starfarer.loading.scripts.ScriptStore.?0000(Unknown Source)
at com.fs.starfarer.settings.StarfarerSettings.o00000(Unknown Source)
at com.fs.starfarer.launcher.ModManager.getEnabledModPlugins(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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The mod is incredibly simple, containing 2 entries in rules.csv and a single script in a jar.

It must be the script because the mod works without it present, but it a) doesn't really do anything because I've commented out the active parts and b) is never called.

Script:
Spoiler
Code: java
package data.campaign.rulecmd;

import com.fs.starfarer.api.campaign.InteractionDialogAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.econ.MarketAPI;
import com.fs.starfarer.api.campaign.rules.MemoryAPI;
import com.fs.starfarer.api.impl.campaign.rulecmd.BaseCommandPlugin;
import com.fs.starfarer.api.util.Misc;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Thomas Goldstein
 */
public class TestChangeAlliegence extends BaseCommandPlugin {
    @Override
    public boolean execute(String ruleId,
            InteractionDialogAPI dialog,
            List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) {
    if (dialog == null) return false;
    SectorEntityToken target = (SectorEntityToken) dialog.getInteractionTarget();

    //MarketAPI market = target.getMarket();
    //if (market==null) return false;
    //market.setFactionId("hegemony");
    return true;
    }

}
[close]

I'm compiling the Jar using the most recent version of Netbeans, with the source format set to JDK7.
Logged

TJJ

  • Admiral
  • *****
  • Posts: 1905
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3424 on: June 29, 2017, 04:02:06 AM »

Show your changes to rules.csv.

Though I'd hazard a guess you've misspelt the class name; TestChangeAlliegence
Logged

cjuicy

  • Captain
  • ****
  • Posts: 353
  • Figuring out how the hell to wear heels (She/it)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3425 on: June 30, 2017, 06:36:16 PM »

Is it possible to limit fighter bays to a faction's specific LPC's?
And also, can you make built-in weapons lootable?
Logged
It's been a long time, but I still love ya!

- Pfp done by Sleepyfish!

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3426 on: July 01, 2017, 05:21:03 PM »

Show your changes to rules.csv.

Though I'd hazard a guess you've misspelt the class name; TestChangeAlliegence

Thanks for the reply - the wrong spelling was the same in both places, so it wasn't that. :P

I've fixed the problem by recreating my Netbeans project of the mod with all the exact same files, no changes.  I suspect that what happened is that I deleted some superfluous files from the project using Windows' File Explorer rather than Netbeans' interface. When I looked into the jar it was building, those deleted files were still included. I'm not sure how that could cause the weird error message, but the issue is resolved.
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 #3427 on: July 01, 2017, 05:26:25 PM »

In game terms, what are a MarketAPI market's .getconnectedEntities? Their class is SectorEntityToken, which doesn't tell me much.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3428 on: July 01, 2017, 07:30:30 PM »

In game terms, what are a MarketAPI market's .getconnectedEntities?
It should be all entities that contain the market, e.g. Jangala and its station are both connected to the shared Jangala market.
Logged

Jay2Jay

  • Lieutenant
  • **
  • Posts: 60
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3429 on: July 02, 2017, 01:54:15 PM »

Was wondering what stats are tied to ship sizes (destroyer, frigate, cruiser, capital) and if it would be non trivial to add more 'sizes'.
Logged
"The greatest pleasure is to vanquish your enemies and chase them before you, to rob them of their wealth and see those dear to them bathed in tears, to ride their horses and clasp to your bosom their wives and daughters." ~Ghengis Khan

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3430 on: July 04, 2017, 09:52:42 AM »

Right now right clicking on hullmods makes them disappear and we learn them - can we get access to right click behavior for other inventory items? Does anyone know how to run an arbitrary script when right clicking on an item?

I was thinking maybe just using custom hullmods - the hullmods do nothing, but an every frame script then checks to see if the player knows them, runs another script, and removes the hullmod from the player knowledge. The script wouldn't happen directly when the item is right clicked though, which is a pity.

I'm guess I'm asking, has anyone figured this out?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3431 on: July 04, 2017, 10:09:52 AM »

(Let me add a todo item for making a general-purpose way of doing this...)
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 #3432 on: July 04, 2017, 10:16:24 AM »

(Let me add a todo item for making a general-purpose way of doing this...)

Thanks Alex :P
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3433 on: July 12, 2017, 12:39:58 PM »

So... is there any current way to iterate through all of the JSONs in a given directory, both Vanilla and mods? 

Basically, I want to iterate through all of the .PROJ files, .WPN files and .SHIP files, in part because of some .WPN and .SHIP filenames not matching their internal string IDs, but mainly to do some work before the game loads, rather than gather data during operation.

I'm kind of stumped.
« Last Edit: July 12, 2017, 01:04:42 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

TrashMan

  • Admiral
  • *****
  • Posts: 1325
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #3434 on: July 15, 2017, 06:13:38 AM »

So I tried to make a slow-fire, high-energy cost, long-range EMP AoE tactical weapon.

But no mater what it doesn't work. I ended up buffing it's stats more and more in hope of seeing some improvement.

The inital idea was slow fire (30sec to 1min cooldown), around 2000+ energy per shot, 500m explosion radios that does 1000 EMP damage.
Yet it's crap, even after upping the EMP damage to 5000 and cooldown to 10 sec.

Hits on hull or shield to nothing, only proximiy detonations seem to have some effect, but aside from knocking out fighters/missiles if they are close, it does nothing.

WEAPON DATA:
Ion-Nova Cannon,vns-lrg-shockwave,3,,4000,1200,,300,5000,0,9,16,,,,ENERGY,1000,,3,10,1,0,1,5,0,0,,1200,,,,STRIKE,"LR, energy9",200011

WEAPON ITSELF:
Code

{
"id":"vns-lrg-shockwave",  # this id must match what's in the spreadsheet
"specClass":"projectile",
"type":"ENERGY",
"size":"LARGE",
"displayArcRadius":1200,
"turretSprite":"graphics/weapons/animated/vns_shockwave/vns_shockwave_cannon00.png",
"hardpointSprite":"graphics/weapons/animated/vns_shockwave/vns_shockwave_cannon00.png",
"numFrames":9,
"frameRate":20,
"interruptibleBurst":false,

"glowColor":[255,75,0,200],
"turretOffsets":[31, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[31, 0],
"hardpointAngleOffsets":[0],
"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"GLOW_AND_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE

"muzzleFlashSpec":{"length":80.0,   # only used if animationType = MUZZLE_FLASH
   "spread":6.0,
   "particleSizeMin":15.0,
   "particleSizeRange":15.0,
   "particleDuration":0.25,
   "particleCount":35,
   "particleColor":[255,75,0,200]},

"projectileSpecId":"vns_bullet_shockwave",  # projectile that will be fired
"fireSoundTwo":"gun_heavy_3",
"autocharge":true,
}


PROJECILE:
Code
{
"id":"vns_bullet_shockwave",
"specClass":"projectile",
"spawnType":"BALLISTIC",
"collisionClass":"PROJECTILE_FF",
"collisionClassByFighter":"PROJECTILE_FIGHTER",

"length":80.0,
"width":15,
"fadeTime":0.20,

"hitGlowRadius":100,

"fringeColor":[10,10,220,255],
"coreColor":[255,255,0,255],

"glowColor":[10,10,255,255],
"glowRadius":45,

"behaviorSpec":
{
"behavior":"PROXIMITY_FUSE",
  "range":50,
"explosionSpec":
{
"duration":0.1f, # not visual
"radius":500,
"coreRadius":500, # full damage within core radius
"collisionClass":PROJECTILE_FF,
"collisionClassByFighter":PROJECTILE_FIGHTER,
"particleSizeMin":1.0,
"particleSizeRange":5.0,
"particleDuration":1,
"particleCount":300,
"particleColor":[0,0,255,255],
"sound":"408en"},
}
}

"textureScrollSpeed":64.0,
"pixelsPerTexel":5.0,

"bulletSprite":"graphics/missiles/shell_hellbore.png"
}
Logged
Pages: 1 ... 227 228 [229] 230 231 ... 706