Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 648 649 [650] 651 652 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24113
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9735 on: March 27, 2023, 06:22:37 PM »

Ah, double-checking this, I believe only the parent station body gets the STATION_WEAPONS_LAYER hint added to it. So its weapons should render above all of the modules.
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9736 on: March 27, 2023, 11:52:50 PM »

Ah, double-checking this, I believe only the parent station body gets the STATION_WEAPONS_LAYER hint added to it. So its weapons should render above all of the modules.
not hint, per se
also, what actually applies that property?
just having any station module type slots? something assigned to those slots?
at what point does a ship stop being just a ship and becomes a station
removing the SHIP_WITH_MODULES hint changed nothing
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9737 on: March 28, 2023, 08:33:49 AM »

2.5 simple questions -

is there a way to prevent venting from deactivating a system? I've got one that I want the ship to be able to vent during but nothing's stuck out at me
(also is there a way to tell a ship's AI to be more aggressive? that system summons a copy of the ship that uses it & I'd like for it to care less about meaningless things like "self-preservation" & "ammo conservation" :p)

and 2, is there a way to have an "under" sprite on a gun rotate with the weapon? I've got a gun with the RENDER_BARREL_BELOW renderHint & I want the barrel to have something render under it while it recoils, though the "under" image just stays in place

edit : one extra thing that I just noticed - is it possible for a weapon to have a recoiling barrel & glow at the same time?
edit 2 : cross-referenced with another mod and it seems like RENDER_BARREL_BELOW is what's messing with this, is that intentional?

edit 3 : false alarm, it was just the animation type!

 image for context, left is what I want (manually lined up), right is what currently happens

[close]
« Last Edit: March 28, 2023, 09:19:51 AM by Ruddygreat »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24113
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9738 on: March 28, 2023, 10:09:57 AM »

just having any station module type slots? something assigned to those slots?

For that specific property, just having a module in a module slot, yes. Or, more precisely: when such a module is spawned in combat.


is there a way to prevent venting from deactivating a system? I've got one that I want the ship to be able to vent during but nothing's stuck out at me

and 2, is there a way to have an "under" sprite on a gun rotate with the weapon? I've got a gun with the RENDER_BARREL_BELOW renderHint & I want the barrel to have something render under it while it recoils, though the "under" image just stays in place

No and no, at least as far as I'm aware.


(also is there a way to tell a ship's AI to be more aggressive? that system summons a copy of the ship that uses it & I'd like for it to care less about meaningless things like "self-preservation" & "ammo conservation" :p)

You can override ModPlugin.pickShipAI() and set up a ShipAIConfig with the flags you want. See CoreLifecyclePluginImpl for an example of how Automated ships are made more aggressive. You could also do this without overriding pickShipAI() - I think you could use Global.getSettings().createDefaultShipAI(ship, config) and then ship.setShipAI().
Logged

vicegrip

  • Commander
  • ***
  • Posts: 193
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9739 on: March 28, 2023, 06:58:15 PM »

Is there a way to set a weapon in a slot so that it cannot be removed, aside from the default way of assigning the weapon type in the .ship file? By using
Code
variant.getWeaponSpec(slot).setMountType(WeaponType.BUILT_IN);
I've managed to get a hullmod to set particular weapons to be built in, and they even show a white circle in the fitting window, but the altered weapons can still be removed from the ship.

Also is there a way to temporarily disable the Undo button in ship fitting? I imagine it keeps a snapshot of the player's ship and inventory state. Would it be possible to erase this state or just disable the button for a time?
« Last Edit: March 29, 2023, 02:04:51 AM by vicegrip »
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9740 on: March 29, 2023, 02:11:47 AM »

is it possible, in any way at all, to spawn a customVisualDialog, or some part thereof, or just a customPanel with buttons in it
from inside the refit screen
without closing the refit screen
or in some other way make an interactive popup with several buttons in it, that pops up in response to some action in the refit screen
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

MrTwister

  • Lieutenant
  • **
  • Posts: 62
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9741 on: March 29, 2023, 04:40:24 AM »

Hey all! I'm playing around with modding again and have a question:

Is it possible to add story point enhancements to certain normal start planet industries during new game sector generation?

For example, this is the code from vanilla Magec system New Maxios, which is adding Corrupted Nanoforge to the Orbital Works industry.
(from Magec.json file)

Is it possible to add a green (story point) enhancement to the orbital works in a similar fashion somehow?
Thanks for your kind tips!

"....

{
   "starSystem":"magec",
   "markets":[
      {
         "entities":["new_maxios"],
         "faction":"independent",
         "size":5,
         "startingConditions":[
            #"hydroponics_complex",
            "population_5",
            "ore_moderate",
         ],
         "industries":[
            "population",
            "spaceport",
            "mining",
            #"lightindustry",
            "orbitalstation",
            "grounddefenses",
            "commerce",
            ["orbitalworks", "corrupted_nanoforge"],
         ],
      },


...."
Logged

alaricdragon

  • Commander
  • ***
  • Posts: 162
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9742 on: March 29, 2023, 12:05:25 PM »

hello once more everyone. i have question again:
1) is there a way to tell if a NPC is important somehow? like if they are story relevant, or a player contact / future contact?
2) is there a way to get the bonus XP fraction you would get from perm installing a hullmod?
3) is there a way to get the amount of bonus XP the player gets from spending a story point when it gives back 100% bonus XP?
thank you all for all the kind help in the past. it helps me make thing i think are cool =)
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9743 on: March 30, 2023, 10:47:57 AM »

