Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 288 289 [290] 291 292 ... 709

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4335 on: February 15, 2019, 08:42:26 PM »

Ah, hmm - for the future, added to AutofireAIPlugin: MissileAPI getTargetMissile()
Logged

Asauski

  • Ensign
  • *
  • Posts: 29
  • I'm fluent in google translate
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4336 on: February 15, 2019, 08:52:23 PM »

Yes; if the weapon is not under player control, get the AI instance, then call getTargetShip(); if that returns null, then the target is a CombatEntityAPI, and (unfortunately) you'll have to determine that by using getTarget() and then finding the CombatEntityAPI closest to that point (which is quite expensive).

Perfect! After a quick test I saw that I just needed getTarget () because what was needed was to know where the gun was pointing. Thank you :D

Ah, hmm - for the future, added to AutofireAIPlugin: MissileAPI getTargetMissile()


That would also help a lot.
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4337 on: February 18, 2019, 04:37:14 AM »

---snip---
The sound id is ui_shutdown_industry, not colony_industry_shutdown. When I change it to ui_shutdown_industry in a test mod, it works fine.
Alrrright, understood the gimmicks,  ui_shutdown_industry is working fine, but \sfx_interface\ui_char_increase_skill_new.ogg is not in core's sounds.json, And therefore it fails. Thus said, why it is not declared? Is it not being used at all in 0.9a?

Also,
Code
"ui_char_increase_skill_new":[
{"file":"../../starsector-core/sounds/ui/ui_char_increase_skill_new.ogg","pitch":1,"volume":1}
]
does not work. Am I root-bound to only mod's own directory?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4681
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4338 on: February 18, 2019, 05:14:09 AM »

The game looks at the merged contents of core and mod folders. It'd be just
Code: json
"ui_char_increase_skill_new":[
{"file":"sounds/ui/ui_char_increase_skill_new.ogg","pitch":1,"volume":1}
]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4339 on: February 18, 2019, 09:31:46 AM »

.. but \sfx_interface\ui_char_increase_skill_new.ogg is not in core's sounds.json, And therefore it fails. Thus said, why it is not declared? Is it not being used at all in 0.9a?

Correct. Anything that's being used, by definition, is going to be in sounds.json.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4340 on: February 19, 2019, 02:36:51 PM »

Hey, no idea if this is a bug or intended, so i post that here:


Change the faction of a fleet maded with a another faction:
fleet.setFaction(GS_Constants.GSFACTION_ID, true);

Remove every weapons, wing, for just put empty layout on ships. The fleet spawn just near to the player, so i found that pretty weird.

No idea how fix that, because if i put every weapons/fighter on my special faction, i will found some mod faction fleet with others faction mods weapons.

Anything for disable the weird autovariant-after fleet bug? (for these specials fleets)

Thank you!
« Last Edit: February 19, 2019, 02:46:01 PM 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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4341 on: February 19, 2019, 02:52:39 PM »

I'm not 100% sure I understand, but - try also setting the inflater params factionId to the new faction?

Something like:
DefaultFleetInflater inflater = (DefaultFleetInflater)fleet.getInflater()
((DefaultFleetInflaterParams)inflater.getParams()).factionId = <your faction id>

(Untested.)

Depending on how the fleet is created - if there's a factionId set in its FleetParamsV3 - the inflater params will also have the factionId set - which will determine which faction the fleet picks weapons from.

Or, perhaps - depending on what the problem/desired behavior is - maybe you need to set factionId in your FleetParamsV3 to the faction you want to be used when picking weapons etc, regardless of the fleet's current faction. I *think* that should work.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4342 on: February 19, 2019, 03:03:18 PM »

I'm not 100% sure I understand, but - try also setting the inflater params factionId to the new faction?

Something like:
DefaultFleetInflater inflater = (DefaultFleetInflater)fleet.getInflater()
((DefaultFleetInflaterParams)inflater.getParams()).factionId = <your faction id>

(Untested.)

Depending on how the fleet is created - if there's a factionId set in its FleetParamsV3 - the inflater params will also have the factionId set - which will determine which faction the fleet picks weapons from.

Or, perhaps - depending on what the problem/desired behavior is - maybe you need to set factionId in your FleetParamsV3 to the faction you want to be used when picking weapons etc, regardless of the fleet's current faction. I *think* that should work.

Code
[...]
        fleet = FleetFactoryV3.createFleet(new FleetParamsV3(
                null,
                relay.getLocationInHyperspace(),
                faction.getId(), // Always a real faction with weapon, etc
                null,
                FleetTypes.PERSON_BOUNTY_FLEET,
                content.getEndlessPower() + random, // combatPts
                0, // freighterPts
                0, // tankerPts
                0f, // transportPts
                0f, // linerPts
                0f, // utilityPts
                1f // qualityMod
        ));
        if (fleet == null) {
            endEvent();
            return;
        }

        fleet.setCommander(person);
        fleet.getFlagship().setCaptain(person);
        FleetFactoryV3.addCommanderSkills(person, fleet, null);

        Misc.makeImportant(fleet, GS_Constants.GSFACTION_ID, 120);
        fleet.getMemoryWithoutUpdate().set(MemFlags.MEMORY_KEY_PIRATE, true);
        fleet.setNoFactionInName(true);
        
        fleet.setFaction(GS_Constants.GSFACTION_ID, true); [...]

