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 ... 608 609 [610] 611 612 ... 706

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

JAL28

  • Commander
  • ***
  • Posts: 217
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9135 on: September 14, 2022, 07:13:28 PM »

Is it possible for a shipsystem to instantly kill a ship after its activation uptime runs out? Bonus if it can make it unrecoverable

I know there are stuff like the Titan or IEDs that can explode but those don’t seem to be timer based or otherwise don’t seem to work for some odd reason
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9136 on: September 15, 2022, 08:30:42 AM »

Is it possible for a shipsystem to instantly kill a ship after its activation uptime runs out? Bonus if it can make it unrecoverable

I know there are stuff like the Titan or IEDs that can explode but those don’t seem to be timer based or otherwise don’t seem to work for some odd reason

For non-recovery, you could add Tags.VARIANT_UNBOARDABLE to the variant.

For destroying the ship, you'd need to have a script (probably the system script, since that'd already be handy) apply a bunch of damage to it.
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9137 on: September 16, 2022, 09:51:30 AM »

I want to render something on the minimap-radar in the bottom-right corner of the screen in a mod.

When using the "create a custom campaign entity and use its render-method"-approach, whatever I render (using the rendering layer ABOVE) gets blocked by the radar, presumably because it's also rendered in the layer ABOVE with 100% alpha and the UI is last in the rendering order.

When I simply render everything in the advance-method of an EveryFrameScript, it works, but I have been told that that's not necessarily the safest thing to do.

Is there some (clean-ish) way to circumvent this problem, like e.g. place my custom campaign entity last in the render order?

If not, if it's easy to implement, would it be possible to add another rendering layer above ABOVE (like e.g. ABOVE_ABOVE or ABOVE_ALL) that's unused by the base game?

And possibly even offer some variant of EveryFrameScript with a render-method so that, in order to render something in the campaign-layer, one doesn't have to create a custom campaign entity?

Thanks in advance for answers! =)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9138 on: September 16, 2022, 10:12:34 AM »

Hmm - if you want to render something on the radar, your best bet might be the CampaignTerrainPlugin.renderOnRadar() method.
Logged

Liral

  • Admiral
  • *****
  • Posts: 717
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9139 on: September 17, 2022, 08:14:58 AM »

My mod generally gives weapons more range, but ships still close to vanilla distances from enemy stations, sometimes even ramming them despite orders to avoid the station or defend a distant point.  How can I, or at least players using my mod, make the ships stay a safe distance from stations?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9140 on: September 17, 2022, 09:32:52 AM »

Hmm, I'm not actually sure. Offhand, no way to do this comes to mind. You could try something like station.setStation(false) but that'll have other repercussions such as it probably not staying in one place, being able to receive orders/retreat, etc. So actually that'd probably be a very bad idea, scratch that. You *might* be able to do something via ship.getAIFlags() but I'm not sure; there's a good chance some of these get overridden/ignored if the target is a station.
Logged

Liral

  • Admiral
  • *****
  • Posts: 717
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9141 on: September 17, 2022, 10:07:03 AM »

Hmm, I'm not actually sure. Offhand, no way to do this comes to mind. You could try something like station.setStation(false) but that'll have other repercussions such as it probably not staying in one place, being able to receive orders/retreat, etc. So actually that'd probably be a very bad idea, scratch that.

Well, if there's no other solution...

Edit: I tested this option, but the ships still closed to vanilla ranges.

Quote
You *might* be able to do something via ship.getAIFlags() but I'm not sure; there's a good chance some of these get overridden/ignored if the target is a station.

I thought of this too, and aw man, really? :'(  I wish there were some way to do it.
« Last Edit: September 17, 2022, 11:23:56 AM by Liral »
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9142 on: September 17, 2022, 11:54:49 AM »

for some reason, my custom entity icon shows up on the map prior to being discovered even though it is discoverable.
Any pointers on what I *** up?