for that first one you can do Global.getSector().getImportantPeople().containsPerson(person); on a personAPI, it might not be 100% accurate (iirc it won't grab contacts?), but it should be good enough. besides, there's probably a check somewhere else for if a person is a contact, try searching "contact" in baseHubMission; that's where they get generated from.

Great Wound

  • Captain
  • ****
  • Posts: 278
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9744 on: March 30, 2023, 01:34:22 PM »

Is there a way to offset a weapons range for the AI?

Case example:
I currently have a mining blaster blaster that fires bolts that explode within 20% of max range. The explosion is triggered by "behaviorSpec":{"behavior":"PROXIMITY_FUSE", in the .proj file.
If I set the weapons range to 600 the projectile explodes somewhere between 480-600
However, I would like the AI to treat the weapons range as 500 to prevent wasting flux on an early detonation.

I have found a workaround:
By setting the shot range to a negative, in this case "shotRangeVariance":-0.2, the weapon detonates at up to 20% range after max range
Reduce the weapons range to 500, the AI respects this as the weapons range
Bolts now detonate at 500-600 range

While this is an ideal workaround for the current weapon there are a couple of issues.
1 - It's not intended behavior
2 - It's abusable, if I set the range to -4.0 the player can fire the weapon at up to 2500 but the AI treats it as 500.
3 - There's no damage drop off with range, this is ideal for my use... don't 'fix' it!


So if I have a workaround why am I asking? Because I have a giant shotgun!



Ideally I would like to set the range somewhere in the middle of the scatter, the current method only works for the near or far end.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9745 on: March 30, 2023, 07:34:47 PM »

@Great Wound:

To the best of my knowledge, no, you can't do that. You'd have to write a custom AutofireAIPlugin class that implements the desired behaviors, including getting an appropriate target and obeying AI Flags, and write a ModPlugin that forces your weapon to use this. If you're looking for an implementation to draw inspiration from, feel free to look at StandardAutoFireAI in the MT AI that is in Rebal's files. It does some things you don't need and you'll need to implement your own target-sorter, etc. (i.e., don't just drop this into your project and expect it to compile, heh), but it's better than starting from scratch.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9746 on: March 30, 2023, 07:55:46 PM »

Or you could write a script that detonates the projectiles in the desired range. Lot easier than writing an AI script.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24113
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9747 on: April 01, 2023, 12:14:59 PM »

Is there a way to set a weapon in a slot so that it cannot be removed, aside from the default way of assigning the weapon type in the .ship file? By using
Code
variant.getWeaponSpec(slot).setMountType(WeaponType.BUILT_IN);
I've managed to get a hullmod to set particular weapons to be built in, and they even show a white circle in the fitting window, but the altered weapons can still be removed from the ship.

Also is there a way to temporarily disable the Undo button in ship fitting? I imagine it keeps a snapshot of the player's ship and inventory state. Would it be possible to erase this state or just disable the button for a time?

Ah, sorry - I don't think so, on either count.

is it possible, in any way at all, to spawn a customVisualDialog, or some part thereof, or just a customPanel with buttons in it
from inside the refit screen
without closing the refit screen
or in some other way make an interactive popup with several buttons in it, that pops up in response to some action in the refit screen

Hmm, nothing comes to mind, I don't *think* that's doable.

Is it possible to add a green (story point) enhancement to the orbital works in a similar fashion somehow?
Thanks for your kind tips!

You'd need to do it with code, probably in ModPlugin.onEconomyLoad().

market.getIndustry(Industries.ORBITAL_WORKS).setImproved(true) or something similar!


hello once more everyone. i have question again:
1) is there a way to tell if a NPC is important somehow? like if they are story relevant, or a player contact / future contact?
2) is there a way to get the bonus XP fraction you would get from perm installing a hullmod?
3) is there a way to get the amount of bonus XP the player gets from spending a story point when it gives back 100% bonus XP?
thank you all for all the kind help in the past. it helps me make thing i think are cool =)

ContactIntel.playerHasContact() for contacts.

For being story-relevant,  don't believe so.

For hullmod bonus XP: Misc.getBuildInBonusXP()

3) is a little tricky because there's both immediate bonus XP that the player gets right away, which is enough to gain the next story point, and "deferred" bonus XP which will be given when the player reaches maximum level. In MutableCharacterStatsAPI, there's:
long getBonusXPForSpendingStoryPointBeforeSpendingIt();
Which returns the immediately-gained bonus XP.

But it's missing:
long getTotalBonusAndDeferredXPForStoryPoint();
Which I've just added.


So if I have a workaround why am I asking? Because I have a giant shotgun!

Very cool! I was going to suggest something similar as far as the approach :)

Nothing comes to mind as far as making it use the middle of the range as the effective range, though, hmm.

Or you could write a script that detonates the projectiles in the desired range. Lot easier than writing an AI script.

(Right!)
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 150
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9748 on: April 02, 2023, 05:47:10 AM »

I made a missile with the tag PD_ONLY but it still fires at ships when the enemy ship launches missiles (and also fires at the missiles like I want it to). Is there something else I need to set up so that they only target other missiles?
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9749 on: April 02, 2023, 12:42:00 PM »

what type of entity are in-combat asteroids?
I've seen combatAsteroidAPI, though that seems entirely unrelated to everything; it's just got a sprite getter method & doesn't extend CEAPI or anything.

edit much later : also, what's the radius that multiple damage numbers get merged together at? doing something that involves a lot of small projs spread over an area & I'd like for them to all show up as one number 
« Last Edit: April 03, 2023, 03:48:17 PM by Ruddygreat »
Logged
Pages: 1 ... 648 649 [650] 651 652 ... 710