Here, sorry, i create the fleet with TryTachion, per exemple, he made every ships with only of this pool.

Then, when i change the faction to another faction who do not have weapon, ship or anything else, i got empty ships. If i remove the last line, i do not have any problem, just the wrong faction.
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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4343 on: February 19, 2019, 03:31:40 PM »

Ah, looking into it, this is a bug that's fixed for 0.9.1a - the way you're doing it *should* work, but the 0.9a implementation of DefaultFleetInflater doesn't handle it. This is the same issue that causes "deserter" pirate fleets to only get pirate weapons instead of getting weapons from their original faction.
Logged

Iridescens

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4344 on: February 20, 2019, 04:42:09 AM »

Assuming I have some ships with not-so-transient buffs and one or more of ships gets disabled in combat AND there is option to recover them, how do I check if the ship is lost forever (if chosen not to be recovered) and needs to be stripped of buffs to prevent a memory leak?
There seems to be some radical under-the-hood change in 0.9a that makes this (btw, worked in 0.8.1):
Code: java
if ( lastMember.getFleetData() == null &&
lastMember.getFleetData().getFleet() == null ||
lastMember.getFleetData().getFleet().isAIMode() ||
                    !lastMember.getFleetData().getFleet().isAlive())
to cause getFleetData() to produce NPE (why, oh WHY can't it be just null?) since your own to-be-recovered ship does not have associated fleetData (I have checked that in debugger). Is that "no fleetData on player's to-be-recovered ships" intentional?
The issue does not manifest on NPC fleets' ships, only when recovering player's ships.
« Last Edit: February 20, 2019, 07:32:59 AM by Iridescens »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4345 on: February 20, 2019, 08:14:16 AM »

To be honest, I'm not 100% sure I understand what you're asking, but there appears to be a bug in your code:

lastMember.getFleetData() == null && 
                  lastMember.getFleetData().getFleet() == null

I don't think you want && here, since it'll NPE on lastMember.getFleetData().getFleet() whenever getFleetData() returns null. You probably want ||.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3802
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4346 on: February 20, 2019, 10:00:52 PM »

Is there any way to get at the ship objects that are used to generate images for the fleet view?

Specifically, I'm working on building a thing that will mirror weapons; it's pretty straightforward to do this with an EveryFrameWeaponPlugin (with a boolean runOnce check), and that works fine for in combat or in the outfitting screen - but the weapons show up un-mirrored in the scrolling list of ships to the left of the outfitting screen or in the fleet view, where, as far as I can tell, EveryFrameWeaponEffectPlugin.advance() is never called.
Logged
Wyvern is 100% correct about the math.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4347 on: February 20, 2019, 10:10:01 PM »

It's not, no - those are a bit special in that they're (mostly) not associated with a combat engine instance and exposing those... well, at a glance it seems like it'd get pretty complicated. They *are* based off the variant, though, so changing that would be the way to go if that's an option.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3802
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4348 on: February 20, 2019, 10:30:29 PM »

Well that's unfortunate; I don't see anything in ShipVariantAPI that would let me do what I need to for mirroring weapon sprites.

The closest I can come up with at the moment would be to have two versions of a weapon, one with the sprite pre-mirrored, and swap them out, but that seems like it'd run into all sorts of other issues when you'd have, say, effectively-identical hellbore and hellbore_m weapons that could end up in your cargo holds, for example.  Plus it wouldn't play well with, say, any other mod deciding to do some custom fleet generation, or adding variants that don't have the mirrored versions already correctly set...

If it helps any, I don't -actually- need the ship objects at all; that was just a convenient reference point for finding the things I do need: which are the WeaponSlotAPI and SpriteAPI objects for each of the weapons I'm looking at (potentially) mirroring.  (WeaponSlotAPI has the relative ship coordinates that let me ask "is this gun on the left side of the ship?", and SpriteAPI is what I need to actually do a horizontal flip of the graphics.)
Logged
Wyvern is 100% correct about the math.

Kittah Khan

  • Ensign
  • *
  • Posts: 41
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4349 on: February 21, 2019, 12:19:20 AM »

Is there a way to get access to a weapon or projectile's glow/etc colors?
That way, the emp on hit script could just read the weapon/projectile to set the arc color instead of a hardcoded value.

EDIT Right, weapon getSpec does the job for weapon glow color. No way to get anything beyond the projectile spec id, though?
« Last Edit: February 21, 2019, 06:21:40 AM by Kittah Khan »
Logged
Pages: 1 ... 288 289 [290] 291 292 ... 709