Code
	"IndEvo_Watchtower":{
"defaultName":"Watchtower", # used if name=null in addCustomEntity()
"defaultRadius":35, # used if radius<0 in addCustomEntity(),
"nameInText":"watchtower",
"shortName":"watchtower",
"aOrAn":"a",
"isOrAre":"is",
"customDescriptionId":"IndEvo_Watchtower",
"interactionImage":"graphics/illustrations/orbital_construction.jpg",
"icon":"graphics/icons/IndEvo_station1.png",
"iconWidth":10,
"iconHeight":10,
"sprite":"graphics/stations/IndEvo_station_03.png",
"spriteWidth":30,
"spriteHeight":30,
"renderShadow":false, #true,
"useLightColor":true,
"showInCampaign":true,
"showIconOnMap":true,
"showNameOnMap":false,
"scaleNameWithZoom":false,
"scaleIconWithZoom":true,
"tags":["objective", "story_critical", "IndEvo_watchtower"],
"layers":[STATIONS], # what layer(s) to render in. See CampaignEngineLayers.java for possible values
"pluginClass":"com.fs.starfarer.api.***.station.IndEvo_WatchtowerEntityPlugin"
},

Code
SectorEntityToken t = system.addCustomEntity(Misc.genUID(), faction.getDisplayName() + " Watchtower", "IndEvo_Watchtower", faction.getId(),null);
                    t.setOrbit(loc.orbit);
                    t.setDiscoverable(true);
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9143 on: September 17, 2022, 12:00:48 PM »

I thought of this too, and aw man, really? :'(  I wish there were some way to do it.

In all honesty, the ship AI isn't all *that* configurable, so this isn't super surprising. I'll see if I can do something at some point, but no promises.

for some reason, my custom entity icon shows up on the map prior to being discovered even though it is discoverable.
Any pointers on what I *** up?

Could you try Misc.makeDiscoverable()? That takes a couple of extra parameters (discovery XP and sensor profile) and I think in particularly not setting the latter might be the problem here.
Logged

Liral

  • Admiral
  • *****
  • Posts: 717
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9144 on: September 17, 2022, 12:23:24 PM »

In all honesty, the ship AI isn't all *that* configurable, so this isn't super surprising. I'll see if I can do something at some point, but no promises.

 :) :) :)

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9145 on: September 17, 2022, 01:02:52 PM »

for some reason, my custom entity icon shows up on the map prior to being discovered even though it is discoverable.
Any pointers on what I *** up?

Could you try Misc.makeDiscoverable()? That takes a couple of extra parameters (discovery XP and sensor profile) and I think in particularly not setting the latter might be the problem here.
Hey, thank you - it was in BaseThemeGenerator, but that indeed fixed it <3
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9146 on: September 17, 2022, 01:05:23 PM »

Ah, my bad - glad you were able to track it down anyway :)
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9147 on: September 18, 2022, 06:50:14 AM »

Is there any clean way to run a script on a fleet after it interacts with an entity, but before it actually performs an action?

I want to spawn a fleet that attacks any hostile fleet thats about to interact with a planet that has satellites in orbit. The idea here is that the fleet will interrupt whatever action that fleet would have taken, such as raiding the planet. If the defender is destroyed, the attacked fleet can continue as normal.

"Clean" in this context means anything that isn't an everyframe script. Something performant and not janky.

I know reportFleetReachedEntity exists, but I don't think making a fleet enter combat in the listener would really prevent something like a raid. Then again, I haven't actually tried it. If this would work, please tell me.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9148 on: September 18, 2022, 03:31:59 PM »

Depending on what sort of entity it is, there are two options that come to mind. One is just providing a different rule with a higher score that fires off in this case and takes over the interaction. See: rule with id "marketOpen" for the default market interaction. After your rule fires and is finished, you could set a variable to make sure your rule can't fire again (i.e. have a "!$didThing" its conditions) and then run:

$didThing = true
FireBest OpenInteractionDialog

To get back into the normal interaction flow.


If the entity does not by default use rule interactions (i.e. it's a fleet, most likely - or a jump-point, or a planet without a market) then you could provide an implementation of CampaignPlugin.pickInteractionDialogPlugin() which would take over the interaction instead of the default dialog. This could actually also be done if the entity uses rules for its interactions by default, though in that case using rules would be cleaner/simpler since they're pretty much meant for this sort of thing.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9149 on: September 18, 2022, 05:58:01 PM »

I think Niko means one NPC fleet interrupting another. I don't think there is any way to do that.
Logged
Pages: 1 ... 608 609 [610] 611 612 ... 706