Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 445 446 [447] 448 449 ... 709

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

Histidine

  • Admiral
  • *****
  • Posts: 4681
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6690 on: July 22, 2020, 06:20:10 PM »

Hmm - vanilla uses this method and it seems to work. I just tried:

loader.setBackgroundSpriteName("graphics/ships/onslaught/onslaught_base.png");

in BattleCreationPluginImpl and it did it.
Seems that Onslaught background works, something like illustrations/bombardment_saturation.jpg works, but I can't get e.g. backgrounds/hyperspace_bg_cool.jpg to work (even if I travel to hyperspace before entering the battle).
Is this because of how the game handles system backgrounds?
Logged

Rohzdear

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6691 on: July 22, 2020, 07:59:20 PM »

Reposting my question from a new thread into this one as it was suggested.

Quote
Hi there.

I am a novice in Starsector modding, and although I haven't released anything in the Forum yet I've done some small mods for personal use. I was planning on releasing a Portrait Pack with new portraits, but I was looking for a way to remove portraits added by the vanilla faction files into vanilla factions (without editing the original ones) so that, for example, Hegemony Factions characters do not appear with non-Hegemony portraits, like portrait13.png,  portrait15.png, etc.
I was unsure if there was a way to do this, as with the Portrait mod that I made all that I do is add new portraits into a custom Hegemony.FACTION file.

Thanks for the help in advance.  :D
 If this thread doesn't belong here I ask that it's moved where it'd be appropriate.

I was advised that this could be done by means of replacing the original .FACTION file with the following line in the mod_info.json file:
Code
 "replace":["data\\world\\factions\\hegemony.faction"]
Or that I could try to somehow do it through a script, but I have no idea on how to go through with that. If anyone could help me with this It'd be greatly appreciated.

Thanks in advance.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6692 on: July 23, 2020, 06:02:42 AM »

Ah, yes, if it's a phase cloak, that'll be a problem. But if it's another type of right-click system, it would be fine.

A phase cloak isn't going to work with a ship with modules; among other things it's not going to phase the modules. But, yeah, it'll also be unable to unphase; let me change that on my end. If the modules were set to "fighter" it'd be able to unphase, btw, but that could be undesirable for other reasons...
Fine ok, but I have another problem. If I wrote ai script for this right-click system, it seems that the f system won't be controlled by AI.

Spoiler
Code: json
{
"id":"FOB_starfavor",
"type":"STAT_MOD",
"aiType":"PHASE_CLOAK",
"statsScript":"data.shipsystems.scripts.FOB_StarFavorStats",
"aiScript":"data.shipsystems.scripts.ai.FOB_CustomAI"
"runScriptWhilePaused":true, # only for the player's ship
"runScriptWhileIdle":true,  # this means unapply() never gets called
"blockActionsWhileChargingDown":false,

"clampTurnRateAfter":true,
"clampMaxSpeedAfter":true,

"useSound":"FOB_phase_start",
#"deactivateSound":"system_phase_cloak_deactivate",
#"deactivateSound":"system_phase_cloak_deactivate",
#"outOfUsesSound":"system_phase_cloak_collision",
}
[close]
Logged
My mods


SwissArmyKnife

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6693 on: July 23, 2020, 06:19:00 AM »

Trying to create a big old beam cannon but I'm getting an NullPointerException whenever I try to fire it.

.wpn file:
Spoiler
Code
{
    "specClass":"beam",
    "id":"diableavionics_eldos",
    "type":"ENERGY",
    "size":"LARGE",
    "displayArcRadius":1200,
    "turretSprite":"graphics/da/weapons/diableavionics_eldos_turret_base.png",
    "turretGlowSprite":"graphics/da/weapons/diableavionics_eldos_turret_glow.png",
    "hardpointSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_base.png",
    "hardpointGlowSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_glow.png",
    "turretOffsets":[30, 0],
    "turretAngleOffsets":[0],
    "hardpointOffsets":[65, 0],
    "hardpointAngleOffsets":[0],   
    "fringeColor":[41,15,155,255],
    "coreColor":[238,255,239,255],
    "darkCore":false,
    "width":40.0,
    "textureType":LASER,
    "textureScrollSpeed":292.0,
    "pixelsPerTexel":5.0,
    "pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],
    "glowColor":[225,60,0,255],
        "animationType":"GLOW",
    "fireSoundOne":"da_eldos_start",
    "fireSoundTwo":"da_eldos_loop",
}
[close]

weapon_data.csv entry:
Spoiler
Code
Eldos Energy Furnace,diableavionics_eldos,3,0.01,32500,1400,950,,,75,4,40,,,,ENERGY,,950,1,2,,,,,,,6000,,,,,,"beam12, energy11, diable_adv_bp, rare_bp",,Diable Avionics,,Siege Artillery,,,,,,,,,,
[close]

And the NPE I get every time:
Spoiler
Code
46372 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
    at com.fs.starfarer.combat.entities.ship.A.void0000Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.createBeam(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.advance(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.advanceLinked(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.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$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
[close]

Checked all the usual suspects, names match, offsets look good, nothing was saved in the Ship & Weapon Editor. Sprites and sound files (ogg) all look fine. Kind of out of ideas, anything jump out to anyone or run into something similar?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24104
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6694 on: July 23, 2020, 11:57:44 AM »

Seems that Onslaught background works, something like illustrations/bombardment_saturation.jpg works, but I can't get e.g. backgrounds/hyperspace_bg_cool.jpg to work (even if I travel to hyperspace before entering the battle).
Is this because of how the game handles system backgrounds?

Huh. Looked into this some, and, yeah, you're right. This is weird; now I'm more surprised that the onslaught background works (and it doesn't, quite - it messes up the background once you come back to the campaign) than I am surprised that the method doesn't work with regular backgrounds. I'm not really able to dig into this right now, but from what I can see this doesn't work for some fundamental reasons and wouldn't be a super straightforward fix.

(What appears to be happening is the system background overwrites the background texture during the fade into combat. But why this doesn't happen for the Onslaught texture, at this point, I have no idea.)



I was advised that this could be done by means of replacing the original .FACTION file with the following line in the mod_info.json file:
Code
 "replace":["data\\world\\factions\\hegemony.faction"]
Or that I could try to somehow do it through a script, but I have no idea on how to go through with that. If anyone could help me with this It'd be greatly appreciated.

Thanks in advance.

Right, that would work, but would also make your mod incompatible with other mods that change the hegemony.faction file.

The code solution would be - in your ModPlugin.onNewGame(), probably - to use FactionAPI.getPortraits(Gender gender) and modify the WeightedRandomPicker it returns.

(See javadoc here.)

In the next release, you'll be able to clear out th default Hegemony portraits by simply including "core_clearArray" as the first element in the portrait array of your .faction file, without needing to "replace" the entire faction file.


Fine ok, but I have another problem. If I wrote ai script for this right-click system, it seems that the f system won't be controlled by AI.

Code: json
{
"aiType":"PHASE_CLOAK",
"aiScript":"data.shipsystems.scripts.ai.FOB_CustomAI"

You need "CUSTOM" for the AI type, otherwise aiScript doesn't get used at all.

Trying to create a big old beam cannon but I'm getting an NullPointerException whenever I try to fire it.

...

Checked all the usual suspects, names match, offsets look good, nothing was saved in the Ship & Weapon Editor. Sprites and sound files (ogg) all look fine. Kind of out of ideas, anything jump out to anyone or run into something similar?

Hmm - nothing jumps out immediately as being wrong. I'd suggest copy-pasting a vanilla weapon's .wpn file / csv row / etc one at a time, so you can narrow down where the problem is, and then progressively change things until you know exactly what breaks it.
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 #6695 on: July 23, 2020, 12:12:24 PM »

Trying to create a big old beam cannon but I'm getting an NullPointerException whenever I try to fire it.

.wpn file:
Spoiler
Code
{
    "specClass":"beam",
    "id":"diableavionics_eldos",
    "type":"ENERGY",
    "size":"LARGE",
    "displayArcRadius":1200,
    "turretSprite":"graphics/da/weapons/diableavionics_eldos_turret_base.png",
    "turretGlowSprite":"graphics/da/weapons/diableavionics_eldos_turret_glow.png",
    "hardpointSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_base.png",
    "hardpointGlowSprite":"graphics/da/weapons/diableavionics_eldos_hardpoint_glow.png",
    "turretOffsets":[30, 0],
    "turretAngleOffsets":[0],
    "hardpointOffsets":[65, 0],
    "hardpointAngleOffsets":[0],   
    "fringeColor":[41,15,155,255],
    "coreColor":[238,255,239,255],
    "darkCore":false,
    "width":40.0,
    "textureType":LASER,
    "textureScrollSpeed":292.0,
    "pixelsPerTexel":5.0,
    "pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],
    "glowColor":[225,60,0,255],
        "animationType":"GLOW",
    "fireSoundOne":"da_eldos_start",
    "fireSoundTwo":"da_eldos_loop",
}
[close]

weapon_data.csv entry:
Spoiler
Code
Eldos Energy Furnace,diableavionics_eldos,3,0.01,32500,1400,950,,,75,4,40,,,,ENERGY,,950,1,2,,,,,,,6000,,,,,,"beam12, energy11, diable_adv_bp, rare_bp",,Diable Avionics,,Siege Artillery,,,,,,,,,,
[close]

And the NPE I get every time:
Spoiler
Code
46372 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
    at com.fs.starfarer.combat.entities.ship.A.void0000Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.createBeam(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.O0OO.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.trackers.class.o00000(Unknown Source)
    at com.fs.starfarer.combat.entities.ship.A.void.advance(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.advanceLinked(Unknown Source)
    at com.fs.starfarer.combat.systems.oOoO.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$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
[close]

Checked all the usual suspects, names match, offsets look good, nothing was saved in the Ship & Weapon Editor. Sprites and sound files (ogg) all look fine. Kind of out of ideas, anything jump out to anyone or run into something similar?

Are the sounds registered in sounds.JSON? (Essentially a link to your sounds directory ogg files with some volume/pitch settings.)

The other thing is either put animationType above glowColor or remove it altogether and see if that solves the problem. That's the only thing that stands out to me.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24104
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6696 on: July 23, 2020, 12:19:09 PM »

The order of entries in the .wpn file shouldn't matter, btw. Thank you for chiming in, though; good point about the sounds.
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 #6697 on: July 23, 2020, 03:07:17 PM »

The order of entries in the .wpn file shouldn't matter, btw. Thank you for chiming in, though; good point about the sounds.

Ah yeah that makes sense I'm sure it is just called by key. Sometimes I kind of forget those files are just JSON files and so should work like any other JSONObject. lol  8)
Logged

SwissArmyKnife

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6698 on: July 23, 2020, 05:06:39 PM »

Hmm - nothing jumps out immediately as being wrong. I'd suggest copy-pasting a vanilla weapon's .wpn file / csv row / etc one at a time, so you can narrow down where the problem is, and then progressively change things until you know exactly what breaks it.

Figured it out, I was calling da_eldos_start for the sound file in .wpn when it should have been the diableavionics_eldos_start I'd set in sounds.json. Naming conventions get me every time!
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6699 on: July 23, 2020, 08:32:58 PM »

You need "CUSTOM" for the AI type, otherwise aiScript doesn't get used at all.

Oh I uploaded the wrong code.
Yes I filled in "CUSTOM", and the right-click system work as I wish. But F system doesn't work any more.(I mean it won't be triggered by AI)
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24104
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6700 on: July 24, 2020, 10:08:10 AM »

Ah. I... don't actually know, then, I don't have much - any, really - experience with right-click systems other than the phase cloak.

Maybe someone that does have experience could chime in?
Logged

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6701 on: July 24, 2020, 08:36:30 PM »

Ori, are you specifying aiHints for your right-click ship systems? I uh... Vaguely recall from work on Exigency long ago. That putting those on right-click systems causes various anomalous issues but I cannot for the life of me recall what they were, sorry.

I hope you *are* doing that, then is an easy fix and so that also it doesn't mean my old mod is turbo-*** as it will be coming back when time!

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6702 on: July 24, 2020, 09:31:58 PM »

Ah. I... don't actually know, then, I don't have much - any, really - experience with right-click systems other than the phase cloak.

Maybe someone that does have experience could chime in?
....fine okay I will try to find the answer by myself
Logged
My mods


Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6703 on: July 24, 2020, 11:50:25 PM »

Ah. I... don't actually know, then, I don't have much - any, really - experience with right-click systems other than the phase cloak.

Maybe someone that does have experience could chime in?
....fine okay I will try to find the answer by myself
And I give my f system an auto-use ai script, but its init() function even won't be called if I have a right-click system with ai script.
Both type is 'STAT_MOD'.
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24104
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6704 on: July 25, 2020, 09:14:30 AM »

Hmm, that doesn't make much sense - the code looks like those would be independent from each other, but it's possible I'm missing something. If you're able to create a minimal mod to demonstrate this (i.e. with no dependencies etc), I can take a look!
Logged
Pages: 1 ... 445 446 [447] 448 449 ... 709