Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Cycerin on December 12, 2012, 02:50:13 AM

Title: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 12, 2012, 02:50:13 AM
I often have small questions that I don't feel deserve a thread of their own, and I don't think I'm alone. A thread like this could be useful and make sure the forum doesn't get clogged up.

To start us off:
Would it be possible to make a Guardian PD-style beam weapon where each offset beam fires in turn, like alternating barrels on a projectile weapon?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on December 12, 2012, 08:03:13 AM
On the *.weapon file:

Code
"barrelMode":"ALTERNATING", # or LINKED. whether barrels fire at the same time or alternate.

On the CSV file:
adding a tiny "burst delay" to make it fire once every X.X seconds
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 12, 2012, 09:35:54 AM
I tried that, but it doesn't look like barrelMode does anything in this case. Maybe it only works on projectile-type weapons?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 09:55:42 AM
Yeah, beams ignore the "barrelMode" setting. To answer the original question: not possible.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 10:06:12 AM
Yeah, beams ignore the "barrelMode" setting. To answer the original question: not possible.
Is there any possibility to make a way to allow the creation of minigun lasers? Pretty much an assault chain gun but with lasers?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Reshy on December 12, 2012, 10:12:19 AM
Yeah, beams ignore the "barrelMode" setting. To answer the original question: not possible.
Is there any possibility to make a way to allow the creation of minigun lasers? Pretty much an assault chain gun but with lasers?


Like a burst PD chain gun?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on December 12, 2012, 11:30:49 AM
Well i made a "blaster" cannon out of it on Star Treker, theres quite a few on alot a mods out there, you just create a really cool white (and long) projectile then add some color glow effects and "fake" a laser blast
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 12:39:00 PM
Yeah, beams ignore the "barrelMode" setting. To answer the original question: not possible.
Is there any possibility to make a way to allow the creation of minigun lasers? Pretty much an assault chain gun but with lasers?


Like a burst PD chain gun?

yes! :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 02:43:31 PM
Yeah, beams ignore the "barrelMode" setting. To answer the original question: not possible.
Is there any possibility to make a way to allow the creation of minigun lasers? Pretty much an assault chain gun but with lasers?


Like a burst PD chain gun?

yes! :D

Can't right now - only projectile weapons can be animated. But, oh, why not - actually a pretty simple change, just added it. A beam gatling gun is just too cool a concept to pass up.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: arcibalde on December 12, 2012, 02:46:12 PM
LOOOOOL  ;D ;D ;D     Alex you ARE kid (inside  :P)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on December 12, 2012, 02:47:44 PM
Wait, we can have a beam gatling gun?  Like shooting beams from different spots each time it fires?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 02:49:14 PM
No. But it can now have an animated barrel, a la the Assault Chaingun or the Thumper.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on December 12, 2012, 02:50:35 PM
Damn.

Still has it's usefulness, though, I suppose.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 02:53:20 PM
Alex.
Spoiler
I love you
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 02:54:29 PM
Can it also rapid fire too? Like a burst delay of 0.05 and a small spread?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 03:09:49 PM
Can it also rapid fire too? Like a burst delay of 0.05 and a small spread?

Rapid fire, sure. No spread for beam weapons, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 03:22:22 PM
Can it also rapid fire too? Like a burst delay of 0.05 and a small spread?

Rapid fire, sure. No spread for beam weapons, though.
Aww darn, had plans for a hull stripper, rapid fire, wide spread ballistic energy weapon that works like a lightning arc gun that wipes out armor
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 03:32:33 PM
Ah. Probably better off with a pulse laser type, then. If you make the projectiles really long, it almost looks like beams. Has an interesting look to it, anyway.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 03:40:38 PM
Ah. Probably better off with a pulse laser type, then. If you make the projectiles really long, it almost looks like beams. Has an interesting look to it, anyway.
Shall have to try, and the possibility of beams applying force to objects it hits? Like a massive bomb knocking back ships?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 03:44:15 PM
No - not something the engine supports.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 03:45:11 PM
No - not something the engine supports.
Ah bugger, and my old beam shape suggestion a while back that you liked?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 03:48:01 PM
Link?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 03:49:08 PM
Link?
Shall take a look and edit this post

Edit:
http://fractalsoftworks.com/forum/index.php?topic=3396.0
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 03:57:48 PM
Oh. I'm fairly certain whatever I told you boiled down to "interesting, but no" :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 04:00:06 PM
Oh. I'm fairly certain whatever I told you boiled down to "interesting, but no" :)
Ah, okie dokie
And sorry for the bump, it was to make sure I didn lose the page as I'm on my phone and the battery is almost dead
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 04:01:02 PM
Oh, ok, fair enough.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 12, 2012, 04:02:09 PM
Oh, ok, fair enough.
Regardless, my apologies, and is there to be a new upcoming features list? Or what do you plan on doing for the next release? :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 12, 2012, 04:03:45 PM
As usual, no - the first you'll see of it will be in the new patch notes. I will say that there's an 0.54.1a in the works, though.

Let's try to keep this on topic - it's a good idea for a thread.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on December 12, 2012, 06:13:14 PM
I've already deduced that there's no decent way to make a single beam weapon fire multiple beams from multiple barrels alternating, but what about a single barreled beam weapon firing a beams that could start before the first one finished? A stacking sort of effect,
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on December 12, 2012, 09:35:29 PM
Maybe through power-up vs. cooldown rates?  Or just do a burst?

I agree that multi-barrel behaviors that can do ALTERNATE would be very cool, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on December 13, 2012, 02:22:49 AM
Is it possible to use skillpoints to influence campaign things like factions relationship? Is it possible to not spend skill points or get them refunded?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on December 13, 2012, 07:17:47 AM
Might be possible by creating a new skill called Diplomatic and an algoritm that when you affect a factions rep, it goes tro that algoritm, for example, you reputation with [faction] was increased by return (100 * 1.1) -> (bonus 10%).

Again it might be possible by creating a script on the systems script, same way we got those faction rep resets, you should be able to reset the skill points when you "buy" a certain item on a station for example.

Note: I havent messed around with the skill system enough to be 100% sure, but im fairly optimistic...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on December 13, 2012, 08:05:30 AM
Anyone interested trying to figure that out with me you can have my Skype (PM me).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Plasmatic on December 15, 2012, 09:42:29 AM
Spoiler
Not sure if this would warrent it's own thread, but I don't feel like it would..

So, I'm trying to create my own shipsystem, a new drone one..

I got the drones working and all that, but they are not using the weapons I set in the variant file..

they get a machinegun whenever I go into game.. and i cannot figure out why.

I have triple checked that the variant file is in the right place, /data/variants/drones

I have double checked all the names and they are identical, no caps no spaces, its just one word.

the WS numbers are identical in both .ship and variant file..

in data/hulls I've added:
Ship_data with only my drone in it.
.ship file for my drones

in data/variants/drones I've added:
.variant file

in data/shipsystems I've added
ship_systems file with my drone system
.system file for my drones

As mentioned, the drones appear and work in game, it's just their weapons that are not what I set them to.

does the game not recognize them as drones and I need to place the variant file in the data/variant folder?
[close]

EDIT: ok, so found where the variant used was defined, which did it :)

Title: NEW QUESTION
Post by: maximilianyuen on December 16, 2012, 12:09:07 AM
Got a quick question:

Think of a kamikaze cargo ship which use the destruction blast as a weapon, obviously.

What factor determine the radius as well as the destruction power of such ship?

simply making it a capital class does not do the job ???
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Plasmatic on December 16, 2012, 03:37:08 AM
I got another very intresting question..

what would cause this?

(WARNING, MASSIVE WALL OF TEXT)
Spoiler
at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.mergeSort(Arrays.java:1281)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.mergeSort(Arrays.java:1281)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at com.fs.starfarer.campaign.fleet.FleetData.for.return$Object(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
[close]
Just to give you an idea, in the log file that continues for 1017 lines!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 16, 2012, 05:30:58 PM
What factor determine the radius as well as the destruction power of such ship?

simply making it a capital class does not do the job ???

Flux capacity for the explosion's damage and collisionRadius for its radius.


@Plasmatic: Eugh. That's what you call "infinite recursion", not sure what's actually causing it in this case, though. Looking at the code, doesn't seem possible.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MCWarhammer on December 16, 2012, 06:05:18 PM
Basic Java question, but what would be the opposite of ".equals()" in this instance?

Code
if (station.getName().toString().equals("Corporate HQ")){
                                    restockShips(aMothFleet,tShips);
                                    restockFighters(aMothFleet,tWings);

What I'm trying to do is replace it with the Neutral Serenity station so that the Restock mod doesn't feed into it, because it's only purpose is to reset allegiances.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Plasmatic on December 17, 2012, 02:32:09 AM
What factor determine the radius as well as the destruction power of such ship?

simply making it a capital class does not do the job ???

Flux capacity for the explosion's damage and collisionRadius for its radius.


@Plasmatic: Eugh. That's what you call "infinite recursion", not sure what's actually causing it in this case, though. Looking at the code, doesn't seem possible.

If it helps I have a couple mods installed and I cannot seem to replicated the error. (was in battle and all enemies were destroyed but battle did not end, hit esc and said to autocomplete, and boom, crash)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on December 17, 2012, 06:13:21 AM
What factor determine the radius as well as the destruction power of such ship?

simply making it a capital class does not do the job ???

Flux capacity for the explosion's damage and collisionRadius for its radius.


@Plasmatic: Eugh. That's what you call "infinite recursion", not sure what's actually causing it in this case, though. Looking at the code, doesn't seem possible.

When you have ruled out all other possibilities, what's left, no matter how inconceivable, must be the answer
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on December 17, 2012, 06:43:07 AM
I got another very intresting question..

what would cause this?

(WARNING, MASSIVE WALL OF TEXT)
Spoiler
at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.mergeSort(Arrays.java:1281)
   at java.util.Arrays.mergeSort(Arrays.java:1282)
   at java.util.Arrays.mergeSort(Arrays.java:1281)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at com.fs.starfarer.campaign.fleet.FleetData.for.return$Object(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.Ò0Ö000(Unknown Source)
[close]
Just to give you an idea, in the log file that continues for 1017 lines!

We wont know until you post the actual error that caused it all. should be named [Thread 6] Error or something, you will find it above the "at" lines near the bottom.
Title: Concerning asteroidbelts
Post by: Thule on December 17, 2012, 08:16:48 AM
I am sure someone already figured out the variables for asteroidbelts

1. anchorpoint
2. ???
3. orbital radius of the belt
4. the width of the belt
5. ???
6. ???

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on December 17, 2012, 08:40:26 AM
1. Anchor point.
2. How many asteroids the belt contains.
3. Orbital distance between the belt and the object it orbits.
4. Belt width.
5. Minimal asteroid orbit speed.
6. Maximum asteroid orbit speed.

 ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on December 17, 2012, 08:46:42 AM
thank you very much
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MCWarhammer on December 17, 2012, 04:25:00 PM
I'm having problems with my U'sC version of the restock mod. Every time I try to start up Starfarer it crashes because of a compile error, and pops this in the logs:

12/17/12 4:19:54.076 PM [0x0-0xc8cc8c].com.Fractal Softworks LLC.Starfarer.Starfarer: Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/corvus/RestockSpawnPoint.java, Line 388, Column 13: Unexpected token "private" in primary

The code is here: https://github.com/JSCleveland/Restock-Mod-for-Uomoz-Corvus/blob/d5b807ac47113546d07812d33d2dd9e8dcfe2eb3/data/scripts/world/corvus/RestockSpawnPoint.java (https://github.com/JSCleveland/Restock-Mod-for-Uomoz-Corvus/blob/d5b807ac47113546d07812d33d2dd9e8dcfe2eb3/data/scripts/world/corvus/RestockSpawnPoint.java)

EDIT:

Problem solved.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on December 19, 2012, 08:54:46 AM
What factor determine the radius as well as the destruction power of such ship?

simply making it a capital class does not do the job ???

Flux capacity for the explosion's damage and collisionRadius for its radius.


@Plasmatic: Eugh. That's what you call "infinite recursion", not sure what's actually causing it in this case, though. Looking at the code, doesn't seem possible.

Thanks Admiral :!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 26, 2012, 10:52:11 AM
Okay, I have this multi-offset beam weapon that can't hit missiles. Specifically, it seems to aim just to the side of them by a few pixels. Either way, it does roughly 400 fragmentation damage in one burst, which as far as I know, is enough to one-shot any missile, and even so, it often wastes several shots on one missile without doing anything to it. Doesn't matter what kind of missile. Sometimes it seems to be able to destroy them, usually when there is little transversal velocity involved. It hits fighters just fine.

Code
	"id":"brburst",  # this id must match what's in the spreadsheet
"specClass":"beam",
"type":"ENERGY",
"size":"MEDIUM",
"displayArcRadius":600,
"turretSprite":"graphics/weapons/arguspd_turret_base.png",
"turretGlowSprite":"graphics/weapons/arguspd_turretglow.png",
"hardpointSprite":"graphics/weapons/burstpd_hardpoint_base.png",
"hardpointGlowSprite":"graphics/weapons/burstpd_hardpoint_glow.png",
"glowColor":[190,205,52,255],
"hardpointOffsets":[12, -9, 12, 9, 12, 0],
"turretOffsets":[8, -9, 8, 9, 8, 0],
"hardpointAngleOffsets":[0, 0, 0],
"turretAngleOffsets":[0, 0, 0],
"convergeOnPoint":true,
"fringeColor":[231,251,91,175],
"coreColor":[86,96,46,255],
"darkCore":false,
"width":6.0,
"textureType":SMOOTH,
#"textureType":["graphics/fx/emp_arcs.png","graphics/fx/emp_arcs.png"],
"textureScrollSpeed":292.0,
"pixelsPerTexel":5.0,
"fireSoundOne":"beam_light_burst_1",
"fireSoundTwo":"beam_light_loop",

I'm not sure if it's a rounding error or something, but it's pretty much identical to the Guardian PD except it only has three beam offsets in total.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on December 26, 2012, 10:55:38 AM
I'd look into beam speed and possibly turret turn rate - the comment on low transverse velocity makes it sound like it's firing at where the missile was and thus missing.  (Obviously, if it has the same values here as the Guardian, then there's something else off.  But "pretty much identical" implies some possibility of variance, so I figured this was worth mentioning.)

Edit: You'll find these values in the weapons spreadsheet, rather than the file you edited it above.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 26, 2012, 11:06:52 AM
I know. The beam speed is 100000 (i've tried several different speeds with no real change) and the chargeup has been shifted around too to try to troubleshoot. From 0 to 0.1 and so on. I'm pretty sure it's just the fact that it has three offsets that screws everything up. I thought I fixed it when I changed the offsets from odd to even numbers, but it was just a fluke.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on December 26, 2012, 11:13:07 AM
Huh.  Well, next thing to try: save a copy, and then edit the guardian to have those specific offsets, see how it behaves.  If it starts missing, then it's definitely the offsets.  If not, then there's something else going on.  I'd try it myself, but I'm not at a machine where I can run the game.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 26, 2012, 11:18:20 AM
There's a bug with the Guardian where it won't re-target quickly enough, wasting shots on an already-dead missile (i.e., firing at the spot where it used to be.)

But, this thing is medum (the Guardian bug was related to it being large)... so it really ought to behave the same way the Heavy Burst laser does. Having extra offsets shouldn't matter, as long as one of them is centered. A quick way to verify would be to convert it to single-beam and try it that way to see if that makes a difference.

The turn rate of the weapon is something else I'd look at.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 26, 2012, 11:57:23 AM
It doesn't matter what turn speed I use, that was one of the first things I tried to change. I verified that the problem is specifically due to the fact that it has off-centered offsets. If I set all the offsets to 0, the beam aims at the center of incoming missiles and destroys them. With three offsets, two to each side and one in the center, it does the weird "i am not aiming right at the missile" thing.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on December 26, 2012, 12:05:05 PM
Oh hey.  Here's a random thought: does it matter what order the offsets are in?  If you put the one with zero first, for example, does that change the behavior any?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on December 26, 2012, 12:06:26 PM
Good call. Was just about to post this - the Guardian-style ("convergeOnPoint") beams use the first offset as the centerline to aim along.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on December 26, 2012, 12:07:59 PM
Yeah, good call! That was the problem. Thanks alot, you two. ;D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: CopperCoyote on December 26, 2012, 12:59:30 PM
Is there a mod that decreases the frequency of the various supply convoys? Right now Corvus is so busy that the ships and weapons pile up faster than my green crews and I can lose them. I'd like it to feel more like a scavenger world(solarsystem?) than it currently does.

Alternatively is that something i can just edit by hand in the save file?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on December 27, 2012, 12:52:50 AM
Is there a mod that decreases the frequency of the various supply convoys? Right now Corvus is so busy that the ships and weapons pile up faster than my green crews and I can lose them. I'd like it to feel more like a scavenger world(solarsystem?) than it currently does.

Alternatively is that something i can just edit by hand in the save file?

Open up that save's campaign.xml and search for HegemonyConvoySpawnPoint. Change <daysInterval> to whatever you like for that and the following two spawn points (PiratePlunderFleetSpawnPoint and TriTachyonSupplyFleetSpawnPoint).

If you want this to be permanent, you would need to make a simple mod that replaces data/scripts/world/corvus/Corvus.java (just make a mod folder with a mod_info.json* and a copy of Corvus.java in the correct folder). At the end of the generate() method in Corvus.java, there are three lines that create the convoy spawn points. The third argument (after sector and system) is the interval in days between spawns, so that's what you would need to change.

If you use the second method, you'd need to start a new game to see the changes (or just use the first method to get the changes in your current game).

* Example mod_info.json:
Spoiler
Quote
{
  "id":"lessconvoys",
  "name":"Less Frequent Convoy Spawns",
  "author":"CopperCoyote",
  "version":"1.0",
  "description":"Lowers the amount of convoys spawned in the sector.",
  "gameVersion":"0.54",
}
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on December 27, 2012, 09:57:38 AM
Good call. Was just about to post this - the Guardian-style ("convergeOnPoint") beams use the first offset as the centerline to aim along.

Out of curiosity, is there any advantage to doing this?  Would it make more sense to have converge on point treat the offset as always zero?  As it is, you're limiting converging beams to odd numbers of beams; you couldn't make one (that looked right / had pinpoint accuracy for PD work) that fired just two beams.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: CopperCoyote on December 28, 2012, 11:38:43 AM
Thanks LazyWizard. I think i'll start with editing a new game's save first, and work from there.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on December 29, 2012, 10:13:39 AM
what is the "render missile hint" in the wpn file?
of course it's responsible to show the tip of the missile visually to know that the missile is loaded, but what decided how much/which part/what graphic is used for such visual hint?

and i have something else wanted to do with it...just made a little capital artillery with missile hatch which happen to have light indicator in my imagination.

is it possible to make the render missile hint to be a green light graphic, to replace the default red light in the ship sprite?

sprite
Spoiler
(https://lh3.googleusercontent.com/-Y3neXUwF-wk/UN8FTfUEI9I/AAAAAAAAVc0/SNWX0M_j2X0/s440/13acFinalReal.png)
[close]

if it's not clear, here's the big one. i hope it's obvious enough which 14 red boxes are the missile hatch..
full render
Spoiler
(https://lh5.googleusercontent.com/-3qO8QpWkRDs/UN8Dy5pAZ0I/AAAAAAAAVcQ/AFsZ3Q_UO5M/s0/13acFinalFull.png)
[close]


just in case:

it's not ok to use green light as missile :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on December 29, 2012, 09:09:39 PM
another question:

"explosionSpec":{"duration":2f,

what's the unit of f?  frame?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on December 30, 2012, 06:10:31 AM
another question:

"explosionSpec":{"duration":2f,

what's the unit of f?  frame?

Duration is measured in seconds.

f just means the number's data type is a float (in short, a decimal; in long, it's complicated ;)) as opposed to an integer (which can only accept whole numbers).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on December 30, 2012, 06:42:05 AM
another question:

"explosionSpec":{"duration":2f,

what's the unit of f?  frame?

Duration is measured in seconds.

f just means the number's data type is a float (in short, a decimal; in long, it's complicated ;)) as opposed to an integer (which can only accept whole numbers).

For example Pi is 3.14....... you only want the first 2 decimals so you make it a type float becoming 3.14f
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on December 30, 2012, 06:42:43 AM
another question:

"explosionSpec":{"duration":2f,

what's the unit of f?  frame?

Duration is measured in seconds.

f just means the number's data type is a float (in short, a decimal; in long, it's complicated ;)) as opposed to an integer (which can only accept whole numbers).

thanks:)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on December 30, 2012, 06:44:49 AM
another question:

"explosionSpec":{"duration":2f,

what's the unit of f?  frame?

Duration is measured in seconds.

f just means the number's data type is a float (in short, a decimal; in long, it's complicated ;)) as opposed to an integer (which can only accept whole numbers).

For example Pi is 3.14....... you only want the first 2 decimals so you make it a type float becoming 3.14f

i guess all i can handle for now is the number is measured in second lol
the practical system is a bit hard to measure directly with visual hence the question :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on January 03, 2013, 06:17:16 AM
New problem:

auto pilot/ AI won't fire my new missile weapon.

It has unlimited ammo (over time), added a DO_NOT_AIM, USE_VS_FRIGATE tag in the csv, and a range of 1500

what makes the AI think this weapon is useless?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 03, 2013, 09:36:32 AM
New problem:

auto pilot/ AI won't fire my new missile weapon.

It has unlimited ammo (over time), added a DO_NOT_AIM, USE_VS_FRIGATE tag in the csv, and a range of 1500

what makes the AI think this weapon is useless?

I believe missiles need at least 30 ammo to autofire.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 03, 2013, 09:44:25 AM
Also: if missile ammo is <= 5, it'll wait to fire it until it's a good time to - i.e, the missile is high explosive and shields are down. It doesn't take regeneration into account for this.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 03, 2013, 12:53:14 PM
1. It seems i have forgotten the location where i specifiy what background images will be used ingame.
   
2. I specified in the faction file
Code
"shipNameSources":{
"THULE":1,
},
but the game will randomly pick a name, not just from the specified one.
    What could be the problem?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 03, 2013, 01:11:02 PM
Something I want...

(http://oi45.tinypic.com/2s7i2v4.jpg)


What I get...

(http://oi48.tinypic.com/2j4wvwx.jpg)


... but why?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TheHappyFace on January 04, 2013, 02:51:19 AM
did you use correct extension? not something like a photoshop file? something it cant read?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 04, 2013, 07:30:28 AM
did you use correct extension? not something like a photoshop file? something it cant read?


First thing I checked and its a .png  :-\  must be something I accidently did in PS,
however I dunno what can cause this.


Edit - got it, had wrong bit levels. All is good now, thank you for your time :)

Spoiler
(http://oi45.tinypic.com/2jcac0n.jpg)
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on January 05, 2013, 06:56:02 AM

I believe missiles need at least 30 ammo to autofire.

Also: if missile ammo is <= 5, it'll wait to fire it until it's a good time to - i.e, the missile is high explosive and shields are down. It doesn't take regeneration into account for this.

ah....thanks for the info ;D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maximilianyuen on January 05, 2013, 06:56:39 AM
did you use correct extension? not something like a photoshop file? something it cant read?


First thing I checked and its a .png  :-\  must be something I accidently did in PS,
however I dunno what can cause this.


Edit - got it, had wrong bit levels. All is good now, thank you for your time :)

Spoiler
(http://oi45.tinypic.com/2jcac0n.jpg)
[close]

yes, the game only eat 8 bit graphic, 16bit is a no go
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 05, 2013, 07:02:48 AM
Not only that, its now StarSector so you'll need to remake it anyway  :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 05, 2013, 03:27:17 PM
Not only that, its now StarSector so you'll need to remake it anyway  :D

You cant imagine the look on my face, when I saw the email, that "new Starsector is out"  :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Lordzias on January 06, 2013, 01:51:09 AM
How do i add my own portraits to the game? Placing them in the portraits folder doesn't work and I dont want some random pirate to have the same pretty mug as me...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 06, 2013, 01:11:08 PM
Would it be possible to do something similar to the Aegis Deflector from Battleships Forever?

(http://img102.imageshack.us/img102/6707/athenauk1.png)

The glowing blue generators at the back could be shot down and take the invulnerable white sections to the front offline.

The main interesting idea is to tie some effect to a weapon that, if taken offline, disables the effect. For instance, imagine a ship with a series of generators along the side that confer a passive energy weapon damage bonus as long as they are online.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 06, 2013, 02:06:17 PM
Right now, no, since parts dont actually change the stats of a ship being the engines an exception
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 06, 2013, 05:01:05 PM
   
2. I specified in the faction file
Code
"shipNameSources":{
"THULE":1,
},
but the game will randomly pick a name, not just from the specified one.
    What could be the problem?

has someone a hint for me?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 06, 2013, 08:25:39 PM
   
2. I specified in the faction file
Code
"shipNameSources":{
"THULE":1,
},
but the game will randomly pick a name, not just from the specified one.
    What could be the problem?

has someone a hint for me?

Can you send me a link to the mod? I should be able to take a look tomorrow.

One thing to check - if you're modifing a stock faction (which I suspect you're not), this would simply add the "THULE" name set to it - you'd have to specify for the .faction file to be replaced in mod_info.json.

Also: make sure your ship_names.json is under data/strings.

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 07, 2013, 07:56:29 AM
Actually, about that - all mothballed ships seem to pull from every ship name list in the data structure, not just the ones belonging to the faction that owns the station. Is that intended?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 07, 2013, 08:23:41 AM
Here is the updated mod.

ship_names.json in data/strings   :     check
no stockfaction = no replacing in mod_info.json? (or is it the opposite?)  :     check

Here (http://www.mediafire.com/?prwcgzmrzj68v96) is the updated version of the mod.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 08, 2013, 05:04:55 PM
Ok, finally had a chance to look. In your ship_names.json, you 1) probably don't need to have all the other name categories and 2) don't actually have a "THULE" category (it's "OLD HIGH GERMAN").

Actually, about that - all mothballed ships seem to pull from every ship name list in the data structure, not just the ones belonging to the faction that owns the station. Is that intended?

You need to call void initMothballedShips(String factionId); on the cargo of the station. Otherwise, it'll init with the "independent" faction the first time it's used.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 08, 2013, 10:53:15 PM
Thank you Alex for taking the time to have a look, unfortunatly i mixed up the json files and uploaded the outdated version, my real updated version looks like this. The naming issue is still present.

ship_names.json
Code
{
"THULE":
[
"Adalberga",
"Adalbrand",
"Adalburg",
"Adalger",
"Adalward",
"Adelar",
"Adelbrand",
"Adelfrieda",
"Adelfriede",
"Adelger",
"Adelgunde",
"Adelgundis",
"Adelrune",
"Agibert",
"Agilhard",
"Agilulf",
"Alarich",
"Albina",
"Albine",
"Albrada",
"Albruna",
"Albrune",
"Alfger",
"Alfhilde",
"Alfonsa",
"Alftrud",
"Alkmar",
"Aloisia",
"Alram",
"Alwine",
"Amalberga",
"Amalberta",
"Amalburga",
"Amalfried",
"Amalfrieda",
"Amalfriede",
"Amalgard",
"Amalgunda",
"Amalgundis",
"Amalie",
"Amalinde",
"Amalindis",
"Arngrim",
"Arnhard",
"Arnhelm",
"Arnulf",
"Arwin",
"Aschwin",
"Askold",
"Aswin",
"Baldebert",
"Baldegunde",
"Baldemar",
"Balderich",
"Baldfried",
"Baltfried",
"Balthard",
"Baltram",
"Baltrun",
"Baltwin",
"Bardulf",
"Bathilde",
"Bathildis",
"Bergunde",
"Berlinde",
"Berlindis",
"Bernalde",
"Bernfried",
"Bernfriede",
"Berngard",
"Bernger",
"Bernharde",
"Bernhelm",
"Bernhilde",
"Bernulf",
"Bernwald",
"Bernward",
"Berold",
"Bertfried",
"Bertfriede",
"Bertgunde",
"Bertholda",
"Bertholde",
"Bertlinde",
"Bertlindis",
"Bertolf",
"Bertrade",
"Bertradis",
"Bertrand",
"Bertraude",
"Bertrun",
"Bertulf",
"Bertwald",
"Bertwin",
"Billfried",
"Billhard",
"Billhilde",
"Billibald",
"Biterolf",
"Bleikard",
"Botmar",
"Botwin",
"Brandolf",
"Brandulf",
"Brunhard",
"Brünhilde",
"Burglinde",
"Burgwald",
"Burgward",
"Christhard",
"Christmar",
"Christwart",
"Dankrad",
"Dankrade",
"Deert",
"Deinhard",
"Diederike",
"Dietbald",
"Dietberga",
"Dietberta",
"Dietbold",
"Dietbrand",
"Dietburga",
"Dietegen",
"Dietgard",
"Dietgunde",
"Diethelm",
"Diether",
"Diethilde",
"Dietmund",
"Dietmut",
"Dietolf",
"Dietrade",
"Dietram",
"Dietrun",
"Dietwald",
"Dietward",
"Dietwart",
"Dietwin",
"Dietwolf",
"Eberfried",
"Ebergard",
"Eberharda",
"Eberhilde",
"Eckeward",
"Eckewart",
"Eckhard",
"Eckwin",
"Egberta",
"Egberte",
"Egilward",
"Eginolf",
"Egmond",
"Ehrengrad",
"Ehrentraud",
"Eilbert",
"Eilfried",
"Eilmar",
"Eiltraud",
"Einharde",
"Elfgard",
"Elftraud",
"Emeram",
"Emmeram",
"Engelberga",
"Engelberta",
"Engelburga",
"Engelgard",
"Engeltraud",
"Erkenbald",
"Erkenbert",
"Erkenbrecht",
"Erkenfried",
"Erkengard",
"Erkenrad",
"Erkentraud",
"Erlfried",
"Erlfriede",
"Erlgard",
"Erltraud",
"Erlwin",
"Erlwine",
"Ermenbert",
"Ermenbrecht",
"Erminolde",
"Ernesta",
"Erpo",
"Ertrud",
"Erwine",
"Etzel",
"Ewara",
"Eward",
"Ewerdina",
"Ewerdine",
"Falkmar",
"Faramund",
"Farfried",
"Farhilde",
"Farold",
"Fastmar",
"Fastmund",
"Fastrad",
"Fastrade",
"Fatrada",
"Filiberta",
"Framhild",
"Friedebald",
"Friedeberga",
"Friedebert",
"Friedeburg",
"Friedeburga",
"Friedelind",
"Friederun",
"Friedewald",
"Friedhard",
"Friedhelm",
"Friedolf",
"Friedrich",
"Frodebert",
"Frodegard",
"Frodemute",
"Frodewine",
"Frommhold",
"Garlieb",
"Gastold",
"Gebharde",
"Gerbald",
"Gerbod",
"Gerborg",
"Gerbrand",
"Gerburg",
"Gerfried",
"Gerharda",
"Gerharde",
"Gerhilde",
"Germar",
"Gertraud",
"Gerwine",
"Gilberte",
"Gildbrecht",
"Gildebert",
"Giselberga",
"Giselberta",
"Giselburga",
"Giselheid",
"Giseltraud",
"Gismara",
"Gismunda",
"Gismunde",
"Godeberta",
"Godela",
"Godwin",
"Gosbert",
"Gotlinde",
"Gotlindis",
"Gottbert",
"Gotthelm",
"Gotthilde",
"Gottmar",
"Gottwin",
"Gotwin",
"Gunborg",
"Gundobald",
"Gunntberta",
"Guntberga",
"Guntbert",
"Guntbrecht",
"Guntfried",
"Gunthard",
"Gunthelm",
"Gunthilde",
"Guntrad",
"Guntrada",
"Guntrade",
"Guntram",
"Guntrun",
"Guntwin",
"Gühnter",
"Hadamar",
"Hadburga",
"Hadelind",
"Hademund",
"Haduwig",
"Hadwine",
"Hariolf",
"Hariulf",
"Harmina",
"Harold",
"Hartbert",
"Hartfried",
"Hartlieb",
"Hartmute",
"Hartwig",
"Hatto",
"Heiderich",
"Heilburg",
"Heilmar",
"Heiltraud",
"Heilwig",
"Heimberga",
"Heimbert",
"Heimbrecht",
"Heimburga",
"Heimeram",
"Heimeran",
"Heimtraud",
"Heinhard",
"Heinrike",
"Helferich",
"Helmbald",
"Helmbold",
"Helmbrecht",
"Helmburg",
"Helmfried",
"Helmgerd",
"Helmold",
"Helmtraud",
"Herbald",
"Herberta",
"Herborg",
"Herbrand",
"Herburg",
"Hergilde",
"Herlinde",
"Herlindis",
"Herlof",
"Herluf",
"Hermandine",
"Hermanna",
"Hermanne",
"Hermengilde",
"Herrada",
"Herrade",
"Herta",
"Hertwiga",
"Herwald",
"Herward",
"Herwig",
"Herwiga",
"Hildburg",
"Hildebald",
"Hildebert",
"Hildebrand",
"Hildebrecht",
"Hildefons",
"Hildemar",
"Hildemut",
"Hildewin",
"Hildolf",
"Hiltraud",
"Horstmar",
"Huberta",
"Hugbald",
"Humbrecht",
"Humfried",
"Hunold",
"Ingegerd",
"Ingmar",
"Irmenbert",
"Irmenburg",
"Irmenfried",
"Irmengard",
"Irmenhard",
"Irmenrad",
"Isberga",
"Isenbert",
"Isenbrand",
"Isenger",
"Isenhard",
"Isentraud",
"Isgard",
"Ismar",
"Ismunde",
"Ithamar",
"Iwo",
"Janfried",
"Klothilde",
"Kolbert",
"Kriemhild",
"Kunibald",
"Kunibert",
"Kunimund",
"Lambrecht",
"Lampert",
"Lamprecht",
"Landerich",
"Landewin",
"Landfried",
"Leonharda",
"Leopola",
"Leopolde",
"Liberta",
"Liebetraud",
"Liebfried",
"Liebhard",
"Liebhilde",
"Liebrecht",
"Liebwald",
"Liebward",
"Liebwin",
"Lindgrad",
"Luitbald",
"Luitbrand",
"Luitfried",
"Luitgard",
"Luitgunde",
"Luither",
"Luithilde",
"Luithold",
"Luitolf",
"Luitwin",
"Lütmar",
"Malfriede",
"Malvine",
"Malwin",
"Manhard",
"Manhart",
"Marbert",
"Marbod",
"Marhold",
"Marigard",
"Markolf",
"Markward",
"Maxbert",
"Meinbod",
"Meinfried",
"Meinhilde",
"Meinholde",
"Meinrade",
"Meinwald",
"Meithard",
"Mildburg",
"Milltraud",
"Neidhard",
"Nidger",
"Nonfried",
"Nordrun",
"Nordwin",
"Norfried",
"Norgard",
"Norhilde",
"Notburga",
"Notger",
"Notker",
"Oldwig",
"Ortfried",
"Ortger",
"Orthilde",
"Ortlinde",
"Ortnit",
"Ortraud",
"Osberta",
"Osmunde",
"Osterlind",
"Oswalda",
"Oswalde",
"Oswina",
"Otberga",
"Otger",
"Otgunde",
"Othilde",
"Otker",
"Otlinde",
"Otmund",
"Ottar",
"Ottogebe",
"Otwald",
"Otward",
"Otwin",
"Pippin",
"Radegunde",
"Rambald",
"Rambert",
"Rambod",
"Randolf",
"Randwig",
"Ratbald",
"Ratbert",
"Ratberta",
"Ratbod",
"Ratburga",
"Ratfried",
"Ratgard",
"Ratger",
"Rathard",
"Rathilde",
"Rathold",
"Ratmar",
"Ratwald",
"Ratward",
"Regelinde",
"Reginald",
"Reginalda",
"Regiswinda",
"Reimara",
"Reimbert",
"Reimbod",
"Reimund",
"Reimute",
"Reinald",
"Reinalde",
"Reinberta",
"Reinburga",
"Reiner",
"Reinfried",
"Reinfrieda",
"Reingard",
"Reinhardine",
"Reinholde",
"Reintraud",
"Reinwald",
"Richbald",
"Richbert",
"Richhilde",
"Richlinde",
"Richmar",
"Richmut",
"Richwald",
"Rigmor",
"Ringolf",
"Rodegang",
"Rodegard",
"Rodehilde",
"Rodewald",
"Rolanda",
"Romilda",
"Rosalinde",
"Rosemarie",
"Roswin",
"Rothard",
"Rother",
"Rudibert",
"Rudmar",
"Rudolfa",
"Rumold",
"Runfried",
"Runhilde",
"Ruperta",
"Rutgard",
"Rutlieb",
"Schwabhild",
"Schöntrud",
"Sebalde",
"Siegberta",
"Siegbod",
"Siegbrand",
"Siegburga",
"Sieghelm",
"Siegher",
"Sieghilde",
"Siegolf",
"Siegram",
"Siegrich",
"Siegrun",
"Siegtraude",
"Siegwald",
"Siegward",
"Siegwin",
"Sigismunde",
"Sintbald",
"Sintbert",
"Sirk",
"Solbert",
"Sonnfried",
"Sonngard",
"Sonnhilde",
"Sonntraud",
"Stillfried",
"Svava",
"Swanburga",
"Swanhilde",
"Swidgard",
"Swindbert",
"Teutobald",
"Teutobert",
"Teutobod",
"Teutomar",
"Teutwart",
"Thorgard",
"Thorgund",
"Traudhilde",
"Traudlinde",
"Treumunde",
"Trudberta",
"Trudgard",
"Uhland",
"Ulbert",
"Ulberta",
"Ulfert",
"Usmar",
"Vilmar",
"Volbert",
"Volkbert",
"Volkberta",
"Volkbrand",
"Volkbrecht",
"Volkerdine",
"Volkhard",
"Volkhilde",
"Volkmann",
"Volko",
"Volkrad",
"Volkram",
"Volkwald",
"Volkward",
"Volkwin",
"Walbert",
"Waldeberta",
"Waldegunde",
"Waldfried",
"Walfriede",
"Walthard",
"Waltheide",
"Walthilde",
"Waltrada",
"Waltram",
"Waltraud",
"Waltrun",
"Welfhard",
"Wendelbert",
"Wendelgard",
"Wendelmar",
"Weriand",
"Wernburg",
"Werngrad",
"Wernhard",
"Wernhilde",
"Wibrande",
"Wichard",
"Wiclef",
"Wiebke",
"Wigand",
"Wigbald",
"Wigbert",
"Wigberta",
"Wigburga",
"Wigmar",
"Wigmund",
"Wignand",
"Wilbert",
"Wilbrand",
"Wilburg",
"Wilderich",
"Wildfried",
"Wilfrieda",
"Wilgard",
"Wilgunde",
"Wilhard",
"Wilhelma",
"Willehad",
"Willibert",
"Willibrand",
"Willimar",
"Williram",
"Wilma",
"Wilmont",
"Wilmut",
"Wilrun",
"Winald",
"Winand",
"Winfrieda",
"Winibald",
"Winibert",
"Winimar",
"Winrich",
"Wintrud",
"Wisgard",
"Wisgunde",
"Witold",
"Wolfbert",
"Wolfgang",
"Wolfger",
"Wolfgunde",
"Wolfhelm",
"Wolfhilde",
"Wolfrad",
"Wolfried",
"Wolfrun",
"Wolftraud",
"Wulfrin",
"Wunibald",
"Wybren",

],
"Erk":
[
"Adeodatus",
"Adorata",
"Afra",
"Agnus",
"Albin",
"Aloisius",
"Aloysius",
"Alva",
"Alwinus",
"Amadea",
"Amand",
"Amatus",
"Amöna",
"Amöne",
"Antonius",
"Arcadius",
"Arkadius",
"Ascanius",
"Askan",
"Augustus",
"Aurelius",
"Balbina",
"Balbine",
"Baldus",
"Beat",
"Beata",
"Beate",
"Beatus",
"Benedikte",
"Benediktus",
"Benigna",
"Bibiana",
"Bibiane",
"Bona",
"Bonaventura",
"Bonifatia",
"Bonifaz",
"Bonifazius",
"Brigida",
"Brigide",
"Cajetan",
"Candid",
"Candidus",
"Caritas",
"Carola",
"Carolus",
"Celestin",
"Celestina",
"Centa",
"Christian",
"Clamor",
"Clodia",
"Columba",
"Columban",
"Columbina",
"Concordia",
"Consilia",
"Constantin",
"Corin",
"Cornel",
"Corvinius",
"Crescentia",
"Crispin",
"Crispinus",
"Cyprian",
"Cäcilia",
"Cäcilius",
"Cäsarina",
"Cäsarine",
"Cölestin",
"Cölestina",
"Deodat",
"Deodata",
"Deodatus",
"Desiderius",
"Diane",
"Dominik",
"Donat",
"Elestin",
"Emerita",
"Emilia",
"Ernesto",
"Ernestus",
"Fabius",
"Fausta",
"Faustinus",
"Faustus",
"Felicia",
"Felizia",
"Fideelius",
"Fidelia",
"Fidelis",
"Fides",
"Firmina",
"Flavia",
"Flavius",
"Florens",
"Florentia",
"Florentius",
"Floriane",
"Florida",
"Florina",
"Florine",
"Florus",
"Fortuna",
"Fortunat",
"Fortunata",
"Fortunatus",
"Franciscus",
"Frobenius",
"Galla",
"Gallus",
"Gaudentius",
"Gemma",
"Gerke",
"Gerko",
"Gertrudis",
"Glorius",
"Gordian",
"Gratian",
"Gratianus",
"Grazian",
"Hilaria",
"Honorius",
"Hubertus",
"Ignatia",
"Ignaz",
"Immakulata",
"Ingenuin",
"Innozens",
"Innozent",
"Innozentia",
"Jucunda",
"Julia",
"Klemens",
"Kolomba",
"Laura",
"Laurenz",
"Lavinia",
"Leo",
"Leon",
"Leona",
"Leonie",
"Longin",
"Longina",
"Longinus",
"Lucretius",
"Ludgerus",
"Ludovicus",
"Lätizia",
"Marzellus",
"Maura",
"Maurus",
"Maximilian",
"Maximus",
"Medardus",
"Modeste",
"Natalia",
"Nero",
"Octaria",
"Oktavian",
"Optatus",
"Orania",
"Ostian",
"Parsimonius",
"Patrizia",
"Patrizius",
"Paul",
"Perdita",
"Peregrin",
"Peregrinus",
"Petrus",
"Piata",
"Pontian",
"Pretiosa",
"Primus",
"Priscus",
"Priska",
"Prosperus",
"Prudentia",
"Pulcheria",
"Romulus",
"Rosina",
"Rufina",
"Rufus",
"Salvator",
"Salvina",
"Salwa",
"Santo",
"Saturnus",
"Scholastika",
"Scipio",
"Serena",
"Serenus",
"Sergia",
"Severa",
"Severina",
"Sidonia",
"Sidonius",
"Silva",
"Silvan",
"Silvester",
"Silvius",
"Sulpiz",
"Tarcisius",
"Terzia",
"Tiziana",
"Urbana",
"Urbanus",
"Urs",
"Ursina",
"Ursula",
"Valerie",
"Valten",
"Velten",
"Veltin",
"Venetia",
"Ventur",
"Veritas",
"Victoria",
"Viktor",
"Vincentia",
"Vita",
"Vital",
"Vivian",
"Viviana",
"Zelestin",
]
}

thulelegacy.faction
Code
{
id:"thulelegacy",
"color":[153,95,158,255],
"displayName":"Thule Legacy",
"shipNamePrefix":"TLS",
"shipNameSources":{
"THULE":1,
},
"description":"No description yet.",
"names":{
"modern":1,
},
"portraits":{
"standard_male":[
"graphics/portraits/portrait_thule04.png",
"graphics/portraits/portrait_thule03.png",
],
"standard_female":[
"graphics/portraits/portrait_thule02.png",
"graphics/portraits/portrait_thule01.png",
],
},
"fleetCompositions":{
"blitz":{
"displayName":"Blitz Trooper",
"maxFleetPoints":11,
"daysWorthOfSupplies":[30, 50],
"lyWorthOfFuel":[40, 60],
"extraCrewPercent":[80, 80],
"marinesPercent":[20, 20],
"ships":{
"thule_vikingmki_Assault":[1, 1],
"thule_vikingmkii_Assault":[1, 1],
"thule_einherjer_wing":[1, 1],
},
},
"stormer":{
"displayName":"Stormer Battalion",
"maxFleetPoints":25,
"daysWorthOfSupplies":[30, 50],
"lyWorthOfFuel":[40, 60],
"extraCrewPercent":[80, 80],
"marinesPercent":[20, 20],
"ships":{
"thule_vikingmki_Assault":[2, 3],
"thule_vikingmkii_Assault":[0, 1],
"thule_berserker_Standard":[0, 1],
"thule_einherjer_wing":[2, 3],
},
},
"pacifier":{
"displayName":"Pacifier Flotilla",
"maxFleetPoints":50,
"daysWorthOfSupplies":[30, 50],
"lyWorthOfFuel":[40, 60],
"extraCrewPercent":[80, 80],
"marinesPercent":[20, 20],
"ships":{
"thule_berserker_Standard":[2, 2],
"thule_vikingmki_Assault":[2, 3],
"thule_vikingmkii_Assault":[2, 3],
"thule_einherjer_wing":[0, 4],
"thule_wartool_wing":[0, 2],
},
},
"peacekeeper":{
"displayName":"Peacekeeper Fleet",
"maxFleetPoints":100,
"daysWorthOfSupplies":[30, 50],
"lyWorthOfFuel":[40, 60],
"extraCrewPercent":[80, 80],
"marinesPercent":[20, 20],
"ships":{
"thule_herzog_Standard":[2, 2],
"thule_berserker_Standard":[2, 4],
"thule_berserker_Support":[1, 2],
"thule_vikingmki_Assault":[2, 3],
"thule_tungsten_experimental":[2, 2],
"thule_vikingmki_Support":[2, 3],
"thule_einherjer_wing":[2, 6],
"thule_wartool_wing":[2, 6],
},
},
"supplyfleet":{
            "displayName":"Supply Fleet",
            "maxFleetPoints":70,
            "daysWorthOfSupplies":[30, 50],
            "lyWorthOfFuel":[40, 60],
"extraCrewPercent":[80, 80],
"marinesPercent":[20, 20],
            "ships":{
                "buffalo_Standard":[4, 7],
                "aurora_Balanced":[1, 3],
                "medusa_Attack":[0, 2],
                "medusa_CS":[0, 2],
                "tempest_Attack":[0, 3],
                "wolf_CS":[0, 3],
                "xyphos_wing":[2,3],
                "wasp_wing":[3, 4],
            },
        },
},
"traits":{
"admiral":{

},
"captain":{
"cowardly":1,
"cautious":1,
"steady":1,
"aggressive":1,
"suicidal":1,
"fearless":1,
},
},
"dialogue":{
"greetingFriendly":"This Thule Legacy ship is on a classified mission. Identity and peaceful status confirmed.",
"greetingNeutral":"Thule Legacy have scanned your ship and analyzed your capabilities to cause a disturbance. Maintain your distance.",
"greetingHostileAggressive":"I can picture in my mind a system without war, a system without hate. And I can picture us attacking that system, because they'd never expect it. Prepare to be pacified.",
"greetingHostileTimid":"Attention. Your vessel has been scanned and identified as a disturbence to the Thule Legacy. Prepare to be pacified. Peace through superior firepower.",
}
},
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 09, 2013, 05:57:09 AM
Another modding question - I have a modified Maneuvering Jets system in my mod that uses the effectLevel to create a slowly fading stat boost. This means most of the effect is executed in the chargedown phase, and thus if I use "clamp max speed after=true" in the system file, the entire effect gets messed up. However I'd still very much like for the max speed to clamp after the chargedown ends, to make the system less useful for fast travel and more useful for combat maneuvering. How could I accomplish this?

Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;

public class BurstJetsStats implements ShipSystemStatsScript {

public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
if (state == ShipSystemStatsScript.State.OUT) {
stats.getMaxSpeed().modifyPercent(id, 100f * effectLevel); // to slow down ship to its regular top speed while powering drive down
stats.getMaxTurnRate().modifyPercent(id, 100f * effectLevel);
stats.getDeceleration().modifyPercent(id, 100f * effectLevel);
} else {
stats.getMaxSpeed().modifyFlat(id, 130f * effectLevel);
stats.getAcceleration().modifyFlat(id, 190f * effectLevel);
stats.getDeceleration().modifyFlat(id, 120f * effectLevel);
stats.getTurnAcceleration().modifyFlat(id, 90f * effectLevel);
stats.getTurnAcceleration().modifyPercent(id, 200f * effectLevel);
stats.getMaxTurnRate().modifyFlat(id, 40f * effectLevel);
stats.getMaxTurnRate().modifyPercent(id, 100f * effectLevel);
}
}
public void unapply(MutableShipStatsAPI stats, String id) {
stats.getMaxSpeed().unmodify(id);
stats.getMaxTurnRate().unmodify(id);
stats.getTurnAcceleration().unmodify(id);
stats.getAcceleration().unmodify(id);
stats.getDeceleration().unmodify(id);
}

public StatusData getStatusData(int index, State state, float effectLevel) {
if (index == 0) {
return new StatusData("improved maneuverability", false);
} else if (index == 1) {
return new StatusData("increased top speed", false);
}
return null;
}
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 09, 2013, 12:20:09 PM
Thank you Alex for taking the time to have a look, unfortunatly i mixed up the json files and uploaded the outdated version, my real updated version looks like this. The naming issue is still present.

Pasted those in and it works fine. Let's take a step back - what's the actual issue? Outside the campaign, or in missions (i.e. if you go to Edit Variants -> Run Simulation off the main screen, or play a mission), the ships aren't associated with a faction. Inside the campaign, this seems to be working correctly - the Thule resupply fleet has names drawn from that group.

Another modding question - I have a modified Maneuvering Jets system in my mod that uses the effectLevel to create a slowly fading stat boost. This means most of the effect is executed in the chargedown phase, and thus if I use "clamp max speed after=true" in the system file, the entire effect gets messed up. However I'd still very much like for the max speed to clamp after the chargedown ends, to make the system less useful for fast travel and more useful for combat maneuvering. How could I accomplish this?

What you could do is turn clamping off, and then do it manually inside the "apply" method, based on the effectLevel when state == ShipSystemStatsScript.State.OUT.

The apply() method gets called every frame. One minor complication is you don't get a time amount passed in, so instead of that, you'll have to base the magnitude of the clamping effect on the value of effectLevel - which is tied to time, so it's just a slightly roundabout way of getting at it.

I.E., once you know it's fading, and the effect level goes to 0.25 - or whatever other value you like - you start clamping, based on how much effectLevel changed between subsequent calls to apply(). I'd also apply some final clamping in unapply() for good measure - that gets called once after a system finishes being turned off.

To actually get at the ship, so you can clamp the velocity/turn rate you can call stats.getEntity() - that returns a CombatEntityAPI. Make sure to check that the return value isn't null before doing anything.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 09, 2013, 12:23:16 PM
Really minor question:

How do I use plugins? Since I am getting a compiler error I assume I first have to compile them? If so how?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 09, 2013, 04:51:33 PM
The game compiles them, you can set a program like netbeans to read the libraries from the game, helps coding by alot, heres a how to by LazyWizard:

http://fractalsoftworks.com/forum/index.php?topic=3173

as for using plugins, you should add those *.java files on the ...\mods\[Your mod folder]\data\scripts\plugins\
they also should have the initial package set to where they are located, in case of the plugins would be:

package data.scripts.plugins;

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 10, 2013, 05:36:24 AM
Still getting a compile error oO.

I made sure everything is where its supposed to be:

the plugin "RotatingDish.java" is located at "modname/data/scripts/plugins/" - it hold the package "data.scripts.plugins".

The sensordish.wpn calls the "everyFrameEffect" wich points at "modname/data/scripts/plugins/RotatingDish.java".
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 10, 2013, 08:27:30 AM
wizardry

Thanks a lot for the help, I'm going to take a look at the system again soon. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 10, 2013, 12:36:53 PM
Hmm I replaced my engine sounds with new ones, I also set the path to them. So why does Starsector still play the default engine sounds?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: arcibalde on January 10, 2013, 12:39:06 PM
Hmm I replaced my engine sounds with new ones, I also set the path to them. So why does Starsector still play the default engine sounds?
data/config/sounds.json   did you change there?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 10, 2013, 01:00:24 PM
Yupp see below.

Code
	# Engines
# played when engines are being used - depending on ship style and size
# For example - a "new" frigate would play the third sound listed, at volume 0.6
"engine_loop":{
"sounds":[
{"file":"sounds/fx/engines/engine.ogg","pitch":1,"volume":1},
{"file":"sounds/fx/engines/engine.ogg","pitch":1,"volume":1},
{"file":"sounds/fx/engines/engine.ogg","pitch":1,"volume":1},
],
"LOW_TECH":{"sounds":[0], "pitch":1, "volume":1},
"MIDLINE":{"sounds":[1], "pitch":1, "volume":1},
"HIGH_TECH":{"sounds":[2], "pitch":1, "volume":1},
"FIGHTER":{"sounds":[0,1,2], "pitch":1, "volume":0.4},
"FRIGATE":{"sounds":[0,1,2], "pitch":1, "volume":0.6},
"DESTROYER":{"sounds":[0,1,2], "pitch":1, "volume":0.7},
"CRUISER":{"sounds":[0,1,2], "pitch":1, "volume":0.8},
"CAPITAL_SHIP":{"sounds":[0,1,2], "pitch":1, "volume":1},
},
"engine_accelerate":{ # played when ship receives an "engine boost" from having zero flux
"sounds":[
{"file":"sounds/fx/engines/engine_startup.ogg","pitch":0.95,"volume":1},
],
"LOW_TECH":{"sounds":[0], "pitch":0.8, "volume":1},
"MIDLINE":{"sounds":[0], "pitch":0.9, "volume":1},
"HIGH_TECH":{"sounds":[0], "pitch":1, "volume":1},
"FIGHTER":{"sounds":[0], "pitch":1, "volume":0.4},
"FRIGATE":{"sounds":[0], "pitch":1, "volume":0.6},
"DESTROYER":{"sounds":[0], "pitch":1, "volume":0.7},
"CRUISER":{"sounds":[0], "pitch":1, "volume":0.8},
"CAPITAL_SHIP":{"sounds":[0], "pitch":1, "volume":1},
},

The soundfile does work btw, tested it with a weapon, however for some reason it does not override the engine sound... annoying -.-"

Fixed it:

Unlike weapon sounds, the engine sounds need to be named EXACTLY like the original files.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 12, 2013, 02:24:02 PM
Thank you Alex for taking the time to have a look, unfortunatly i mixed up the json files and uploaded the outdated version, my real updated version looks like this. The naming issue is still present.

Pasted those in and it works fine. Let's take a step back - what's the actual issue? Outside the campaign, or in missions (i.e. if you go to Edit Variants -> Run Simulation off the main screen, or play a mission), the ships aren't associated with a faction. Inside the campaign, this seems to be working correctly - the Thule resupply fleet has names drawn from that group.

Okay, thank you very much Alex, my bad.
I thought in missions ships where still associated with factions.
And yes in campaign mode it works properly.

Thank you again and sorry for wasting your time ;)

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 12, 2013, 02:27:59 PM
I'm trying to make a hull repair ship system, which looks like it should be easy enough (the java for it is quite easy, just using stats.getHullRepairRatePercentPerSecond())


However, when it comes to the .SYSTEM file I'm not sure how to proceed.

I figure I can use:
   "type":"STAT_MOD",

But I have no idea what to set the aiType to. Or, should I be using the example of FastMissileRacksAI.java and doing my own custom one?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 12, 2013, 02:30:37 PM
Yeah but that one example is kinda limited to understand how exactly can we make our own, pretty much the reason we havent started to mess up with them

heres an old system to repair your hull:
Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.ShipAPI;

public class RegenerateHitpoints  implements ShipSystemStatsScript {

public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
        ShipAPI ship = (ShipAPI) stats.getEntity();

        if (ship == null)
            return;

            if(ship.getHitpoints() < ship.getMaxHitpoints())
            {
                stats.getMaxHullRepairFraction().modifyFlat(id, 1000f); // the % in speed it heals back

                float CurrentPercHP = (ship.getHitpoints() * 100) / ship.getMaxHitpoints(); //Grab current perc

                if(CurrentPercHP < 20.000f) //checking if its less then 20% to repair
                    stats.getHullRepairRatePercentPerSecond().modifyFlat(id, CurrentPercHP); // if its less then 20% heal
                else
                    stats.getHullRepairRatePercentPerSecond().modifyFlat(id, 20.000f); // else heal exacly 20%

            }
}
public void unapply(MutableShipStatsAPI stats, String id)
        {
            stats.getMaxHullRepairFraction().unmodify(id);
            stats.getHullRepairRatePercentPerSecond().unmodify(id);
}

public StatusData getStatusData(int index, State state, float effectLevel) {
if (index == 0) {
return new StatusData("Regenerating Hitpoints...", false);
}
return null;
}
}

and on the *.system file
Code
{
"id":"podship_regeneration",
"type":"SHIELD_MOD",
"aiType":"FORTRESS_SHIELD",

"statsScript":"data.shipsystems.scripts.RegenerateHitpoints",

"soundFilterType":"LOWPASS",
"soundFilterGain":1,
"soundFilterGainHF":0.0,

"useSound":"podship_regenerate",
#"loopSound":"beam_heavy_loop",
#"deactivateSound":"terminator_shield",
#"outOfUsesSound":"gun_out_of_ammo",

#"useSound":"terminator_shield",
#"deactivateSound":"terminator_shield",
# Stian disabled these two because the timing of activate/deactivate did not work together with the loop sound.
# Enable them to test the issue. The deactivateSound plays late, after the loopsound has already stopped,
# creating a stuttering effect.
"loopSound":"podship_regenerate",
"outOfUsesSound":"gun_out_of_ammo",
}

i didnt change the type of aitype, so the ai doesnt know how to use it
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 12, 2013, 02:37:59 PM
Huh.

Guess I'm gonna try to write my own AI script then.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 12, 2013, 03:39:29 PM
Getting close.

The system itself works nicely (it's not an instant repair, it's a 4-second repair that shuts down pretty much all of your ship systems and does 5% per second, or less if your HP is above 80%):

Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.ShipAPI;

/**
 *
 * @author Ender
 */
public class Hull_Repair implements ShipSystemStatsScript {
    
    public static final float REPAIR_RATE_MOD = 5f;
    
    public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
        stats.getMaxHullRepairFraction().modifyFlat(id, 1000f); // the % in speed it heals back
        ShipAPI ship = (ShipAPI) stats.getEntity();
        if (ship == null)
            return;
        
        float CurrentPercHP = (ship.getHitpoints() * 100) / ship.getMaxHitpoints();
        if (CurrentPercHP <= 20.000f) {
            float repairRatePercent = REPAIR_RATE_MOD * effectLevel;
            stats.getHullRepairRatePercentPerSecond().modifyFlat(id, repairRatePercent);
        } else {
            float repairRatePercent = REPAIR_RATE_MOD * effectLevel * (100.0f - CurrentPercHP);
            stats.getHullRepairRatePercentPerSecond().modifyFlat(id, repairRatePercent);
        }
        
    }
    public void unapply(MutableShipStatsAPI stats, String id) {
        stats.getHullRepairRatePercentPerSecond().unmodifyFlat(id);
    }
    
    public StatusData getStatusData(int index, State state, float effectLevel) {
        float repairRatePercent = REPAIR_RATE_MOD * effectLevel;
        if (index == 0) {
            return new StatusData("hull repair rate +" + (int) repairRatePercent + "%", false);
        } else if (index == 1) {
            return null;
        }
        
        return null;
    }
}


But the AI script causes an error.

Here's the AI java code (it's a bit hacky but it's a work in progress):
Code
package data.shipsystems.scripts.ai;

import java.util.List;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.util.IntervalUtil;
/**
 *
 * @author Ender
 */
public class Hull_RepairAI {
    
     private ShipAPI ship;
private CombatEngineAPI engine;
private ShipwideAIFlags flags;
private ShipSystemAPI system;

private IntervalUtil tracker = new IntervalUtil(0.5f, 1f);
        
        public void init(ShipAPI ship, ShipSystemAPI system, ShipwideAIFlags flags, CombatEngineAPI engine) {
this.ship = ship;
this.flags = flags;
this.engine = engine;
this.system = system;
}
        
        private float bestFractionEver = 0f;
private float sinceLast = 0f;
        
        
        @SuppressWarnings("unchecked")
        
        public void advance(float amount, ShipAPI target) {
            tracker.advance(amount);
            sinceLast += amount;
            
            if (tracker.intervalElapsed()) {
                if (system.getCooldownRemaining() > 0) return;
if (system.isOutOfAmmo()) return;
if (system.isActive()) return;
                
                float maxCooldown = 0f;
float totalCooldownSaved = 0f;
                
                float currentHullHP = (100.0f * ship.getHitpoints() / ship.getMaxHitpoints());
                
                if (maxCooldown <= 0 || totalCooldownSaved <= 0 || currentHullHP >= 80.0f) return;
                
                float fluxLevel = ship.getFluxTracker().getFluxLevel();

boolean targetIsVulnerable = target != null && target.getFluxTracker().isOverloadedOrVenting() &&
                        (target.getFluxTracker().getOverloadTimeRemaining() > 5f ||
                        target.getFluxTracker().getTimeToVent() > 5f);
                
                float remainingFluxLevel = 1f - fluxLevel;
                float fluxFractionPerUse = system.getFluxPerUse() / ship.getFluxTracker().getMaxFlux();
if (fluxFractionPerUse > remainingFluxLevel) return;
                
                float fluxLevelAfterUse = fluxLevel + fluxFractionPerUse;
if (fluxLevelAfterUse > 0.9f && fluxFractionPerUse > 0.025f) return;
                
                if (!targetIsVulnerable && sinceLast < 10f && currentHullHP >= 20.0f) return; //in an emergency, we shouldn't care if the enemy ship is currently voulnerable because we're already losing
                
                float fraction = totalCooldownSaved / maxCooldown;
                
                if (fraction > bestFractionEver) {
                        bestFractionEver = fraction;
                }
                
                if (fraction >= 0.5) {
                        ship.useSystem();
                        sinceLast = 0f;
                        return;
                }
            }
        }
        
}


And here's the error block I get:

Quote
42620 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.ClassCastException: data.shipsystems.scripts.ai.Hull_RepairAI cannot be cast to com.fs.starfarer.api.combat.ShipSystemAIScript
java.lang.ClassCastException: data.shipsystems.scripts.ai.Hull_RepairAI cannot be cast to com.fs.starfarer.api.combat.ShipSystemAIScript
   at com.fs.starfarer.loading.specs.Oooo.öO0000(Unknown Source)
   at com.fs.starfarer.loading.specs.Oooo.o00000(Unknown Source)
   at com.fs.starfarer.combat.ai.BasicShipAI.<init>(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.super(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.super(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.deploy(Unknown Source)
   at com.fs.starfarer.ui.impl.G.super(Unknown Source)
   at com.fs.starfarer.ui.impl.G.super(Unknown Source)
   at com.fs.starfarer.ui.o00oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.super(Unknown Source)
   at com.fs.starfarer.ui.OOoO.super(Unknown Source)
   at com.fs.starfarer.ui.Objectsuper.o00000(Unknown Source)
   at com.fs.starfarer.combat.F.ÖÖÒ000(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 12, 2013, 05:37:45 PM
Spoiler
Getting close.

The system itself works nicely (it's not an instant repair, it's a 4-second repair that shuts down pretty much all of your ship systems and does 5% per second, or less if your HP is above 80%):

Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.ShipAPI;

/**
 *
 * @author Ender
 */
public class Hull_Repair implements ShipSystemStatsScript {
    
    public static final float REPAIR_RATE_MOD = 5f;
    
    public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
        stats.getMaxHullRepairFraction().modifyFlat(id, 1000f); // the % in speed it heals back
        ShipAPI ship = (ShipAPI) stats.getEntity();
        if (ship == null)
            return;
        
        float CurrentPercHP = (ship.getHitpoints() * 100) / ship.getMaxHitpoints();
        if (CurrentPercHP <= 20.000f) {
            float repairRatePercent = REPAIR_RATE_MOD * effectLevel;
            stats.getHullRepairRatePercentPerSecond().modifyFlat(id, repairRatePercent);
        } else {
            float repairRatePercent = REPAIR_RATE_MOD * effectLevel * (100.0f - CurrentPercHP);
            stats.getHullRepairRatePercentPerSecond().modifyFlat(id, repairRatePercent);
        }
        
    }
    public void unapply(MutableShipStatsAPI stats, String id) {
        stats.getHullRepairRatePercentPerSecond().unmodifyFlat(id);
    }
    
    public StatusData getStatusData(int index, State state, float effectLevel) {
        float repairRatePercent = REPAIR_RATE_MOD * effectLevel;
        if (index == 0) {
            return new StatusData("hull repair rate +" + (int) repairRatePercent + "%", false);
        } else if (index == 1) {
            return null;
        }
        
        return null;
    }
}


But the AI script causes an error.

Here's the AI java code (it's a bit hacky but it's a work in progress):
Code
package data.shipsystems.scripts.ai;

import java.util.List;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.util.IntervalUtil;
/**
 *
 * @author Ender
 */
public class Hull_RepairAI {
    
     private ShipAPI ship;
private CombatEngineAPI engine;
private ShipwideAIFlags flags;
private ShipSystemAPI system;

private IntervalUtil tracker = new IntervalUtil(0.5f, 1f);
        
        public void init(ShipAPI ship, ShipSystemAPI system, ShipwideAIFlags flags, CombatEngineAPI engine) {
this.ship = ship;
this.flags = flags;
this.engine = engine;
this.system = system;
}
        
        private float bestFractionEver = 0f;
private float sinceLast = 0f;
        
        
        @SuppressWarnings("unchecked")
        
        public void advance(float amount, ShipAPI target) {
            tracker.advance(amount);
            sinceLast += amount;
            
            if (tracker.intervalElapsed()) {
                if (system.getCooldownRemaining() > 0) return;
if (system.isOutOfAmmo()) return;
if (system.isActive()) return;
                
                float maxCooldown = 0f;
float totalCooldownSaved = 0f;
                
                float currentHullHP = (100.0f * ship.getHitpoints() / ship.getMaxHitpoints());
                
                if (maxCooldown <= 0 || totalCooldownSaved <= 0 || currentHullHP >= 80.0f) return;
                
                float fluxLevel = ship.getFluxTracker().getFluxLevel();

boolean targetIsVulnerable = target != null && target.getFluxTracker().isOverloadedOrVenting() &&
                        (target.getFluxTracker().getOverloadTimeRemaining() > 5f ||
                        target.getFluxTracker().getTimeToVent() > 5f);
                
                float remainingFluxLevel = 1f - fluxLevel;
                float fluxFractionPerUse = system.getFluxPerUse() / ship.getFluxTracker().getMaxFlux();
if (fluxFractionPerUse > remainingFluxLevel) return;
                
                float fluxLevelAfterUse = fluxLevel + fluxFractionPerUse;
if (fluxLevelAfterUse > 0.9f && fluxFractionPerUse > 0.025f) return;
                
                if (!targetIsVulnerable && sinceLast < 10f && currentHullHP >= 20.0f) return; //in an emergency, we shouldn't care if the enemy ship is currently voulnerable because we're already losing
                
                float fraction = totalCooldownSaved / maxCooldown;
                
                if (fraction > bestFractionEver) {
                        bestFractionEver = fraction;
                }
                
                if (fraction >= 0.5) {
                        ship.useSystem();
                        sinceLast = 0f;
                        return;
                }
            }
        }
        
}


And here's the error block I get:

Quote
42620 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.ClassCastException: data.shipsystems.scripts.ai.Hull_RepairAI cannot be cast to com.fs.starfarer.api.combat.ShipSystemAIScript
java.lang.ClassCastException: data.shipsystems.scripts.ai.Hull_RepairAI cannot be cast to com.fs.starfarer.api.combat.ShipSystemAIScript
   at com.fs.starfarer.loading.specs.Oooo.öO0000(Unknown Source)
   at com.fs.starfarer.loading.specs.Oooo.o00000(Unknown Source)
   at com.fs.starfarer.combat.ai.BasicShipAI.<init>(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.super(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.super(Unknown Source)
   at com.fs.starfarer.combat.CombatFleetManager.deploy(Unknown Source)
   at com.fs.starfarer.ui.impl.G.super(Unknown Source)
   at com.fs.starfarer.ui.impl.G.super(Unknown Source)
   at com.fs.starfarer.ui.o00oOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.super(Unknown Source)
   at com.fs.starfarer.ui.OOoO.super(Unknown Source)
   at com.fs.starfarer.ui.Objectsuper.o00000(Unknown Source)
   at com.fs.starfarer.combat.F.ÖÖÒ000(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]

You forgot to have Hull_RepairAI implement ShipSystemAIScript. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 12, 2013, 05:47:50 PM
You forgot to have Hull_RepairAI implement ShipSystemAIScript. :)
/facepalm


I knew it would be something simple.

Now I just have to get the AI to actually use the damn thing since apparently the actual criteria isn't being met.

EDIT: It's using it, now I just need to make it actually be smart about using it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on January 12, 2013, 07:07:54 PM
If anyone would be nice enough to take a look at this mod, see what I've done wrong.
http://fractalsoftworks.com/forum/index.php?topic=4502.msg83744#msg83744
The .log is posted by Uthilian.  I've checked the code for the spawn point and the convoy to see what I've missed, but I can't figure it out.  All I know is that the game crashes when the convoy spawns.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 12, 2013, 07:30:42 PM
If anyone would be nice enough to take a look at this mod, see what I've done wrong.
http://fractalsoftworks.com/forum/index.php?topic=4502.msg83744#msg83744
The .log is posted by Uthilian.  I've checked the code for the spawn point and the convoy to see what I've missed, but I can't figure it out.  All I know is that the game crashes when the convoy spawns.

I answered in your mod's thread. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on January 12, 2013, 08:30:13 PM
Thanks!  Aside from that stupid feeling I have, I appreciate it. :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on January 12, 2013, 09:35:45 PM
IS there anyway to make it so when a mirv splits it doesn't leave a crapload of particles behind?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 12, 2013, 11:49:42 PM
One more crazy one for tonight. I'm trying to create a ship system that benefits other ships in the fleet in a similar manner to battlefield objectives, such as raising weapon ranges, etc.

But I can't find a way to do it! It's easy to make it apply to the ship using the system, but the only idea I've had so far to use it with the fleet is by trying to invoke BattleObjectivesEffectsPlugin.

However, any attempt to actually use this in the system code results in a crash even just trying to enter the refit screen for the ship.

Am I missing something or is this currently not possible?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 12, 2013, 11:56:43 PM
It's possible, but you will need the current CombatEngineAPI to do it. Once you have the engine, you can use CombatEngineAPI's getShips(), then filter those with ShipAPI's getOwner().

The easiest/most reusable way to get at the current engine is to add something similar to the following script under data/scripts/plugins:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import java.util.List;

public class CombatUtils implements EveryFrameCombatPlugin
{
    private static CombatEngineAPI engine;
    private static float combatTime = 0f;

    public static CombatEngineAPI getCombatEngine()
    {
        return engine;
    }

    public static float getElapsedCombatTime()
    {
        return combatTime;
    }

    @Override
    public void advance(float amount, List events)
    {
        combatTime += amount;
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        CombatUtils.engine = engine;
        CombatUtils.combatTime = 0f;
    }
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 13, 2013, 12:24:34 AM
Hey guys,

this one will be really weird, but Ill go with it anyways...

Would it be possible to have a weapon, that would actually emit shield´, in fixed direction, of course.
( :P)



Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 13, 2013, 12:36:30 AM
Eh like an Omni shield?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 13, 2013, 12:40:38 AM
Eh like an Omni shield?


I better explain, what I need.

I wanted to create somesort of a shiled generator, that would be in fix pos. and cover
some part of the ship. (ship not having any vanila omni or front shields)

First I tried it with drones, that would act as seperateparts of the ship, however, they
are always "floating" a bit and ..just doesnt seem right.

Now, if a weapon would emit a ..i would suspect a front sheild, it would be much eaiser
and precise to put them on the ship - using weapon slots.. either make them hidden, built-in etc.

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Okim on January 13, 2013, 03:30:39 AM
With new decorative weapon type and ability to assign scripts i suppose you can do something like that. Look at shipAPI, shieldsAPI and weaponAPI files. There might be some clues.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on January 13, 2013, 04:03:54 AM
With new decorative weapon type and ability to assign scripts i suppose you can do something like that. Look at shipAPI, shieldsAPI and weaponAPI files. There might be some clues.

Ill look into it then :)

I would love to figure it out, but sadly i feel its outside my league, never messed with these files,
(saying ahead - chances of me making it work are slim, no promises here  :D )
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 13, 2013, 07:13:44 AM
Has anyone looked at what's possible with Weapon and Beam effects yet? Like, for instance a missile that does damage over time after impacting the enemy?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 13, 2013, 07:29:04 AM
Has anyone looked at what's possible with Weapon and Beam effects yet? Like, for instance a missile that does damage over time after impacting the enemy?

This, not yet supported;

My turn to ask for something, is there a way to get the EXACT coords of weapons or/and ships, i've had huge issues grabbing points inside the bounds, even with the polygon methods on the library that lazy shared. This would be useful for a huge number of projects for every mod that now using decorative weapons or modified combat engines
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 13, 2013, 09:00:27 AM
With new decorative weapon type and ability to assign scripts i suppose you can do something like that. Look at shipAPI, shieldsAPI and weaponAPI files. There might be some clues.

Ill look into it then :)

I would love to figure it out, but sadly i feel its outside my league, never messed with these files,
(saying ahead - chances of me making it work are slim, no promises here  :D )

Have you tried drones similar to the sensor drones on the Apogee, but making their accel & top speed values very high so that they are able to maintain position perfectly?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 13, 2013, 10:03:35 AM
Okay, thank you very much Alex, my bad.
I thought in missions ships where still associated with factions.
And yes in campaign mode it works properly.

Thank you again and sorry for wasting your time ;)

No problem, glad that's all it was :)

IS there anyway to make it so when a mirv splits it doesn't leave a crapload of particles behind?

Apparently, no - looking at that code, it's entirely hardcoded. Ugh. You know, it'd really help to have a list of "things that aren't moddable that would be nice to have be moddable" somewhere, as *I* don't tend to run into them, but you guys do. So something like this, shield colors/custom tech styles, etc. Not talking about something at the level of new features - just things that the engine clearly already does that just happen to not be exposed at all. Then I could just cherry-pick a few with each subsequent release and hopefully make a good dent in the list over time.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 13, 2013, 10:06:59 AM
Is there some easy way to mod the value of one flux capacitor?  I'm thinking in particular of Okim's Ironclads mod, where the original ship flux capacities & shield strengths were built around the old 100 flux per capacitor value - resulting in the current game making flux capacitors (arguably) "too good" relative to where they should be.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 13, 2013, 10:12:45 AM
Is there some easy way to mod the value of one flux capacitor?  I'm thinking in particular of Okim's Ironclads mod, where the original ship flux capacities & shield strengths were built around the old 100 flux per capacitor value - resulting in the current game making flux capacitors (arguably) "too good" relative to where they should be.

Also hardcoded - another great candidate for that list.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 13, 2013, 12:51:33 PM
It's possible, but you will need the current CombatEngineAPI to do it. Once you have the engine, you can use CombatEngineAPI's getShips(), then filter those with ShipAPI's getOwner().

The easiest/most reusable way to get at the current engine is to add something similar to the following script under data/scripts/plugins:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import java.util.List;

public class CombatUtils implements EveryFrameCombatPlugin
{
    private static CombatEngineAPI engine;
    private static float combatTime = 0f;

    public static CombatEngineAPI getCombatEngine()
    {
        return engine;
    }

    public static float getElapsedCombatTime()
    {
        return combatTime;
    }

    @Override
    public void advance(float amount, List events)
    {
        combatTime += amount;
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        CombatUtils.engine = engine;
        CombatUtils.combatTime = 0f;
    }
}
So question here. I tried to take a shortcut and simply call CombatEngineAPI:

Code
        public CombatEngineAPI engine;

However, it's always returning null (I know this because I nested a number of ifs to see what exactly I was getting a null pointer from, and it's this).
I was trying to keep all the code in this one java file, but it's looking like I might need to simply write the plugin file as you have there. Is this true, or is there some other way I can keep CombatEngineAPI from returning a null value?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 13, 2013, 01:22:59 PM
So question here. I tried to take a shortcut and simply call CombatEngineAPI:

Code
        public CombatEngineAPI engine;

However, it's always returning null (I know this because I nested a number of ifs to see what exactly I was getting a null pointer from, and it's this).
I was trying to keep all the code in this one java file, but it's looking like I might need to simply write the plugin file as you have there. Is this true, or is there some other way I can keep CombatEngineAPI from returning a null value?

All that line of code does is create an empty variable (if I wrote "public String warAndPeace;", I wouldn't automatically have the book's text assigned to that variable ;)). You need to get the engine the game is using, which is what the plugin does.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 13, 2013, 01:26:07 PM
So question here. I tried to take a shortcut and simply call CombatEngineAPI:

Code
        public CombatEngineAPI engine;

However, it's always returning null (I know this because I nested a number of ifs to see what exactly I was getting a null pointer from, and it's this).
I was trying to keep all the code in this one java file, but it's looking like I might need to simply write the plugin file as you have there. Is this true, or is there some other way I can keep CombatEngineAPI from returning a null value?

All that line of code does is create an empty variable (if I wrote "public String warAndPeace;", I wouldn't automatically have the book's text assigned to that variable ;)). You need to get the engine the game is using, which is what the plugin does.
Got it. I'm lazy, apparently.  :)




In other news: Arg, why does TachyonLanceEffect have to be compiled code?  :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 13, 2013, 01:27:32 PM
In other news: Arg, why does TachyonLanceEffect have to be compiled code?  :(

Check out starfarer.api.zip in starfarer-core, it has the source for that included.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 13, 2013, 02:17:16 PM
In other news: Arg, why does TachyonLanceEffect have to be compiled code?  :(

Check out starfarer.api.zip in starfarer-core, it has the source for that included.
Holy crap, that's what I needed.

Hopefully final question for a while: is there a way to print out lines to the starsector.log file for debugging?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 13, 2013, 02:27:39 PM
In other news: Arg, why does TachyonLanceEffect have to be compiled code?  :(

Check out starfarer.api.zip in starfarer-core, it has the source for that included.
Holy crap, that's what I needed.

Hopefully final question for a while: is there a way to print out lines to the starsector.log file for debugging?

Not as far as I know, unfortunately.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 13, 2013, 08:02:02 PM
Not as far as I know, unfortunately.

Where does stuff go if using System.out.println()? If that doesn't end up in the log, it should end up on the console - so if you run starsector.bat instead of the .exe, you should see its output in the console window the .bat pops up.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 14, 2013, 11:32:52 AM
Is it possible to get the value for a ship's sight range? I can see how to find out the current bonus to the sight range, but not the actual sight range?

I ask because I'm trying to make a ship provide allied bonuses (and enemy debuffs) but would rather it do it only within its sight range rather than across the entire map.


On that same note, is it possible to have a ship system cause status messages to show up on the player's screen if the system is being used by another ship? Same system--it would be nice to tell the player that they are being debuffed by an enemy ship, or receiving buffs from a friendly AI-controlled ship.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 14, 2013, 02:16:33 PM
How can I make a weapon animate in a different way than playing the animation over and over as long as the mouse button is held down? I'd like for the animation to play to completion after the weapon has fired a bullet and then rest at the initial frame until the next time it fires. Or at the very least, have the animation reset whenever a new round is fired.

E: (http://i14.photobucket.com/albums/a350/cycerin/SolenoidQuenchCannon_zps9c3fd01f.gif)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 14, 2013, 03:00:54 PM
That depends on the firerate of the weapon and the number of frames. You can time it so that the animation finishes after a bullet was fired and resets before a new one is fired.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 14, 2013, 04:50:48 PM
Is it possible to get the value for a ship's sight range? I can see how to find out the current bonus to the sight range, but not the actual sight range?

I ask because I'm trying to make a ship provide allied bonuses (and enemy debuffs) but would rather it do it only within its sight range rather than across the entire map.

On that same note, is it possible to have a ship system cause status messages to show up on the player's screen if the system is being used by another ship? Same system--it would be nice to tell the player that they are being debuffed by an enemy ship, or receiving buffs from a friendly AI-controlled ship.

No, on both counts. Both make good candidates for the "hardcoded/not exposed, would be nice if was made moddable" list. Although the combat message widget is something I'm not happy with and would like to revisit extensively at some point, if I can.

How can I make a weapon animate in a different way than playing the animation over and over as long as the mouse button is held down? I'd like for the animation to play to completion after the weapon has fired a bullet and then rest at the initial frame until the next time it fires. Or at the very least, have the animation reset whenever a new round is fired.

You could either 1) sync up the animation with the rate of fire of the weapon - it's likely that it may get out of sync after a long time spent firing continuously, but has the virtue of being a simple solution, or 2) write a custom EveryFrameWeaponEffectPlugin to play the animation - probably based on weapon.getRemainingCooldown()/weapon.isFiring()/weapon.getAnimation().setFrame(int), etc.

Note that for #1, it should play through the entire animation cycle and eventually reset to the first frame, even if you only tap the mouse. If that's not happening, and you can send me a mod with a working example of that, I'll be happy to take a look.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 14, 2013, 05:10:19 PM

As a workaround then, what is the maximum normal sight range on ships?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 14, 2013, 06:03:37 PM
3000.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 14, 2013, 07:07:33 PM
Awesome, thanks.

Also: I'm pretty sure there isn't, but is there a way to force a ship's AI to change targets?

Asking because I'm wondering if there is a way to force the AI to shoot a friendly besides temporarily switching the owner
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 14, 2013, 07:10:57 PM
No, there isn't.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 15, 2013, 02:30:56 AM
You could either 1) sync up the animation with the rate of fire of the weapon - it's likely that it may get out of sync after a long time spent firing continuously, but has the virtue of being a simple solution, or 2) write a custom EveryFrameWeaponEffectPlugin to play the animation - probably based on weapon.getRemainingCooldown()/weapon.isFiring()/weapon.getAnimation().setFrame(int), etc.

Note that for #1, it should play through the entire animation cycle and eventually reset to the first frame, even if you only tap the mouse. If that's not happening, and you can send me a mod with a working example of that, I'll be happy to take a look.

The issue is that I want a chargeup time for the weapon, and the weapon starts animating while it's charging. That probably forces me to make a plugin... hmm. This is getting complicated.

Still great that the game supports this sort of thing already, though. Seriously.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on January 15, 2013, 02:52:18 PM
Hey, how difficult would it be to have ballistics weapons have shell casings fly out and float off into space? I thought it would be a nice little detail to add...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 15, 2013, 07:49:40 PM
I've just created a system that allows a carrier to teleport a player's most damaged wing to itself. It works great, the only problem is that the fighters don't get the phase teleport animation.

Since I cannot find any code for the phase teleporter or skimmer, I can't see any examples of how to tell the game that it should be playing the phase teleport animations. Is there any way for me to do this, or is it a feature that is currently unmoddable?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LostInTheWired on January 15, 2013, 09:30:33 PM
I've been looking in the files of a mod, trying to figure out why a carrier in it isn't...acting like a carrier (won't rally at Rally Carrier commands).  Is this set anywhere?  It has a launch bay, so if that's how it selects carriers, it's not quite working.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 15, 2013, 09:53:44 PM
I've been looking in the files of a mod, trying to figure out why a carrier in it isn't...acting like a carrier (won't rally at Rally Carrier commands).  Is this set anywhere?  It has a launch bay, so if that's how it selects carriers, it's not quite working.
you need to put CARRIER in the 'hint' column in the ships,csv file
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 17, 2013, 10:13:01 AM
Is it possible that you can't have more than 4 backgrounds?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Nekora on January 17, 2013, 11:29:13 AM
Using the new hit effects system is it possible to have a beam weapon bounce to hit another target, like a chain lightning type weapon, or could a projectile weapon do the same?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 17, 2013, 12:53:05 PM
Using the new hit effects system is it possible to have a beam weapon bounce to hit another target, like a chain lightning type weapon, or could a projectile weapon do the same?

Yes, you can do that with projectiles easily. We can't spawn beams in our code yet, but you could make something similar with lightning arcs (since you mentioned chain lightning, that might work better anyway). :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Nekora on January 17, 2013, 12:57:51 PM
Yes, you can do that with projectiles easily. We can't spawn beams in our code yet, but you could make something similar with lightning arcs (since you mentioned chain lightning, that might work better anyway). :)

Cool, could you show me an example of this? i started a thread asking for examples here > http://fractalsoftworks.com/forum/index.php?topic=5423.msg84776#msg84776
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on January 20, 2013, 10:41:25 AM
Is it possible to get an existing station and set it to a new orbit\location?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 20, 2013, 11:30:09 AM
Im having trouble getting a TractorBeam to work, its for the startreker mod, its suppose to be a borg weapon of doom that feeds on player tears, but right now its feeding on my tears  :'(

Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;
import org.lwjgl.util.vector.Vector2f;
import org.lazywizard.lazylib.MathUtils;

public class TractorBeamEffect implements BeamEffectPlugin {

private CombatEntityAPI currentArc = null;
private IntervalUtil fireInterval = new IntervalUtil(0.2f, 0.3f);

public void advance(float amount, CombatEngineAPI engine, BeamAPI beam) {

if (currentArc != null) {
if (!engine.isEntityInPlay(currentArc)) {
currentArc = null;
}//if
}//if

CombatEntityAPI target = beam.getDamageTarget();
if (target != null && target instanceof ShipAPI && (target.getShield() == null || !target.getShield().isWithinArc(beam.getTo()))) {
if (beam.getBrightness() >= 1f) {
fireInterval.advance(amount);
if (fireInterval.intervalElapsed()) {
Vector2f dir = Vector2f.sub(beam.getTo(), beam.getFrom(), new Vector2f());
if (dir.lengthSquared() > 0) dir.normalise();
dir.scale(5f);
Vector2f point = Vector2f.sub(beam.getTo(), dir, new Vector2f());
float emp = beam.getWeapon().getDerivedStats().getBurstDamage() * .667f;
float dam = emp * 0.25f;
engine.spawnEmpArc(beam.getSource(), point, beam.getDamageTarget(), beam.getDamageTarget(),
//engine.spawnEmpArc(beam.getSource(), beam.getFrom(), beam.getSource(), beam.getDamageTarget(),
  DamageType.ENERGY,
  dam, // damage
  emp, // emp
  100000f, // max range
  "tachyon_lance_emp_impact",
  30f, // thickness
  new Color(68,250,50,255),
  new Color(212,255,192,255)
  );
                                                Vector2f velocity, direction;
                                                float distance;

                                                velocity = beam.getDamageTarget().getVelocity();
                                                distance = MathUtils.getDistance(beam.getDamageTarget(), beam.getSource());
                                                // Normalized directional vector
                                                direction = MathUtils.getDirectionalVector(beam.getDamageTarget(), beam.getSource());

                                                float strength = distance * 300f;
                                                velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));
                                }//if
}//if
}//if
}//advance
}//class

Based on LazyWizard blackhole code and a copy of the tachyon lance vanila weapon effect.

It semi works, it not pulling but it stops a ship from moving, heres a sneak peak:
Spoiler
(https://dl.dropbox.com/u/32263294/screenshot000.png)
[close]

I still need to make a "weaker" version of it, based on hull sizes for the other factions, this one should not care what size the ship is, he will pull it in like it was nothing while getting emp dmg on it
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 20, 2013, 12:17:46 PM
Mind if I use that "movement stopper" code for Rejection? Because that would totally fit an EW-frigate!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 20, 2013, 12:21:50 PM
Im having trouble getting a TractorBeam to work, its for the startreker mod, its suppose to be a borg weapon of doom that feeds on player tears, but right now its feeding on my tears  :'(

Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;
import org.lwjgl.util.vector.Vector2f;
import org.lazywizard.lazylib.MathUtils;

public class TractorBeamEffect implements BeamEffectPlugin {

private CombatEntityAPI currentArc = null;
private IntervalUtil fireInterval = new IntervalUtil(0.2f, 0.3f);

public void advance(float amount, CombatEngineAPI engine, BeamAPI beam) {

if (currentArc != null) {
if (!engine.isEntityInPlay(currentArc)) {
currentArc = null;
}//if
}//if

CombatEntityAPI target = beam.getDamageTarget();
if (target != null && target instanceof ShipAPI && (target.getShield() == null || !target.getShield().isWithinArc(beam.getTo()))) {
if (beam.getBrightness() >= 1f) {
fireInterval.advance(amount);
if (fireInterval.intervalElapsed()) {
Vector2f dir = Vector2f.sub(beam.getTo(), beam.getFrom(), new Vector2f());
if (dir.lengthSquared() > 0) dir.normalise();
dir.scale(5f);
Vector2f point = Vector2f.sub(beam.getTo(), dir, new Vector2f());
float emp = beam.getWeapon().getDerivedStats().getBurstDamage() * .667f;
float dam = emp * 0.25f;
engine.spawnEmpArc(beam.getSource(), point, beam.getDamageTarget(), beam.getDamageTarget(),
//engine.spawnEmpArc(beam.getSource(), beam.getFrom(), beam.getSource(), beam.getDamageTarget(),
  DamageType.ENERGY,
  dam, // damage
  emp, // emp
  100000f, // max range
  "tachyon_lance_emp_impact",
  30f, // thickness
  new Color(68,250,50,255),
  new Color(212,255,192,255)
  );
                                                Vector2f velocity, direction;
                                                float distance;

                                                velocity = beam.getDamageTarget().getVelocity();
                                                distance = MathUtils.getDistance(beam.getDamageTarget(), beam.getSource());
                                                // Normalized directional vector
                                                direction = MathUtils.getDirectionalVector(beam.getDamageTarget(), beam.getSource());

                                                float strength = distance * 300f;
                                                velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));
                                }//if
}//if
}//if
}//advance
}//class

Based on LazyWizard blackhole code and a copy of the tachyon lance vanila weapon effect.

It semi works, it not pulling but it stops a ship from moving, heres a sneak peak:
Spoiler
(https://dl.dropbox.com/u/32263294/screenshot000.png)
[close]

I still need to make a "weaker" version of it, based on hull sizes for the other factions, this one should not care what size the ship is, he will pull it in like it was nothing while getting emp dmg on it

You're probably having problems because you have the pull effect inside of the if (fireInterval.intervalElapsed()) block. That means it will only execute once about every 15 frames - since the velocity change from the black hole code is implemented gradually, this means there will be almost no effect at all.

Code
float strength = distance * 300f;

You might want to change this as well. Strength equals the net change in velocity per second, and with this you'll be pulling a ship in at max speed, probably crushing them against your hull. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 20, 2013, 12:33:18 PM
You're probably having problems because you have the pull effect inside of the if (fireInterval.intervalElapsed()) block. That means it will only execute once about every 15 frames - since the velocity change from the black hole code is implemented gradually, this means there will be almost no effect at all.
Code
float strength = distance * 300f;

You might want to change this as well. Strength equals the net change in velocity per second, and with this you'll be pulling a ship in at max speed, probably crushing them against your hull. :)

Yes

and actually its making it spinning instead of crushing into the hull (it doesnt matter if it does do that, we are the borg, we couldnt care less what happens to your puny ships), i had one ship destroyed while under its effect that it literally got falcon punched out of the combat zone while spinning at a astronomical rate

How about setting depending on ship mass:
float strength = distance * (float)Math.abs((beam.getSource().getMass() - beam.getDamageTarget().getMass()));
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 20, 2013, 12:34:25 PM
Mind if I use that "movement stopper" code for Rejection? Because that would totally fit an EW-frigate!

Sure, but it needs tuning to actually not roflstomb anything regardless the hull size or velocity it has
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 20, 2013, 12:39:09 PM
and actually its making it spinning instead of crushing into the hull (it doesnt matter if it does do that, we are the borg, we couldnt care less what happens to your puny ships), i had one ship destroyed while under its effect that it literally got falcon punched out of the combat zone while spinning at a astronomical rate

Code
velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));

Why is the y velocity change being multiplied by 100 instead of amount? Since amount will usually be about 0.016, that's a significant difference in power. ;) That might be why it's spinning (the AI trying to compensate for being shoved aside).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 20, 2013, 12:41:19 PM
Goes without saying, will propably have a hefty flux buildup.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 20, 2013, 12:49:38 PM
and actually its making it spinning instead of crushing into the hull (it doesnt matter if it does do that, we are the borg, we couldnt care less what happens to your puny ships), i had one ship destroyed while under its effect that it literally got falcon punched out of the combat zone while spinning at a astronomical rate

Code
velocity.set(velocity.x + (direction.x * strength * amount), velocity.y + (direction.y * strength * 100f));

Why is the y velocity change being multiplied by 100 instead of amount? Since amount will usually be about 0.016, that's a significant difference in power. ;) That might be why it's spinning (the AI trying to compensate for being shoved aside).



ops, i was testing something, its already amount on my side not 100f, heh

Its a nice Master of Orion 2 Gyro copy perse

---

EDIT: with the ship mass vs target mass, seems to hold the enemy ship in place, still spins a little if it tries to move away (expected) but doesnt pull

EDIT 2: Also noticed that i cant change the width of the beam depending on the targets size, theres no API support for it ex:
Spoiler
(http://allforthecustomer.com/wp-content/uploads/2011/07/Tractor-Beam.jpg)
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 21, 2013, 06:44:45 AM
Ok, is it possible that the current build can't use additional backgrounds?

Turns out when you are in dev mode changes to the background appearently get scrapped. Weird.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 21, 2013, 09:57:14 AM
Ok, is it possible that the current build can't use additional backgrounds?

Turns out when you are in dev mode changes to the background appearently get scrapped. Weird.

Yeah - reason is to speed up combat loading, as - due to its size - the background is the one thing that isn't just loaded on startup, and is actually loaded from disk whenever it needs to change. A matter of a few seconds, but those add up to quite an annoyance when you're doing it all the time :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 21, 2013, 10:15:55 AM
Yeah I thought so, was really confused at first though :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Nekora on January 22, 2013, 04:54:43 AM
Regarding the spawnEmpArc() the notes say that you can target this to a specific location by passing in a custom class as the combatentity target: "@param empTargetEntity Target of the EMP arc. If it's a ship, it will randomly pick an engine nozzle/weapon to arc to. Can also pass in a custom class implementing CombatEntityAPI to visually target the EMP at a specific location (and not do any damage)."

Does anyone know a way to do this?

I was thinking allong the lines of useing addSmoothParticle(beam.getTo(), target.getVelocity(), 1f, 0f, .5f, CORE_COLOR); to create a teporary entity to target but couldnt get this to work >_<

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Erick Doe on January 22, 2013, 05:14:21 AM
Got an issue I've not been able to solve, and it has made editing ships harder since I can't use Trybolot's ship editor.

Here's the thing. I had to add in custom engines manually for the ships. I found it easier to edit the hull files manually after changing the layout of the hull text from:

Spoiler
(http://i1022.photobucket.com/albums/af343/erick_doe/Starfarer/code_01_zpsb6476261.png)
[close]

to

Spoiler
(http://i1022.photobucket.com/albums/af343/erick_doe/Starfarer/code_02_zps4642aab8.png)
[close]

Unfortunately, I don't know how to change back the layout without manually changing every little thing. Because while Starsector has no problem with my new layout, Trybolot's ship editor does.

Any help would be appreciated.

http://fractalsoftworks.com/forum/index.php?topic=2381.450
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on January 22, 2013, 05:47:41 AM
Posted a reply on your original topic
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 22, 2013, 02:38:00 PM
Me and EnderNerdcore have been trying to refine the Burst Maneuvering Jets system for a while now. It's currently the major thing preventing me from releasing a new Blackrock version. At this point, it works a lot like intended, except the system tries to bump you in a "straight east/west/north/south" direction if you use it while travelling diagonally at any decent speed. It seems like it has trouble clamping in the correct way... if that makes any sense.

The goal is still to give the ship a short, elegant burst of speed like a fish moving underwater. I half suspect that a lot of the current trouble is due to messing around with deceleration to prevent the ship from being able to change direction in a sudden jerk mid-burst, and endless attempts to get the clamping right to take the boost smoothly from full effect down to normal max speed.

Code:
Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import data.scripts.plugins.CombatUtils;
import java.lang.Math;

public class DesdinovaBurstJetsStats implements ShipSystemStatsScript {

        public CombatEntityAPI ourShip;
        public ShipAPI ship;
        public CombatEngineAPI engine;
        CombatUtils utility = new CombatUtils();
        public Math math;
       
public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
                ourShip = stats.getEntity();
                boolean fluxIsAtZero = false;               
                ship = utility.getOwner(stats);
                if (ship != null) {
                    if (ship.getFluxTracker().getFluxLevel() == 0f) { fluxIsAtZero = true; }
                }
if (state == ShipSystemStatsScript.State.OUT) {
                        if (effectLevel < 1f) {
                            stats.getMaxSpeed().modifyFlat(id, (effectLevel)*stats.getMaxSpeed().getModifiedValue()); // to slow down ship to its regular top speed while powering drive down
                            stats.getDeceleration().unmodify(id);
                           
                            //start clamping our Y velocity
                            if (ourShip.getVelocity().getY() > stats.getMaxSpeed().getBaseValue() && !fluxIsAtZero) {
                                ourShip.getVelocity().set(ourShip.getVelocity().getX(), (stats.getMaxSpeed().getModifiedValue()));
                            } else if (ourShip.getVelocity().getY() > stats.getMaxSpeed().getBaseValue() && fluxIsAtZero) {
                                ourShip.getVelocity().set(ourShip.getVelocity().getX(), (50f + stats.getMaxSpeed().getModifiedValue()));
                            }
                           
                            //start clamping our X velocity
                            if (math.abs(ourShip.getVelocity().getX()) > stats.getMaxSpeed().getBaseValue() && !fluxIsAtZero) {
                                if (ourShip.getVelocity().getX() > 0f) {
                                    ourShip.getVelocity().set((stats.getMaxSpeed().getModifiedValue()), ourShip.getVelocity().getY());
                                } else if (ourShip.getVelocity().getX() < 0f) {
                                    ourShip.getVelocity().set((-1.0f * stats.getMaxSpeed().getModifiedValue()), ourShip.getVelocity().getY());
                                }
                            } else if (math.abs(ourShip.getVelocity().getX()) > stats.getMaxSpeed().getBaseValue() && fluxIsAtZero) {
                                if (ourShip.getVelocity().getX() > 0f) {
                                ourShip.getVelocity().set((50f + stats.getMaxSpeed().getModifiedValue()), ourShip.getVelocity().getY());
                                } else if (ourShip.getVelocity().getX() < 0f) {
                                    ourShip.getVelocity().set((-1.0f * stats.getMaxSpeed().getModifiedValue() - 50f), ourShip.getVelocity().getY());
                                }
                               
                            }
                        }
} else  {
                        stats.getMaxSpeed().modifyFlat(id, 200f);
stats.getAcceleration().modifyFlat(id, 600f * effectLevel);
stats.getDeceleration().modifyMult(id, 0.2f);
stats.getTurnAcceleration().modifyFlat(id, 90f * effectLevel);
stats.getTurnAcceleration().modifyPercent(id, 200f * effectLevel);
stats.getMaxTurnRate().modifyMult(id, 2f * effectLevel);
stats.getMaxTurnRate().modifyPercent(id, 130f * effectLevel);
                }

}
public void unapply(MutableShipStatsAPI stats, String id) {
                stats.getMaxSpeed().unmodify(id); // to slow down ship to its regular top speed while powering drive down
                stats.getMaxTurnRate().unmodify(id);
                stats.getDeceleration().unmodify(id);
                stats.getMaxSpeed().unmodify(id);
                stats.getMaxTurnRate().unmodify(id);
                stats.getTurnAcceleration().unmodify(id);
                stats.getAcceleration().unmodify(id);
                stats.getDeceleration().unmodify(id);
                ourShip = stats.getEntity();
                boolean fluxIsAtZero = false;
                ship = utility.getOwner(stats);
                if (ship != null) {
                    if (ship.getFluxTracker().getFluxLevel() == 0f) { fluxIsAtZero = true; }
                }               
                if (ourShip.getVelocity().getY() >= stats.getMaxSpeed().getBaseValue() && !fluxIsAtZero) {
                    ourShip.getVelocity().set(ourShip.getVelocity().getX(), stats.getMaxSpeed().getBaseValue());
                } else if (ourShip.getVelocity().getY() >= stats.getMaxSpeed().getBaseValue() && fluxIsAtZero) {
                    ourShip.getVelocity().set(ourShip.getVelocity().getX(), (stats.getMaxSpeed().getBaseValue() + 50.0f));
                }
                if (math.abs(ourShip.getVelocity().getX()) >= stats.getMaxSpeed().getBaseValue() && !fluxIsAtZero) {
                    if (ourShip.getVelocity().getX() > 0) {
                        ourShip.getVelocity().set(stats.getMaxSpeed().getBaseValue(), ourShip.getVelocity().getY());
                    } else if (ourShip.getVelocity().getX() < 0) {
                        ourShip.getVelocity().set(-1.0f * stats.getMaxSpeed().getBaseValue(), ourShip.getVelocity().getY());
                    }
                   
                } else if (math.abs(ourShip.getVelocity().getX()) >= (stats.getMaxSpeed().getBaseValue() + 50f) && fluxIsAtZero) {
                    if (ourShip.getVelocity().getX() > 0) {
                        ourShip.getVelocity().set((stats.getMaxSpeed().getBaseValue() + 50.0f), ourShip.getVelocity().getY());
                    } else if (ourShip.getVelocity().getX() < 0) {
                        ourShip.getVelocity().set((-1.0f * stats.getMaxSpeed().getBaseValue() - 50.0f), ourShip.getVelocity().getY());
                    }
                }
               
}

public StatusData getStatusData(int index, State state, float effectLevel) {
if (index == 0) {
return new StatusData("increased engine power", false);
} else if (index == 1) {
return new StatusData("cannot decelerate", false);
}
return null;
}
}

The CSV values for the system are 0.2 chargeup, 0.2 active, 1.1 out. No clamping in the .system file. Stacks with 0-flux boost.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 03:08:09 PM
(and yes, I realize my code there could be simplified a bit, but it shouldn't change the functionality ;))
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 22, 2013, 03:14:04 PM
Cycerin: The issue there is that you're clamping X and Y independently of each other.  What you actually want to do is clamp speed, not velocity.x & velocity.y.

So, some psuedocode:
float speed = Math.sqrt( velocity.x * velocity.x + velocity.y * velocity.y );
float targetspeed = some calculation involving current speed, max speed, & deceleration - basically, what speed do you actually want to be going at right now.
float multiplier = targetspeed / speed;
velocity.x = velocity.x * multiplier;
velocity.y = velocity.y * multiplier;

You may also want to do some extra work with your fluxIsAtZero value & hard-coded zero-flux speed boost of 50 to account for possible skill perks (which can allow "zero flux" to persist up to 25% flux, and/or, cause the zero flux speed boost to be 75 instead of 50.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 03:47:56 PM
Cycerin: The issue there is that you're clamping X and Y independently of each other.  What you actually want to do is clamp speed, not velocity.x & velocity.y.

So, some psuedocode:
float speed = Math.sqrt( velocity.x * velocity.x + velocity.y * velocity.y );
float targetspeed = some calculation involving current speed, max speed, & deceleration - basically, what speed do you actually want to be going at right now.
float multiplier = targetspeed / speed;
velocity.x = velocity.x * multiplier;
velocity.y = velocity.y * multiplier;

You may also want to do some extra work with your fluxIsAtZero value & hard-coded zero-flux speed boost of 50 to account for possible skill perks (which can allow "zero flux" to persist up to 25% flux, and/or, cause the zero flux speed boost to be 75 instead of 50.)
I'll reply since I wrote a lot of that code:

We tried some of that. The problem is that there is no direct code method to clamp speed itself (you can set maxSpeed but the game does not force the ship down to that if it is over that max speed and coasting, only if the player is actively holding a direction key), so you have to deal with the Vector2f velocity in some way.

So the issue isn't that it's not working--it is working--but rather that under some conditions (triggered with diagonal movement) there is a small "bump" in a cardinal direction near the end of the system working.

Part of the problem is that from what I can tell, Starsector uses the deceleration value of a ship to determine how fast it can change its velocity vector between the X and Y directions. (as a bit of explanation, in Starsector the velocity vector X is side-to-side movement relative to the ship's heading, and Y is forward-backward movement relative to the ship's heading). So, we drop the deceleration value to prevent players from slowing down rapidly in the Y direction (you can't move forward and then stop on a dime).

Good point about the skill perks though. If we can get this last "bump" figured out, I'll also update the code. Anyone know of an easy way to do this, or does it just involve calling some character skill functions?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 22, 2013, 03:55:03 PM
We tried some of that. The problem is that there is no direct code method to clamp speed itself (you can set maxSpeed but the game does not force the ship down to that if it is over that max speed and coasting, only if the player is actively holding a direction key), so you have to deal with the Vector2f velocity in some way.

Which is why I provided pseudocode to take a vector that's specified in x and y terms, and clamp by speed.  For example, if targetspeed in the pseudocode I provided ended up at 100, then - after setting velocity.x and velocity.y - the overall speed would be 100.  (Maybe because velocity was 100,0, or 0,100, or -70.71,70.71, or any other vector with a magnitude of 100, give or take small variations due to inaccuracies in floating point calculations.)

Edit: By comparison, if you clamp by X and Y separately, then, with a target speed of 100, you'd end up with maybe 100,0, or 100,100 - in other words, when moving diagonally, you'll end up going faster than if not moving diagonally.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 22, 2013, 03:58:29 PM
Part of the problem is that from what I can tell, Starsector uses the deceleration value of a ship to determine how fast it can change its velocity vector between the X and Y directions. (as a bit of explanation, in Starsector the velocity vector X is side-to-side movement relative to the ship's heading, and Y is forward-backward movement relative to the ship's heading). So, we drop the deceleration value to prevent players from slowing down rapidly in the Y direction (you can't move forward and then stop on a dime).

That may be the problem, then, because that's not true.

1) The velocity x and y are in absolute coordinates, not relative to the facing of the ship. x is left to right and y is down to up, just like on a math graph.

2) When you set those values directly, the ship's deceleration value doesn't play into it (nor does anything else - it's just set to whatever you set it to. Well, it'll also get clamped to 600 by the engine, but that's it.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 04:06:37 PM
Part of the problem is that from what I can tell, Starsector uses the deceleration value of a ship to determine how fast it can change its velocity vector between the X and Y directions. (as a bit of explanation, in Starsector the velocity vector X is side-to-side movement relative to the ship's heading, and Y is forward-backward movement relative to the ship's heading). So, we drop the deceleration value to prevent players from slowing down rapidly in the Y direction (you can't move forward and then stop on a dime).

That may be the problem, then, because that's not true.

1) The velocity x and y are in absolute coordinates, not relative to the facing of the ship. x is left to right and y is down to up, just like on a math graph.

2) When you set those values directly, the ship's deceleration value doesn't play into it (nor does anything else - it's just set to whatever you set it to. Well, it'll also get clamped to 600 by the engine, but that's it.)
Oh, I know that about #2, which is exactly why we're doing it that way (to essentially set our own forced rapid deceleration). It seemed like this was having an influence on what was happening when the player changed which keys they were pressing during the operation of the system (such as going diagonally then switching to forward-only motion while the system was engaged).

#1 makes sense then. I had initially assumed it was in polar coordinates (angle, magnitude) but testing showed that that wasn't true. I'm not sure if that actually changes how this system works, though, since it never takes facing into account...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 04:08:44 PM
We tried some of that. The problem is that there is no direct code method to clamp speed itself (you can set maxSpeed but the game does not force the ship down to that if it is over that max speed and coasting, only if the player is actively holding a direction key), so you have to deal with the Vector2f velocity in some way.

Which is why I provided pseudocode to take a vector that's specified in x and y terms, and clamp by speed.  For example, if targetspeed in the pseudocode I provided ended up at 100, then - after setting velocity.x and velocity.y - the overall speed would be 100.  (Maybe because velocity was 100,0, or 0,100, or -70.71,70.71, or any other vector with a magnitude of 100, give or take small variations due to inaccuracies in floating point calculations.)

Edit: By comparison, if you clamp by X and Y separately, then, with a target speed of 100, you'd end up with maybe 100,0, or 100,100 - in other words, when moving diagonally, you'll end up going faster than if not moving diagonally.
Got it. While that shouldn't matter too much for our forced-deceleration clamping (it may have an effect, but it will be small), that actually might be what is wrong with our end-of-system capping (as opposed to clamping) where we make sure that the ship isn't moving faster than it should be. That actually would explain the cardinal-direction "bump".

Oversight on my part. Rusty java skills + smoking weed while doing vector calculations made me completely overlook the fact that we could end up with too much magnitude of velocity.


Now, if only velocity was being expressed in polar coordinates...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 22, 2013, 04:22:45 PM
I'd strongly suggest fixing it in both places - dealing with x and y separately is a great way to get a system that has biases either towards or against cardinal directions.

For another example, suppose you're taking a ship moving at 100,200 (actual speed ~223), and you want to reduce its speed to 100.  Simply setting velocity to 100,100 will not only not reduce the speed to 100 (it'll actually be moving at ~141), it also changes the direction in which the ship is moving.  The actual correct behavior would result in a velocity vector of roughly 45,89 - which is actually at speed ~100, and, just as important, going in the same direction as the initial vector.
(Note: values in above example rounded to nearest whole number for brevity.)

This is a slightly extreme example to make the point - but even if you're making small adjustments, you'll still get behavior that's slightly off.  For your forced deceleration clamping, for example, you might actually see something like:
100,200, clamped to speed 200: your result: 100,200; accurate result: 89.4,178.9
100,200, clamped to speed 190: your result: 100,190; accurate result: 85.0,169.9
etc.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 04:25:59 PM
That's a fair point, though those conditions are most likely to happen in the (very) small frame of time during the initial system activation while the acceleration is very high if the player is rapidly changing the directions they are trying to move in.

I suppose fixing it in one place will generate re-usable code to fix it in the other.  :)


EDIT: it's either that or I write a library to convert the whole thing to polar coordinates and back again. Harder to write at the beginning but so much easier to deal with for future systems.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 22, 2013, 04:28:38 PM
Yup!  And LazyWizard's utility library probably has functions already built to do this sort of thing for you; I just have no idea what they are because I haven't looked at it yet.

Edit: I'd avoid polar coordinates, myself.  I find them to be a bit of a nuisance - though it depends on what you're doing.  For just adjusting speed, yeah, polar saves you a call to square root; if you ever need to add two vectors, though, it's a pain and a half.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 22, 2013, 04:37:50 PM
Oversight on my part. Rusty java skills + smoking weed while doing vector calculations made me completely overlook the fact that we could end up with too much magnitude of velocity.

Let's not go there on this forum.


As far as velocity being polar vs cartesian, it's fairly simple to convert between the two with trig functions :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 06:24:19 PM
Well that makes things... rather simpler. Quick and dirty version below. Does NOT take into account player skills.


Code
                float currentSpeed = (float) math.sqrt((ourShip.getVelocity().getX() * ourShip.getVelocity().getX()) + (ourShip.getVelocity().getY() * ourShip.getVelocity().getY()));
                float desiredSpeed = stats.getMaxSpeed().getBaseValue();
                if (fluxIsAtZero) { desiredSpeed += 50f; }
                float multiplier =  desiredSpeed / currentSpeed;
                
                if (currentSpeed > desiredSpeed) {                    
                    ourShip.getVelocity().x *= multiplier;
                    ourShip.getVelocity().y *= multiplier;
                }
                  

EDIT4: that seems to do the trick. Now I just need to fetch player skills for the zero flux speed
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on January 22, 2013, 06:36:29 PM
Ah... not quite.  You'll want to add the +50 to desiredSpeed, not velocity.x and velocity.y.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 06:40:27 PM
Ah... not quite.  You'll want to add the +50 to desiredSpeed, not velocity.x and velocity.y.
Yep, just realized that in the past 30 seconds lol
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 22, 2013, 07:01:27 PM
Simpler than I thought, just had to use:

stats.getZeroFluxSpeedBoost().getModifiedValue();

and instead of comparing the flux to zero, I check that it is less than or equal to:

stats.getZeroFluxMinimumFluxLevel().getModifiedValue()


The lesson from all of this?
If your initial code is based on an incorrect assumption (in my case, that Velocity was in polar coordinates) then it's better to wipe clean and start over than to incrementally improve your code, because you'll end up with a mess.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 23, 2013, 02:44:29 PM
Thanks a lot to everyone for big help on getting this to work. It runs like a charm right now. ;D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 23, 2013, 07:14:55 PM
Hey guys, I'm getting a null pointer error in here that I'm unable to track down. I'm writing an onHit effect for a weapon shot. Basically, it deals bonus energy damage if it impacts the ship (and not its shields).

The game throws the NPE when this happens (i.e., testing against a Buffalo mk2)

The NPE from the log is here:
Code
36959 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.NullPointerException
java.lang.NullPointerException
at data.scripts.weapons.ShardOnHitEffect.onHit(ShardOnHitEffect.java:27)
at com.fs.starfarer.combat.entities.BallisticProjectile.super(Unknown Source)
at com.fs.starfarer.combat.entities.BallisticProjectile.notifyDealtDamage(Unknown Source)
at com.fs.starfarer.combat.class.super.O0OO.super(Unknown Source)
at com.fs.starfarer.combat.class.B.o00000(Unknown Source)
at com.fs.starfarer.combat.class.B.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.F.ÖÖÒ000(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

And here's the concerned area of code:

Code
public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
if (!shieldHit && target instanceof ShipAPI) {
                        particleVelocity.x = ((float) Math.random() * 10f); //give the particle a random velocity.
                        particleVelocity.y = ((float) Math.random() * 10f); //Math.random() results in a number between 0.0 and 1.0
engine.applyDamage(target, point, damageAmount, DamageType.ENERGY, empAmount, false, dealsSoftFlux, engine);
                        engine.addHitParticle(point, particleVelocity, particleSize, particleBrightness, particleDuration, particleColor);
soundToPlay.playSound(soundName, pitch, volume, point, particleVelocity);
}
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Nekora on January 23, 2013, 10:46:17 PM
Sometesting of the code shows that
Code
            particleVelocity.x = ((float) Math.random() * 10f); //give the particle a random velocity.
            particleVelocity.y = ((float) Math.random() * 10f); //Math.random() results in a number between 0.0 and 1.0

are causeing the problems. As for the corect code? not sure ill look into it.
Oh also the damage spawning line of code, you had "engine" as the source of the damage. I changed that to projectile.getSource(), dont know if that has any relevance though as it didnt fix the problem till i got rid of the .x .y lines of code.

EDIT*
After some testing i got the code to work... as for why? i dont know. Maybe its because i set up the particalVelocity vairable useing getVelocity()... not idea. Well:

heres what i used that worked without error:
Code
package data.scripts.weapons;

import java.awt.Color;

import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.DamagingProjectileAPI;
import com.fs.starfarer.api.combat.OnHitEffectPlugin;
import com.fs.starfarer.api.combat.ShipAPI;

public class ExtraHitEffect implements OnHitEffectPlugin {

public void onHit(DamagingProjectileAPI projectile, CombatEntityAPI target, Vector2f point, boolean shieldHit, CombatEngineAPI engine) {
if (!shieldHit && target instanceof ShipAPI)
{
//set vairables for the partical. Could do inside the call but will do it here
float particleSize = 15f;
float particleBrightness = 1f;
float particleDuration = 2f;
Color particleColor = new Color(85, 25, 215, 255);
Vector2f particleVelocity = projectile.getVelocity(); // Lines below were causing issues, so i replaced them for testing
                        particleVelocity.x = ((float) Math.random() * 10f); //give the particle a random velocity.
                        particleVelocity.y = ((float) Math.random() * 10f); //Math.random() results in a number between 0.0 and 1.0

//set damage vairables
float damageAmount = projectile.getDamageAmount() * .25f; //extra damage is 1/4 of full
float empAmount = projectile.getEmpAmount(); //extra emp is... well full amount of normal hit

engine.applyDamage(target, point, damageAmount, DamageType.ENERGY, empAmount, false, false, projectile.getSource());
                        engine.addHitParticle(point, particleVelocity, particleSize, particleBrightness, particleDuration, particleColor);
//soundToPlay.playSound(soundName, pitch, volume, point, particleVelocity);
}
}
}

Also, anyone able to take a look at my question earlier yet? http://fractalsoftworks.com/forum/index.php?topic=5061.msg85513#msg85513
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 23, 2013, 11:11:18 PM
Solved it. Turns out I can't just call the sound player like that. Instead, I have to use:

Global.getSoundPlayer().playSound(soundName, pitch, volume, point, projectile.getVelocity());

To use that, we have to add:

import com.fs.starfarer.api.Global;
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Nekora on January 24, 2013, 12:18:32 AM
Nice catch thereEnder nerd code, didnt even see that one. Okay heres another, trying to make a shot bounce off sheilds. i can spawn the shots by this:
Code
		if (shieldHit && target instanceof ShipAPI)
{
float angle = ((float) Math.random() * 360f) - 180f;
engine.spawnProjectile(projectile.getSource(), projectile.getWeapon(),
projectile.getWeapon().getId(), point, angle, null);
}
Now i know that i can get the location of the projectile by useing "point" and i can get the location or the target by useing target.getLocation(), but can anyone show me how to calculate the angle from point to target.getLocation()? Im asumeing theres trig involved >_<
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 24, 2013, 06:09:58 AM
Nice catch thereEnder nerd code, didnt even see that one. Okay heres another, trying to make a shot bounce off sheilds. i can spawn the shots by this:
Code
		if (shieldHit && target instanceof ShipAPI)
{
float angle = ((float) Math.random() * 360f) - 180f;
engine.spawnProjectile(projectile.getSource(), projectile.getWeapon(),
projectile.getWeapon().getId(), point, angle, null);
}
Now i know that i can get the location of the projectile by useing "point" and i can get the location or the target by useing target.getLocation(), but can anyone show me how to calculate the angle from point to target.getLocation()? Im asumeing theres trig involved >_<

Code
float angle = (float) Math.toDegrees(Vector2f.angle(point, target.getLocation());

Just a heads up, there's a bug in the current version (http://fractalsoftworks.com/forum/index.php?topic=5409.0) that causes redirected ballistic projectiles to not render correctly.

Edit: never mind, you're not redirecting, you're creating an entirely new projectile. Carry on. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 24, 2013, 06:14:36 PM
When I use:

engine.applyDamage(target, point, damageAmount, DamageType.KINETIC, empAmount, false, dealsSoftFlux, engine);

Does it just straight-up apply "damageAmount" to the ship ignoring armor and the damage type, or does it internally deal some fraction of that damage based on whether it hits armor or hull?  (I'm assuming not hitting shields, here).

The reason I ask is that I want this next line to show the amount of damage it really did:

engine.addFloatingDamageText(point, damageAmount, Color.blue, target, projectile.getSource().getMutableStats().getEntity());


EDIT: Updated the question for Kinetic since Energy always does 100% damage.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 25, 2013, 04:20:34 PM
The applyDamage will spawn the floating text if appropriate (i.e. if the target is visible, and a few other considerations). And yes, it takes armor etc into account.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on January 25, 2013, 04:28:32 PM
Quick question: is there any way to determine the render order of weapons? I've got large decorative weapons that seem to randomly overlap certain weapons.

(http://imageshack.us/a/img209/4712/avinf.jpg)

(http://imageshack.us/a/img716/3238/avclean.jpg)


As you can see, there should be two harpoon batteries in the middle there, but they're completely covered underneath the infection effects. It also seems to overlap the graviton beam hardpoints a bit as well.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 25, 2013, 04:56:19 PM
All the hardpoints get rendered before all turrets.
Within that, larger sizes get rendered last.
Within each size, racked missiles (i.e. like Harpoon, not like Swarmer) get rendered first.

After that, it's not deterministic. So, you want a small hardpoint - that won't quite take care of everything, but at least all the turrets (i.e, the stuff that moves a lot) will be over it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on January 25, 2013, 05:05:02 PM
Ah, that helps--thanks.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 25, 2013, 05:20:00 PM
The applyDamage will spawn the floating text if appropriate (i.e. if the target is visible, and a few other considerations). And yes, it takes armor etc into account.
Strange. We actually weren't seeing the floating text until we added the floating text code.

Or was it (more likely) just adding the applyDamage amount to the normal damage floating text of the weapon itself?  (basically this is bonus damage that has a chance to occur if it hits the armor or hull instead of shields).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 25, 2013, 06:32:42 PM
The applyDamage will spawn the floating text if appropriate (i.e. if the target is visible, and a few other considerations). And yes, it takes armor etc into account.
Strange. We actually weren't seeing the floating text until we added the floating text code.

Or was it (more likely) just adding the applyDamage amount to the normal damage floating text of the weapon itself?  (basically this is bonus damage that has a chance to occur if it hits the armor or hull instead of shields).

It only shows floaties for stuff damaged by the player's ship (and that is also visible). It also shows floaties for anything that already has floaties - the thinking being that it was attacked by the player recently, and floaties over it may be useful. That second behavior may explain what you're seeing.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on January 26, 2013, 03:53:21 PM
Noob question: why is this giving me "Line 516, Column 32: Expression "i" is not an rvalue"

(http://i.imgur.com/MYuFQbE.png)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 26, 2013, 05:04:49 PM
once "i" is used on the for cycle, its removed from the memory, you need to make it into the for cycle or add another integer incremental in the for cycle and use it instead
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on January 26, 2013, 05:50:23 PM
Argh, can you help me with a basic example of implementation of adding another integer incremental?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on January 26, 2013, 06:47:14 PM
Argh, can you help me with a basic example of implementation of adding another integer incremental?
use j, k, l, m, n, whatever you want. You can even name it integer1, integer2, etc
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on January 26, 2013, 06:57:20 PM
depending on what ur trying to do, why dont you just place those if(){player.setReputation} covering the for cycle
example

String[] SOV = ....
if(uscData.USC_FACTIONCHOICE.equals("SOV"))
for(int i = 0; i < SOV.length; i++)
{
player.setREP....
....
}

if i actually understood the code ur trying to implement for the starting player rep


else just declare  a few int values outside those for cycles

then inside those cycles add ++
example:

for(...)
randominteger++; or randominteger = i; or randominteger += 1;
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on January 26, 2013, 07:00:08 PM
Thanks to both. I actually use this piece of code to both set the player initial standing and the general factions relationships, so it has a "player dependent" part and a "static" part.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 27, 2013, 01:19:18 AM
Hi there,

i have 2 questions.

1. is it possible to have a script that would firstly replace the starsector_title_alpha.png and secondly randomize that with every start of starsector another title would appear?

2. The number of burst determines the times a certain sound is played when a weapon is fired, right?
Is it possible to have one fixed sound for a burst of 6 projectiles. This sound would then play only once the weapon is fired.
At the moment i have a premade sound for a burst of 6 and the game is staggering the sound 6 times and that sounds ugly.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 27, 2013, 09:47:52 AM
1. is it possible to have a script that would firstly replace the starsector_title_alpha.png and secondly randomize that with every start of starsector another title would appear?

2. The number of burst determines the times a certain sound is played when a weapon is fired, right?
Is it possible to have one fixed sound for a burst of 6 projectiles. This sound would then play only once the weapon is fired.
At the moment i have a premade sound for a burst of 6 and the game is staggering the sound 6 times and that sounds ugly.

1. No. All you can do is replace the image itself, but not dynamically via a script.

2. It's possible (using fireSoundOne - see heavymg.wpn for an example of something that plays a startup sound per burst and then individual sounds per shot). It's probably not a good idea to have all the shot sounds in the same file, though - it could desynced if the fps drops, or the gun could stop firing (due to ship being destroyed, weapon being disabled, flux running out, a vent or phase cloak being initiated, etc), but the full 6 sounds would play anyway.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 27, 2013, 10:30:43 AM
Regarding your suggestion i used fireSoundOne. The issue with this was that whenever i pressed the mousebutton it would play
the sound. On continous fire (mousebutton pressed down) it would only play the sound once and fire the weapon after the first burst in silent mode. ;)

I changed the soundfile and am using fireSoundTwo now. works like a charm

thanks.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Machine on January 27, 2013, 10:49:08 AM
Is it possible to make a weapon with a "UNIVERSAL" type?, I don't mean universal hardpoints or turrets inside a ship file, but instead on the weapon itself, so it can be used in MISSILE, ENERGY, BALLISTIC and UNIVERSAL slots.

I'm kinda trying to make a hardpoint/turret cover "weapon", as sometimes ships benefit of not having all their slot filled, but I think open slots don't look very good.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on January 27, 2013, 10:55:59 AM
Is it possible to make a weapon with a "UNIVERSAL" type?, I don't mean universal hardpoints or turrets inside a ship file, but instead on the weapon itself, so it can be used in MISSILE, ENERGY, BALLISTIC and UNIVERSAL slots.

It's not. I guess you could make covers of every type and size :) (Fun!)

I'm kinda trying to make a hardpoint/turret cover "weapon", as sometimes ships benefit of not having all their slot filled, but I think open slots don't look very good.

There's a decent chance this may end up in the game at some point. We've talked about it internally - I think the idea is good, but it's just such a low priority right now.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 28, 2013, 11:02:54 AM
I am trying to give the typing sound an 80's analog computer feeling and already have a sound ready.
The problem is there is still this little beep from the old typing sound, and i cant find it ;)

I tried the replace argument in the mod_info.json, failed for me, sound still there.

This is what i have at the moment:
sounds.json
Code
	"ui_typer_type":{ # played when text is gradually "typed out" on screen, like in the mission descriptions
"sounds":[
{"file":"sounds/TL/fx/ui/thule_ui_type01.ogg","pitch":1.0,"volume":0.3},
        ],
},
"ui_typer_buzz":{
"sounds":[
{"file":"sounds/TL/fx/ui/thule_ui_type01.ogg","pitch":0.5,"volume":0.3},
],
},

I am sure i overlook something, can somebody please tell?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 29, 2013, 03:39:50 AM
Another problem i ran into is the following.

I defined a special backgroundpicture for a single mission and it's not showing up.
I tried defining it as "background6" in the settings.json and id didnt work.

the format is .jpg, the path is correct. What could be the problem?

Code
{
"title":"Test Mission Punk Junker",
"difficulty":"HARD",
"icon":"icon.jpg",
"background":"graphics/backgrounds/background_punk.jpg"
}

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Erick Doe on January 29, 2013, 03:46:16 AM
@Thule

Is it the right size? Default Starsector backgrounds are 2048 x 2048. Not sure if that will matter though.

Is the filename all lower case, just like in the path "graphics/backgrounds/background_punk.jpg"?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 29, 2013, 03:48:12 AM
Are you in dev mode? Because other backgrounds(except the default one) will not render when in that mode.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on January 29, 2013, 04:14:30 AM
right size (2048x2048) - check
lower case - check
dev mode disabled - there it is.

wow, didnt know that. Gets you thinking...
(http://cdn.memegenerator.net/instances/400x/31612783.jpg)

Thank you guys.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 29, 2013, 04:18:22 AM
NP, I did run into that same problem a few days ago ^^
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 29, 2013, 03:13:06 PM
So, having worked through the plugin, I am going to re-ask the question about how to add a starting ship in a more concrete way, here is my current code, and it doesn't seem to work:
Code
package data.scripts.world;

import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import java.util.List;

public class IndustryCharacterCreation extends data.scripts.plugins.CharacterCreationPluginImpl {
    // Not using an enum for this because Janino doesn't support it.
    // It does, apparently, support using enums defined elsewhere - just can't compile new ones.

    private ResponseImpl OPTION1 = new ResponseImpl("Option 1");
    private ResponseImpl OPTION2 = new ResponseImpl("Option 2");
    private int stage = 0;
    private boolean isEntr = false;

    @SuppressWarnings("unchecked")
    @Override
    public List getResponses() {
        List result = super.getResponses();
        if (stage == 0) {
            result.add(OPTION1);
        } else if (stage == 1) {
            if (isEntr) {
                result.add(OPTION2);
            }
        }

        return result;
    }

    @Override
    public void submit(CharacterCreationPlugin.Response response, CharacterCreationPlugin.CharacterCreationData data) {
        super.submit(response, data);
        
        stage++;
        MutableCharacterStatsAPI stats = data.getPerson().getStats();

        if (response == OPTION1) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.getStartingCargo().getCredits().add(2000);
            isEntr = true;
        }
        if (response == OPTION2) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.addStartingShipChoice("buffalo_Standard");
            data.getStartingCargo().getCredits().add(2000f);
        }

    }

    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        super.startingShipPicked(variantId, data);

        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
        }
    }
}

Edit: Well, this is "funny". After a small light bulb lit, I tried to move the file to plugins folder instead of world, and it is now working correctly >_<. Also had to change startignShipPicked as the super class was adding unnecesarry crew and resources due to no matching ship in it.
edited code:
Code
package data.scripts.plugins;

...

    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
            return;
        }
        super.startingShipPicked(variantId, data);
    }
I'll leave the question here as there doesn't seem to be an explanation for this elsewhere.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 29, 2013, 09:29:55 PM
Well the reason your script works now is because the package points to the world folder, not the script folder, if you wanted that to be different, just change the package.

As for your question; I think the campaign holds the functions you are looking for, if I remember correctly though its pretty much the same thing as your script.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 04:36:52 AM
Well the reason your script works now is because the package points to the world folder, not the script folder, if you wanted that to be different, just change the package.

As for your question; I think the campaign holds the functions you are looking for, if I remember correctly though its pretty much the same thing as your script.
With world, are you talking about data\scripts\world (which it was pointing to) or data\world? For your answer, I was asking about adding or replacing the ship you start with, not place it in your starting fleet (if that was how you understood it, the asnwer was rather vague).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 30, 2013, 04:54:04 AM
"package data.scripts.world;" this means the script will only run in data/scripts/world, if you want it to run somewhere else eg: data/scripts/startingstuff you have to change the package ->
package data.scripts.startingstuff;

Isn't CharacterCreationPluginImpl.java the place to look for this? Since it creates your starting ship?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 05:28:20 AM
"package data.scripts.world;" this means the script will only run in data/scripts/world, if you want it to run somewhere else eg: data/scripts/startingstuff you have to change the package ->
package data.scripts.startingstuff;

Isn't CharacterCreationPluginImpl.java the place to look for this? Since it creates your starting ship?
I also did, as you can see it extends that class. The issue was that I had package data.scripts.world and it was in data\scripts\world, but didn't run. Changing it to package data.scripts.plugins and putting it in data\scripts\plugins however made it run.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on January 30, 2013, 05:39:01 AM
Since this is the offical way of creating the starting ships, I don't think there are more direct ways, was what I was trying to say ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 30, 2013, 06:55:04 AM
I also did, as you can see it extends that class. The issue was that I had package data.scripts.world and it was in data\scripts\world, but didn't run. Changing it to package data.scripts.plugins and putting it in data\scripts\plugins however made it run.

This is because data/scripts/plugins is a special folder. All scripts in this folder that implement a plugin will be automatically added to the game, and for all plugins except combat plugins (which can be added via mission definitions) this is the only way to activate them.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 07:39:48 AM
I also did, as you can see it extends that class. The issue was that I had package data.scripts.world and it was in data\scripts\world, but didn't run. Changing it to package data.scripts.plugins and putting it in data\scripts\plugins however made it run.

This is because data/scripts/plugins is a special folder. All scripts in this folder that implement a plugin will be automatically added to the game, and for all plugins except combat plugins (which can be added via mission definitions) this is the only way to activate them.
I figured it was something along those lines, but had to learn it the hard way xD. Thanks for the clarification, might help avoid similar issues in the future.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on January 30, 2013, 07:41:49 AM
How do you mod the starting player fleet? And the various explanations for each variable inside it.

Been a while....
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 08:04:13 AM
How do you mod the starting player fleet? And the various explanations for each variable inside it.

Been a while....
To be more clear, is it just the fleet you want to modify (add ships, resources, weapons, etc.) or modify/add the starting options?

I think (haven't tried) you can type this in your generator, if you just want to add extra stuff:
Code
        CargoAPI cargo = Global.getSector().getPlayerFleet().getCargo();
        cargo.addItems(CargoAPI.CargoItemType.RESOURCES, "supplies", 20);
        cargo.addMothballedShip(FleetMemberType.SHIP, "ID", null);
        cargo.addWeapons("id", 3);
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on January 30, 2013, 08:09:24 AM
Starting options :),

Like how, before the last update, you would just do it in the data/world/factions/player.faction file
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 09:15:51 AM
Starting options :),

Like how, before the last update, you would just do it in the data/world/factions/player.faction file

Okay, I'll try and break down my working example, although it doesn't do everything you can do and might not be implemented in an optimal way (but it works).

Code
package data.scripts.plugins;

import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import java.util.ArrayList;
import java.util.List;

public class IndustryCharacterCreation extends data.scripts.plugins.CharacterCreationPluginImpl {
    // Not using an enum for this because Janino doesn't support it.
    // It does, apparently, support using enums defined elsewhere - just can't compile new ones.

The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

Code
    private ResponseImpl OPTION1 = new ResponseImpl("option 1 text");
    private ResponseImpl OPTION2 = new ResponseImpl("option 2 text");
    private int stage = 0;
    private boolean isEntr = false;

Here we set up the fields we will use. ResponseImpl is from the class that we extended and if you implemented the interface then you would have to make your own (could just copy-paste it from the extended class). They are the ones that the player can choose from, though we will have to specify when they are shown in getResponses(). Aside from that we have stage as the one in the extended class is private and then a boolean as I only wanted to show the second response if the first was selected.

Code
    @SuppressWarnings("unchecked")
    @Override
    public List getResponses() {
        List result = new ArrayList();
        
        if (stage == 0) {
            result.add(OPTION1);
        } else if (stage == 1) {
            if (isEntr) {
                result.add(OPTION2);
            }
        }
        result.addAll(super.getResponses());
        return result;
    }

Before talking about this code, I want to mention that there is a method before it called getPrompt(). You will only need to override it if you need to change the amount of times the player selects a response. There is also a field called prompts that you can override if you want to change the text above options (the one asking the "questions") or change the amount of times the player selects a response.

About the code itself. The repsonses the player selects from is based of a list. This method, getResponses(), is where we create that list. We start by creating the list and then check what stage we are in. If we're in the second stage (stage == 1) then we also check if the previous choice was our first option through our field isEntr. After this we call the same method from our extended class and put the responses in the list that it returns in our list. Finally we return our list.

Code
    @Override
    public void submit(CharacterCreationPlugin.Response response, CharacterCreationPlugin.CharacterCreationData data) {
        super.submit(response, data);
        
        stage++;
        MutableCharacterStatsAPI stats = data.getPerson().getStats();

        if (response == OPTION1) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.getStartingCargo().getCredits().add(2000);
            isEntr = true;
        }
        if (response == OPTION2) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.addStartingShipChoice("buffalo_Standard");
            data.getStartingCargo().getCredits().add(2000f);
        }

    }

The next method is submit(). This method is called after a response is selected. We start with calling the same method from the extended class, in case that one of ours wasn't selected. Afterwards we increment stage by 1 and create a variable to access player stats so we won't have to type the whole thing again. Then using an if for each possible repsonse we dertermine which response was selected and do the stuff we want to if it was one of ours. To see how to increase a specific skill or apptitude look at the extended class.

Code
    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
            return;
        }
        super.startingShipPicked(variantId, data);
    }
}

b]getPrompt()[/b] will return null once stage exceeds the amount of prompts availaible. Once that happens, the player will be given a selection of ships to pick from based of the data.addStartingShipChoice(String Variantid) method. When a ship is selected, this method will be called. We have access to the same amount of information as in submit() and can thus do the same amount of things. In this case, I just add the starting resources including one from my mod. I added a return; in the if and only call the extended class method at the end, because it has an option if none of the ships it expected was picked and will add extra resources to our ship, which we are not interested in.

The end.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on January 30, 2013, 09:18:16 AM
Since when is it this complicated :O
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 09:18:49 AM
Full code of my implemention:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import java.util.ArrayList;
import java.util.List;

public class IndustryCharacterCreation extends data.scripts.plugins.CharacterCreationPluginImpl {
    // Not using an enum for this because Janino doesn't support it.
    // It does, apparently, support using enums defined elsewhere - just can't compile new ones.

    private ResponseImpl OPTION1 = new ResponseImpl("You started a company which became sucessful...");
    private ResponseImpl OPTION2 = new ResponseImpl("... and lost it all to pirates.");
    private int stage = 0;
    private boolean isEntr = false;

    @SuppressWarnings("unchecked")
    @Override
    public List getResponses() {
        List result = new ArrayList();
        
        if (stage == 0) {
            result.add(OPTION1);
        } else if (stage == 1) {
            if (isEntr) {
                result.add(OPTION2);
            }
        }
        result.addAll(super.getResponses());
        return result;
    }

    @Override
    public void submit(CharacterCreationPlugin.Response response, CharacterCreationPlugin.CharacterCreationData data) {
        super.submit(response, data);
        
        stage++;
        MutableCharacterStatsAPI stats = data.getPerson().getStats();

        if (response == OPTION1) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.getStartingCargo().getCredits().add(2000);
            isEntr = true;
        }
        if (response == OPTION2) {
            stats.addAptitudePoints(1);
            stats.addSkillPoints(2);
            data.addStartingShipChoice("buffalo_Standard");
            data.getStartingCargo().getCredits().add(2000f);
        }

    }

    @Override
    public void startingShipPicked(String variantId, CharacterCreationPlugin.CharacterCreationData data) {
        if (variantId.equals("buffalo_Standard")) {
            data.getStartingCargo().addFuel(20);
            data.getStartingCargo().addSupplies(20);
            data.getStartingCargo().addItems(CargoAPI.CargoItemType.RESOURCES, "omncompl_uncmaterial", 200);
            data.getStartingCargo().addCrew(CrewXPLevel.GREEN, 10);
            data.getStartingCargo().addMarines(2);
            return;
        }
        super.startingShipPicked(variantId, data);
    }
}

Full code of the extended class:
Code
package data.scripts.plugins;

import java.util.ArrayList;
import java.util.List;

import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.characters.CharacterCreationPlugin;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;

public class CharacterCreationPluginImpl implements CharacterCreationPlugin {

public static class ResponseImpl implements Response {
private String text;
public ResponseImpl(String text) {
this.text = text;
}
public String getText() {
return text;
}
}

// Not using an enum for this because Janino doesn't support it.
// It does, apparently, support using enums defined elsewhere - just can't compile new ones.
private ResponseImpl SUPPLY_OFFICER = new ResponseImpl("Served as a junior supply officer in an independent system's navy");
private ResponseImpl GUNNER = new ResponseImpl("Hired out as a gunner on a mercenary ship");
private ResponseImpl ENGINEER = new ResponseImpl("Found employment as an assistant engineer on an exploration vessel");
private ResponseImpl COPILOT = new ResponseImpl("Spent time as a co-pilot on a patrol ship in an independent system");
private ResponseImpl SOMETHING_ELSE_1 = new ResponseImpl("Did something else");
private ResponseImpl ADJUTANT = new ResponseImpl("Served as an adjutant in the Hegemony Navy");
private ResponseImpl QUARTERMASTER = new ResponseImpl("Performed the duties of a quartermaster on an independent warship");
private ResponseImpl HELM = new ResponseImpl("Helmed a patrol ship operating in a backwater system");
private ResponseImpl COMBAT_ENGINEER = new ResponseImpl("Took over the duties of chief combat engineer during a lengthy campaign");
private ResponseImpl SOMETHING_ELSE_2 = new ResponseImpl("Did something else");

private int stage = 0;
private String [] prompts = new String [] {
"Early in your career, you...",
"More recently, you...",
};

public String getPrompt() {
if (stage < prompts.length) return prompts[stage];
return null;
}

@SuppressWarnings("unchecked")
public List getResponses() {
List result = new ArrayList();
if (stage == 0) {
result.add(SUPPLY_OFFICER);
result.add(GUNNER);
result.add(ENGINEER);
result.add(COPILOT);
result.add(SOMETHING_ELSE_1);
} else if (stage == 1) {
result.add(ADJUTANT);
result.add(QUARTERMASTER);
result.add(HELM);
result.add(COMBAT_ENGINEER);
result.add(SOMETHING_ELSE_2);
}
return result;
}


public void submit(Response response, CharacterCreationData data) {
if (stage == 0) { // just in case
data.addStartingShipChoice("shuttle_Attack");
}

stage++;

MutableCharacterStatsAPI stats = data.getPerson().getStats();
if (response == SUPPLY_OFFICER) {
stats.increaseAptitude("leadership");
stats.increaseSkill("fleet_logistics");
stats.increaseSkill("command_experience");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == GUNNER) {
stats.increaseAptitude("combat");
stats.increaseSkill("ordnance_expert");
stats.increaseSkill("target_analysis");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == ENGINEER) {
stats.increaseAptitude("technology");
stats.increaseSkill("field_repairs");
stats.increaseSkill("mechanical_engineering");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == COPILOT) {
stats.increaseAptitude("combat");
stats.increaseSkill("helmsmanship");
stats.increaseSkill("evasive_action");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == SOMETHING_ELSE_1) {
stats.addAptitudePoints(1);
stats.addSkillPoints(2);
data.getStartingCargo().getCredits().add(1000f);
}

else if (response == ADJUTANT) {
stats.increaseAptitude("leadership");
stats.increaseSkill("fleet_logistics");
stats.increaseSkill("advanced_tactics");
data.addStartingShipChoice("lasher_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == QUARTERMASTER) {
stats.increaseAptitude("technology");
stats.increaseSkill("navigation");
stats.addSkillPoints(1);
data.addStartingShipChoice("wolf_CS");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == HELM) {
stats.increaseAptitude("combat");
stats.increaseSkill("helmsmanship");
stats.increaseSkill("evasive_action");
data.addStartingShipChoice("vigilance_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == COMBAT_ENGINEER) {
stats.increaseAptitude("combat");
stats.increaseSkill("damage_control");
stats.increaseSkill("flux_modulation");
data.addStartingShipChoice("lasher_Standard");
data.getStartingCargo().getCredits().add(3000f);
} else if (response == SOMETHING_ELSE_2) {
stats.addAptitudePoints(1);
stats.addSkillPoints(2);
data.addStartingShipChoice("hound_Assault");
data.getStartingCargo().getCredits().add(1000f);
}
}

public void startingShipPicked(String variantId, CharacterCreationData data) {
MutableCharacterStatsAPI stats = data.getPerson().getStats();
stats.addAptitudePoints(1);
stats.addSkillPoints(2);

if (variantId.equals("vigilance_Standard")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(30);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 20);
data.getStartingCargo().addMarines(5);
} else
if (variantId.equals("lasher_Standard")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 40);
data.getStartingCargo().addMarines(10);
} else
if (variantId.equals("wolf_CS")) {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 22);
data.getStartingCargo().addMarines(7);
} else
if (variantId.equals("shuttle_Attack")) {
data.getStartingCargo().addFuel(10);
data.getStartingCargo().addSupplies(10);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 10);
data.getStartingCargo().addMarines(3);
} else
if (variantId.equals("hound_Assault")) {
data.getStartingCargo().addFuel(30);
data.getStartingCargo().addSupplies(40);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 25);
data.getStartingCargo().addMarines(15);
} else {
data.getStartingCargo().addFuel(20);
data.getStartingCargo().addSupplies(20);
data.getStartingCargo().addCrew(CrewXPLevel.REGULAR, 20);
data.getStartingCargo().addMarines(10);
}
}
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 09:22:16 AM
Since when is it this complicated :O

0.54  :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 30, 2013, 09:26:09 AM
The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on January 30, 2013, 09:30:35 AM
The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Thank you for the clarification. That kinda blows :/
Do you know if character creation is called before the generators?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 30, 2013, 09:33:54 AM
The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.
Thank you for the clarification. That kinda blows :/
Do you know if character creation is called before the generators?

I'm fairly certain it is. I remember running into an issue implementing CAELUS's character creation plugin because of the run order, at least. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on January 31, 2013, 06:06:08 AM
Been trying to use the sounds.json to modify ship system sounds based on hullsize, like what is done with engine sounds and whatnot in the core game. Seems like the game refuses to run though, no matter how I format it, using the examples provided in the core json. Is this even supported right now?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on January 31, 2013, 06:11:58 AM
I'm not sure, but you could try manually playing the correct sounds in the system script using Global.getSoundPlayer() (you can check if a system is turning on, active, or turning off in the script, so AFAIK you should be able to replicate the sound settings in the .system file).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on February 04, 2013, 05:50:24 AM
Solved: Thanks to Alex for the help. The problem was caused by NetBeans including old and deleted files in the .jar. To solve this I used the Clean option and it then build the proper .jar.

Okay, I am having a really weird bug. I am not sure if I am missing something obvious or it is a bug with the game. I have tried to implement my first skill which enable you to produce more weapons and ships. The limit is calculated by passing the level to a class, called ProdInfo, when you initialize it and then you can use two methods for getting the description information. This is were things start to get weird.

The class ProdInfo is in my .jar while while the skill related files are in my mod. I first only had one method to return the string called getString(). This worked fine. I then made it to two methods, getStringTotal and getStringLevel. This resoulted in an error saying that it couldn't find method (can't remember if it specified a name). I then tried to make a getString() method returning "ProdInfo". This was now shown in the skills description. Now whatever I tell the skill to return as string, it won't show anything but "ProdInfo". I even tried to tell it to just: return "Total"; and return "Level"; directly, but it would still only show "ProdInfo".

ProdInfo was initially an inner class, but I then made it an outer class to see if that helped. All of this was tested in character creation.
Any ideas?

Edit: I tried removing the omncompl_RepairComplexEffect.java file which didn't resoult in an error. This would indicate a dublicate of sorts, but I can't find one, even when searching the whole starsector folder.

Skill effect:
Code
package data.characters.skills.scripts;

import com.fs.starfarer.api.characters.CharacterStatsSkillEffect;
import com.fs.starfarer.api.characters.MutableCharacterStatsAPI;
import data.scripts.world.ProdInfo;

public class omncompl_RepairComplexEffect implements CharacterStatsSkillEffect
{
  
    @Override
    public void apply(MutableCharacterStatsAPI stats, String id, float level)
    {
    }

    
    @Override
    public void unapply(MutableCharacterStatsAPI stats, String id)
    {
        
    }


    @Override
    public String getEffectDescription(float level)
    {
        //ProdInfo pro = new ProdInfo((int)level);
        return "Total";
    }

  
    @Override
    public String getEffectPerLevelDescription()
    {
        //ProdInfo pro = new ProdInfo(0);
        return "Level";
    }

  
    @Override
    public ScopeDescription getScopeDescription()
    {
        return ScopeDescription.ALL_OUTPOSTS;
    }
}

ProdInfo:
Code
package data.scripts.world;

import java.util.ArrayList;

public final class ProdInfo {
    ArrayList<Integer> wepAmount = new ArrayList<Integer>();
    ArrayList<Integer> shipAmount = new ArrayList<Integer>();

    public ProdInfo(int level) {
        wepAmount.add(2 * level + 2);
        wepAmount.add(1 * level + 1);
        wepAmount.add(1 * level + 1);
        wepAmount.add((int) Math.floor(0.5 * level));
        shipAmount.add((int) Math.floor(1.5 * level) + 1);
        shipAmount.add(1 * level + 1);
        shipAmount.add((int) Math.floor(2D / 3D * level));
        shipAmount.add((int) Math.floor(0.5 * level));
        shipAmount.add((int) Math.floor(2D / 7D * level));
    }

    public ProdInfo() {
        wepAmount.add(0);
        wepAmount.add(0);
        wepAmount.add(0);
        wepAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
        shipAmount.add(0);
    }

    public String getTotal() {
        return "Weapons:" + w(0) + w(1) + w(3) + ", ships:" + s(0) + s(1) + s(2) + s(3) + s(4);
    }

    public String getLevel() {
        return "Weapons: + 2 + 1 + 1/2, ships: + 1 1/2 + 1 + 2/3 + 1/2 + 2/7";
    }

    public String getString() {
        if (true) {
            return getLevel();
        }
        else {
            return getTotal();        
        }
    }

    public String w(int size) {
        return " + " + wepAmount.get(size);
    }

    public String s(int size) {
        return " + " + shipAmount.get(size);
    }
    
    
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on February 05, 2013, 02:20:54 PM
The basic stuff for setting up the rest. As was mentioned before, this needs to be in data\scripts\plugins to work properly. I have given the class its own name, so it should not overwrite anything else and potentially become incompatibly with other mods. I extend the class in starsector-core instead of implementing the interface characterCreationPlugin. I can't comment on what would be best to do, expecially in context with compatibility with other mods.

According to Alex, the game will only accept one implementation of any one type of plugin*, and it will use the first implementation it finds. Any mod that has it own character creation plugin would be incompatible with your mod.

* Except EveryFrameCombatPlugin.

A correction to this. I just accidently started Uomoz's Corvus 17 with my Frieghter Start mod and it worked. I am not sure if it is a coincidence, due to Uomoz's having the same name as the original file in starsector-core and thus overwriting it, and mine inherits from it (so it ends up inheriting Uomoz's?).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on February 05, 2013, 02:29:44 PM
A correction to this. I just accidently started Uomoz's Corvus 17 with my Frieghter Start mod and it worked. I am not sure if it is a coincidence, due to Uomoz's having the same name as the original file in starsector-core and thus overwriting it, and mine inherits from it (so it ends up inheriting Uomoz's?).

Yes. Your code extends CharacterCreationPluginImpl, and Uomoz's Corvus overwrites the vanilla version of that file, so your code would be Uomoz's character creation plugin plus whatever changes you made on top of it.

Edit: if your plugin was chosen, that is; otherwise it would just be Uomoz's Corvus chargen. I don't know exactly how loading priority is handled, but I don't think you can guarantee your plugin would be the one picked.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: gruntmaster1 on February 05, 2013, 03:17:11 PM
A correction to this. I just accidently started Uomoz's Corvus 17 with my Frieghter Start mod and it worked. I am not sure if it is a coincidence, due to Uomoz's having the same name as the original file in starsector-core and thus overwriting it, and mine inherits from it (so it ends up inheriting Uomoz's?).

Yes. Your code extends CharacterCreationPluginImpl, and Uomoz's Corvus overwrites the vanilla version of that file, so your code would be Uomoz's character creation plugin plus whatever changes you made on top of it.

Edit: if your plugin was chosen, that is; otherwise it would just be Uomoz's Corvus chargen. I don't know exactly how loading priority is handled, but I don't think you can guarantee your plugin would be the one picked.

Based on the log, loading priority is by gui name. 
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on February 07, 2013, 10:52:55 AM
What is the amount of "pushing power" the impact has on the weapons csv, based on the target mass the weapon hits.

For example the projectile has 500 impact, the target hit by it has 100 mass, what the speed this target ship will be pushed back by the impact
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Romeo_One on February 07, 2013, 11:09:13 AM
I thought that impact didn't work the way it was intended?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on February 07, 2013, 11:13:47 AM
I thought that impact didn't work the way it was intended?

It does, Test out a graviton beam on a fighter, it has 10 on the impact
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 07, 2013, 03:02:56 PM
"impact" only works for beams. It's kind of a holdover - it's nice enough for the Graviton Beam, which is why it's still in the game, but really didn't work well when applied to other weapons. Just didn't feel right.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on February 07, 2013, 03:19:30 PM
"impact" only works for beams. It's kind of a holdover - it's nice enough for the Graviton Beam, which is why it's still in the game, but really didn't work well when applied to other weapons. Just didn't feel right.

Quite what i need, for the Star Trek, thats why i asked, most of its weapons are beams
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 07, 2013, 03:51:07 PM
I can't give you an exact answer as to the "pushing power". Just have to experiment with it until it feels right. It's in the same units and scale as mass, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on February 07, 2013, 05:24:15 PM
I can't give you an exact answer as to the "pushing power". Just have to experiment with it until it feels right. It's in the same units and scale as mass, though.

So if we we're using a beam with 100 impact on a ship with 100 mass, it would "stop" moving?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 07, 2013, 05:36:53 PM
Probably not. It ends up applying a force opposite at the point of impact, but the details are quite fiddly.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 08, 2013, 06:24:59 PM
How to forcefully despawn\destroy a fleet? If I call a go_to_location_and_despawn they keep on roaming around following enemy fleets.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 08, 2013, 07:31:26 PM
Hmm. Not explicitly possible at the moment, but how about creating a location to despawn at that's really far away, as in way off the map, and then setting the fleet's location to those coordinates? As long as it's out of the range of anything to distract it, it will probably work.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 08, 2013, 07:59:55 PM
Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WhoopieMonster on February 09, 2013, 02:47:47 AM
I've search but can't seem to find anything.

How would I go about adding a description to a ship, so that it would show up in the codex?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on February 09, 2013, 03:25:37 AM
data/strings/descriptions.csv

look for the one in the core for examples on format
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WhoopieMonster on February 09, 2013, 04:01:17 AM
Thanks dude :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 09, 2013, 09:19:22 AM
Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on February 09, 2013, 11:37:04 AM
Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html

I think he was asking how to keep the reference to the fleet object outside of the method that creates it.


If all you want is to have access to the fleet in its assignment script, you can write your own implementation of Script that accepts a CampaignFleetAPI as an argument in its constructor. Something like this:

Code
package data.scripts;

import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;

public abstract class FleetScript implements Script
{
    private final CampaignFleetAPI fleet;

    public FleetScript(CampaignFleetAPI fleet)
    {
        this.fleet = fleet;
    }

    public CampaignFleetAPI getFleet()
    {
        return fleet;
    }

    public abstract void run();
}

With this, all you need to do is change the new Script() { // blah } to new FleetScript(fleet) { // blah } in your convoy file, and you'll have access to the fleet object in your run() method.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 09, 2013, 12:02:02 PM
Oh, I think you're right, I totally misread that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 09, 2013, 06:25:13 PM
Thanks Alex and LW :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vilu on February 10, 2013, 04:15:03 AM
Is it possible to have mods load up on old saves?

I'm asking because i got quite good game going on Uomoz's Corvus and would like to add Fleet Control to the mix, but don't feel like starting yet again from start :( (few too many restarts recently)


(if this has been asked and answered before, sorry that i missed it)

edit: the skills from FC add up to old save, however the planets do not.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on February 10, 2013, 10:22:12 AM
Is it possible to have mods load up on old saves?

I'm asking because i got quite good game going on Uomoz's Corvus and would like to add Fleet Control to the mix, but don't feel like starting yet again from start :( (few too many restarts recently)


(if this has been asked and answered before, sorry that i missed it)

edit: the skills from FC add up to old save, however the planets do not.

This is relevant to my interests. (https://bitbucket.org/LazyWizard/sfconsole/src/7fe506419cfef52a9700c32f6de72ee0b8a00e0f/SFConsole/data/scripts/console/commands/ActivateMod.java?at=default) :)

The mod's generator will not run if you add it to an existing game, so stations, planets, spawn points etc won't be set up. Any vanilla content that's modified by the mod might work, unless it references something that doesn't exist in the current save. In other words, a rebalance of the Tactical Laser would work, a rewrite of a vanilla spawn point that tries to tie into a mod-added economy won't.

As you've already noticed, stuff from CSVs like skills will be loaded (you might get errors if you try to put points in them), but ships won't automatically appear in stations (they might appear in vanilla fleets if the mod changes their composition). Added weapons will eventually start appearing since the vanilla convoys choose from every weapon loaded when they select cargo.

Factions are only created at the start of a new game, so you can't activate a mod's generator manually if it refers to a new faction. Station placement will also be off (if the mod tells a station to orbit at 270 degrees because that's opposite where another station spawns, it will still choose 270 degrees even if that other station is currently at 269 degrees itself).

Some mods can force themselves to activate in an old save via very hacky methods. The Respec Mod (http://fractalsoftworks.com/forum/index.php?topic=5570.0) I wrote does so. Again, this is limited to mods that don't add new factions, and the mod authors will have to implement it themselves.

tl;dr: it's complicated. ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 11, 2013, 05:18:14 AM
Yeah but it gets distracted while it stays in the center of the system roaming around. It doesen't even start to move towards the despawn location. Is there any way to fleet.setlocation in a different method then the one used to spawn the fleet? is there any way to manipulate a fleet position after it's being created, like using completion scripts?

fleet.getLocation().set(x, y);

You can do this with every method that returns a Vector2f, though how much of a good idea that is varies based on the specifics.

Here's the javadoc for Vector2f, for reference:
http://lwjgl.org/javadoc/org/lwjgl/util/vector/Vector2f.html

I think he was asking how to keep the reference to the fleet object outside of the method that creates it.


If all you want is to have access to the fleet in its assignment script, you can write your own implementation of Script that accepts a CampaignFleetAPI as an argument in its constructor. Something like this:

Code
package data.scripts;

import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;

public abstract class FleetScript implements Script
{
    private final CampaignFleetAPI fleet;

    public FleetScript(CampaignFleetAPI fleet)
    {
        this.fleet = fleet;
    }

    public CampaignFleetAPI getFleet()
    {
        return fleet;
    }

    public abstract void run();
}

With this, all you need to do is change the new Script() { // blah } to new FleetScript(fleet) { // blah } in your convoy file, and you'll have access to the fleet object in your run() method.

I created the new implementation of Script and Netbeans says it's allright, BUT, in campaign the script is not activating:

Spoiler
   private void BOSS_Spawn(StarSystemAPI system, SectorEntityToken despawn_location, String boss_base, String boss_faction, String boss_id, String boss_name, String boss_hello)   {
        SectorEntityToken base = system.getEntityByName(boss_base);
        if (EventsTimerReset == 0) {
            Global.getSector().addMessage("EVENT: " + boss_name + " is in the system! All Frequency Message incoming.", Color.YELLOW);
        }
        if (EventsTimerReset == -1) {
        Global.getSector().addMessage(boss_hello, Color.magenta);
        CampaignFleetAPI fleet = getSector().createFleet("events", boss_id);
        system.spawnFleet (base, 0, 0, fleet);
        Event_Faction_Change (boss_faction);
        event_ON = true;
        Script script = null;
        script = DespawnScript(fleet);
        fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 10, script);
        fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, despawn_location, 10);
        }
    }
    private Script DespawnScript(final CampaignFleetAPI fleet)  {                              <-------------------- ALL THIS STUFF NEVER HAPPENS
        return new UomozFleetScript(fleet) {
            public void run() {
                fleet.getLocation().set(30000, 30000);
                event_ON = false;
                EventsTimerReset = (int) (10 + (Math.random() * 6));
            }
            };
    }
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on February 11, 2013, 10:23:37 AM
Where in your code are you calling DespawnScript(fleet)?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 11, 2013, 10:38:42 AM
After the RAID_SYSTEM completion.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on February 11, 2013, 11:52:53 AM
Oh, duh, there it is. Huh. Unfortunately that's starting to stretch my Java knowledge there, I've never used a Script like that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on February 13, 2013, 12:06:01 PM
Trying to create a CharacterCreationPlugin where choices creates other (selective) choices is not working:

Spoiler
   public List getResponses() {
      List result = new ArrayList();
      if (stage == 0) {
         result.add(SUPPLY_OFFICER);
         result.add(GUNNER);
         result.add(ENGINEER);
         result.add(COPILOT);
         result.add(SOMETHING_ELSE_1);
      } else if (stage == 1) {
         result.add(ADJUTANT);
         result.add(QUARTERMASTER);
         result.add(HELM);
         result.add(COMBAT_ENGINEER);
         result.add(SOMETHING_ELSE_2);
      } else if (stage == 2) {
         result.add(SOV);
         result.add(SUP);
         result.add(PIR);
         result.add(COR);
         result.add(INV);
         result.add(NOBLOC);
                } else if (stage == 3) {
                       if (result.contains(SOV)) {
         result.add(HE);
         result.add(IF);
      } else if (result.contains(SUP)) {
         result.add(TT);
         result.add(SI);
      } else if (result.contains(PIR)) {
         result.add(PP);
         result.add(JP);
                        result.add(GD);
      } else if (result.contains(COR)) {
         result.add(BR);
         result.add(NC);
      } else if (result.contains(INV)) {
         result.add(AN);
         result.add(TL);
      } else if (result.contains(NOBLOC)) {
         result.add(AS);
      }
                        result.add(NOFAC);
      }
      return result;
[close]

The else if chain in stage 3 is not appearing in the response list in-game while NOFAC (out of the else if chain) option appears. Any ideas?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TheHappyFace on February 13, 2013, 10:08:35 PM
if you don't want to start over again you could also guess whats the worth of your fleet in credits and edit your new save to have this amount.
you would be able to rebuy most of your ships and weaponry.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on February 15, 2013, 11:40:33 AM
Is there any way to force the hit glow radius on a beam weapon? I made a custom graphic beam with a really wide sprite and the hit glow is enormous. Since beams dont have a proj file I'm not sure where to rectify this. And yes, I've tried adding glow radius and hitglow radius to the weapon file.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 15, 2013, 12:22:32 PM
Huh, could've sworn that's possible, but no, it's not - it's always 3x the width of the beam.

A really wide beam is going to have some other issues, btw, since hit detection will only be done for the middle of the beam. So, it'll look odd when it's not hitting something it's obviously overlapping, or when something that's not big enough to interrupt it, does.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on February 15, 2013, 01:29:49 PM
Well, the beam itself is narrow. It's the "corona" that necessitates the wideness.

I managed to make it look better with a much narrower beam, though, so no sweat either way. ;D Kudos for the quick answer.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: DelicateTask on February 15, 2013, 07:42:50 PM
Is there any way to force the hit glow radius on a beam weapon? I made a custom graphic beam with a really wide sprite and the hit glow is enormous. Since beams dont have a proj file I'm not sure where to rectify this. And yes, I've tried adding glow radius and hitglow radius to the weapon file.
What if you leave blank space in the sprite on either side of the beam to force it smaller? If it's always 3X the size, then making the sprite bigger, if not the actual visible part, would force the engine to scale it down.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on February 15, 2013, 09:51:23 PM
Hey guys,

for my bioships i wanted to implement a mechanic which lets age the ships.
design wise i thought the bioships would come in fixed variants depending on the actual age of the ship. The ships
would have only build-in weapons. Only hullmods and the number of vents and capacitators could be changed.
For example you could buy a newborn ship (the stats like speed, armor etc. would reflect the age of the ship although)
and after a specific time the ship would have aged enough to enter its next phase of life.

Would something like this be moddable?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on February 16, 2013, 11:46:08 AM
Hey guys,

for my bioships i wanted to implement a mechanic which lets age the ships.
design wise i thought the bioships would come in fixed variants depending on the actual age of the ship. The ships
would have only build-in weapons. Only hullmods and the number of vents and capacitators could be changed.
For example you could buy a newborn ship (the stats like speed, armor etc. would reflect the age of the ship although)
and after a specific time the ship would have aged enough to enter its next phase of life.

Would something like this be moddable?

You wouldn't be able to transfer any damage the ship had taken to the next phase and the player would need to manually re-add the vents/caps/hullmods each time it evolved; other than that, I don't see any problems with the concept.

It might be frustrating if the player has no control over when it happens, though. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on February 17, 2013, 11:48:07 AM
I wished to ask, if it is possible to render a weapon below the ship sprite ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on February 17, 2013, 12:46:30 PM
I was wondering this too. Space ships, despite the 2D nature of the game, should have to have on the bottom of them. Even just having the weapon render under the ship sprite would be good, since most of them would probably be mounted on the main body of a ship and you'd just have barrels sticking out from the bottom.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 17, 2013, 12:53:59 PM
I wished to ask, if it is possible to render a weapon below the ship sprite ?

Not possible. If you're curious as to why:
http://fractalsoftworks.com/forum/index.php?topic=2844.msg39103#msg39103
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on February 17, 2013, 01:30:50 PM
If you're curious as to why:
http://fractalsoftworks.com/forum/index.php?topic=2844.msg39103#msg39103

Not even a small missile?  :(

On a serious note - i see why its not implemented. Will have to deal with it, somehow..

Thanks Alex :)


Edit - Just, out of pure and obscene curiosity .. Do Large "Decorative" weapons render above small (missile) weapon mounts ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 17, 2013, 02:20:00 PM
Edit - Just, out of pure and obscene curiosity .. Do Large "Decorative" weapons render above small (missile) weapon mounts ?

So long as they're in a "turret" type slot, yeah. Turrets render above hardpoints, and within each type, larger weapons render later.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on February 17, 2013, 02:28:22 PM
So long as they're in a "turret" type slot, yeah. Turrets render above hardpoints, and within each type, larger weapons render later.

Please dont take it, like I want to stubornly go against "rules" at all costs, its a.. visual matter really. But basicly what I would like is to get two, what an outsider viewer would see as
"two pipes" above a rocket pod. Now.. what I thought to do was somewhere in the lines..

1) make a sprite as usual
2) the missile pad (which would be a hardpoint)
3) on top of that place a "decorative" weapon - turret, as I believe you would advice, which would merely be those two pipes and with 0° arc it would stick
in position. (and be above the missile pod)

So.. in hull codex you would see a ship, without any "weird extra stuff".. and in variant codex - the real stuff. If composed on top of each other correctly and precisly,
the result would be a "fake" perspective, as the pod in below the pipes (in my case at lower part of the frigate).

Basicly..just help the current system with a "fake" ship part, which is small, so in battle it shouldnt be noticable.

Would that work?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 17, 2013, 10:12:59 PM
Sounds like it should work. If the decorative weapon was built-in, it should even show up in the hull codex entry.

Definitely not taking it the wrong way. The link I posted above explains why *I* am not doing that or adding explicit support for it. You, on the other hand, are welcome to abuse the system in whatever ways you want :) In fact, I'm looking forward to seeing the results!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on February 18, 2013, 11:27:37 AM
In fact, I'm looking forward to seeing the results!

As you wish, though I have to say Im not pleased with how the ship sprite actually turned out,
will probabyl still swap colors around, but - everything else works, as its suposed to. :)

Spoiler
(http://oi48.tinypic.com/9hnxwp.jpg)
[close]

Spoiler
(http://oi49.tinypic.com/2w5umn7.jpg)
[close]

Spoiler
(http://oi45.tinypic.com/2nbujgk.jpg)
[close]

Spoiler
(http://oi46.tinypic.com/50l79.jpg)
[close]


If I add another vertical line on the "Wing Articulation" as I named the weapon,  (or simply-pipe) I think it wouldnt even be recongnizable, that theres an additional layer above the normal sprite at all.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: sdmike1 on February 18, 2013, 12:23:42 PM
Very cool!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MrDavidoff on February 18, 2013, 12:41:48 PM
Thank you :) Heres the "final" sprite, with the changes I proposed earlier.
As I said, with additional vertical line - an uninitiated viewer wouldnt know better.
(otherwise.. change the shading, had a leap of logic there..)

Spoiler
(http://oi48.tinypic.com/2uti6g3.jpg)
[close]

Edit - ill stop advert. right here. :p


Another question rises. I had an idea of using a "glow" from weapons to appear as..
sort of a energy barrier (for carrier hangars for example..)

However.. it doesnt show up in game, so my question is - is it possible to just use
"glow" from decorative weapons at all?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on February 18, 2013, 02:37:52 PM
Error while loading, not sure what it means. All I did to change from the past version of the mod that is working was add one weapon 'irpulser' to the .csv and a renamed clone of the normal irpulse.

Code
7197 [Thread-6] WARN  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Weapon [irpulser] from weapon_data.csv not found in store
7197 [Thread-6] WARN  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Weapon [disruptors] from weapon_data.csv not found in store
7198 [Thread-6] INFO  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Applying data from weapon_data.csv to [flarelauncher1]
7265 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.IllegalArgumentException: No enum const class com.fs.starfarer.api.combat.WeaponAPI$AIHints.36
java.lang.IllegalArgumentException: No enum const class com.fs.starfarer.api.combat.WeaponAPI$AIHints.36
at java.lang.Enum.valueOf(Enum.java:196)
at com.fs.starfarer.loading.K.super(Unknown Source)
at com.fs.starfarer.loading.WeaponSpreadsheetLoader.Ò00000(Unknown Source)
at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
at com.fs.starfarer.loading.H.super(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

Halp?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: sdmike1 on February 18, 2013, 06:01:34 PM
i THINK (that is a big think by the way :P) one or more of the weapon API hints is causing problems but i am not entirely sure
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on February 20, 2013, 08:22:12 AM
Thank you :) Heres the "final" sprite, with the changes I proposed earlier.
As I said, with additional vertical line - an uninitiated viewer wouldnt know better.
(otherwise.. change the shading, had a leap of logic there..)

Spoiler
(http://oi48.tinypic.com/2uti6g3.jpg)
[close]

Edit - ill stop advert. right here. :p


Another question rises. I had an idea of using a "glow" from weapons to appear as..
sort of a energy barrier (for carrier hangars for example..)

However.. it doesnt show up in game, so my question is - is it possible to just use
"glow" from decorative weapons at all?

Looks like part of the sprite to me, even in the first version. And yeah, no glow for decorative weapons.

Spoiler
Error while loading, not sure what it means. All I did to change from the past version of the mod that is working was add one weapon 'irpulser' to the .csv and a renamed clone of the normal irpulse.

Code
7197 [Thread-6] WARN  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Weapon [irpulser] from weapon_data.csv not found in store
7197 [Thread-6] WARN  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Weapon [disruptors] from weapon_data.csv not found in store
7198 [Thread-6] INFO  com.fs.starfarer.loading.WeaponSpreadsheetLoader  - Applying data from weapon_data.csv to [flarelauncher1]
7265 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.IllegalArgumentException: No enum const class com.fs.starfarer.api.combat.WeaponAPI$AIHints.36
java.lang.IllegalArgumentException: No enum const class com.fs.starfarer.api.combat.WeaponAPI$AIHints.36
at java.lang.Enum.valueOf(Enum.java:196)
at com.fs.starfarer.loading.K.super(Unknown Source)
at com.fs.starfarer.loading.WeaponSpreadsheetLoader.Ò00000(Unknown Source)
at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
at com.fs.starfarer.loading.H.super(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

Halp?
[close]


Right, probably something misspelled in the "hints" column in weapon_data.csv.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on February 21, 2013, 09:56:24 AM
Im been thinking of somehow add a hullmod on the Startreker mod thats on a hold up for now, the general idea would be, depending on the damage type done to ship shields, that damage would be reduced on increased, so how it works. You can add a hullmod for 0 OP that will change make your shield stronger against a certain damage type, right now on vanila theres 4 types (not including EMP) High Explosive, Kinetic, Fragmentation and Energy, so adding a possible mod that when it takes Energy damage would reduce that damage by 50%, but if it took damage from High Explosive would take additional 50% damage, this becomes even better if you can create damage types just so you could use this mechanic to a whole new level, lets see, your in a Federation ship and you usually take on Dominion ships, so being able to take more hits from POLARON damage type would be ideal, so you equip a hullmod called Polaron Shield Polarity.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on February 24, 2013, 03:15:12 AM
You wouldn't be able to transfer any damage the ship had taken to the next phase and the player would need to manually re-add the vents/caps/hullmods each time it evolved; other than that, I don't see any problems with the concept.

It might be frustrating if the player has no control over when it happens, though. :)

Thanks for anwsering.

Would there be a way to have the aging be reliant on let's say some kind of refitting.
So when a ship has reached a certain age it will be able to be refitted into the next lifephase through
a certain item or supplies?

As i wanted to implement a bio specific skilltree i wanted to add a designed flaw to the bio ships.
To reflect the fact that these ships are half sentient beings with a kind of free will it would be cool
to have a "forced" autopilot who kicks in randomly during battle and can't be cancled but with the right skill.

Would something like this be moddable?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Talkie Toaster on March 02, 2013, 03:10:42 PM
This is probably a silly question if you understand the Java structure, but my Fortran-addled mind is struggling- how would I apply a change to a mutableStat by 'default'? I'm trying to construct a hull that has a naff shield counterbalanced by a reduced overload time, which is doable with getOverloadTimeMod() in a hullmod but I'm not entirely sure how to make that a property of the vessel itself.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on March 02, 2013, 03:48:29 PM
During balance testing for Starfighter I noticed that the Command (Player-usable) variants of fighters have very different tactics than the fighters.

Will changing the Command Fighter's class from Frigate to Fighter change anything aside from the AI's tactics? Not sure if that would make them unable to be piloted by the player or not :/
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on March 02, 2013, 06:28:08 PM
So, was trying to do some balance adjustments to skills... is there any way to make a skill that adds a fixed amount of ordnance points that varies by hull size?  I can make one that, for example, adds +10 ordnance points to all ships... which is nice for frigates, but almost meaningless for capital ships.  Ideally, I'd like a skill that, at 10 ranks, adds +10/+20/+40/+80 ordnance points, to frigates / destroyers / cruisers / capital ships, respectively.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 05, 2013, 07:40:02 AM
This is probably a silly question if you understand the Java structure, but my Fortran-addled mind is struggling- how would I apply a change to a mutableStat by 'default'? I'm trying to construct a hull that has a naff shield counterbalanced by a reduced overload time, which is doable with getOverloadTimeMod() in a hullmod but I'm not entirely sure how to make that a property of the vessel itself.

The way to do that would be to write an EveryFrameCombatPlugin that applies this penalty, using ShipAPI.getHullSpec().getHullId() to figure out what ship to apply it to, and taking care to only apply it once.


During balance testing for Starfighter I noticed that the Command (Player-usable) variants of fighters have very different tactics than the fighters.

Will changing the Command Fighter's class from Frigate to Fighter change anything aside from the AI's tactics? Not sure if that would make them unable to be piloted by the player or not :/

Changing the collisionClass won't make a difference to the AI. So long as it's a ship, it'll continue using the ship AI, and not the fighter one - there's no way around that atm.

So, was trying to do some balance adjustments to skills... is there any way to make a skill that adds a fixed amount of ordnance points that varies by hull size?  I can make one that, for example, adds +10 ordnance points to all ships... which is nice for frigates, but almost meaningless for capital ships.  Ideally, I'd like a skill that, at 10 ranks, adds +10/+20/+40/+80 ordnance points, to frigates / destroyers / cruisers / capital ships, respectively.

Hmm. No way to vary it by hull size. A percentage bonus would be the best fallback, though I'm sure you'd already thought of that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on March 05, 2013, 07:58:23 AM
So, was trying to do some balance adjustments to skills... is there any way to make a skill that adds a fixed amount of ordnance points that varies by hull size?  I can make one that, for example, adds +10 ordnance points to all ships... which is nice for frigates, but almost meaningless for capital ships.  Ideally, I'd like a skill that, at 10 ranks, adds +10/+20/+40/+80 ordnance points, to frigates / destroyers / cruisers / capital ships, respectively.

Hmm. No way to vary it by hull size. A percentage bonus would be the best fallback, though I'm sure you'd already thought of that.

Dang.  That's a shame.  Even just looking at classic, we've got frigate hulls varying from 20-60 ordnance points (30-60 if we exclude freighters, 35-60 if we exclude the hound, too); I was hoping to adjust +OP skills to more evenly boost everything, rather than the current state where percentage bonuses make the best ships better, but don't do nearly as much for those ships that weren't quite as strong to start with.

Edit: Hm... Double-checking again, and - in general - larger ships tend to show less differences in ordnance points; it's mostly just frigates that have such wide variances.  Perhaps if I include a flat +10 ordnance points alongside a percentage bonus?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on March 13, 2013, 06:29:32 AM
Trying to sort out my position light decorative, everything is working perfectly, but its still shooting shredders shells, and i can't get it out of the weapon groups. how do i go about fixing this?

My "Light" file
Spoiler
Quote
{
    "id":"light",
    "specClass":"projectile",
    "type":"DECORATIVE",
    "size":"SMALL",
 
   "everyFrameEffect":"data.scripts.plugins.isHulkCheck",
 
    "turretSprite":"graphics/weapons/decorative/light00.png",
    "hardpointSprite":"graphics/weapons/decorative/light00.png",
 
    "numFrames":9,
    "frameRate":6,
    "alwaysAnimate":"true",
   
    "turretOffsets":[0, 0],
    "turretAngleOffsets":[0],
    "hardpointOffsets":[0, 0],
    "hardpointAngleOffsets":[0],
 
    "barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
    "animationType":"MUZZLE_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
    "muzzleFlashSpec":{"length":0.0,   # only used if animationType = MUZZLE_FLASH
                  "spread":10,
                  "particleSizeMin":4.0,
                  "particleSizeRange":18.0,
                  "particleDuration":0.2,
                  "particleCount":25,
                  "particleColor":[255,150,30,200]},
                  
    "projectileSpecId":"shredder_shot",  # projectile that will be fired
   "fireSoundOne":"gun_mechanicals_medium_up_whirr",
   "fireSoundTwo":"gun_medium_2",   
}
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 13, 2013, 03:04:30 PM
my turn !
im having trouble with the sound effect line in weapon codes. the file name entered dosent match the file name in the sound folder.
e.g.: in the pulse laser's weapon data, the sound effect line reads "energy_pulse" even tho the sound file that is used for this gun is "fire_beam_burst01"

so im wondering, when ill be modding my guns, what am i supposed to write on that line ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 13, 2013, 03:28:35 PM
my turn !
im having trouble with the sound effect line in weapon codes. the file name entered dosent match the file name in the sound folder.
e.g.: in the pulse laser's weapon data, the sound effect line reads "energy_pulse" even tho the sound file that is used for this gun is "fire_beam_burst01"

so im wondering, when ill be modding my guns, what am i supposed to write on that line ?

The sounds used in your weapon files and code are defined in data/config/sounds.json. If you look at this file, you'll see that it maps a key (in this case energy_pulse) to different sound files (fire_beam_burst01). So you put the key in your weapon file, and Starsector looks up what sound file is assigned to it.

Why is Starsector set up this way? Well, first of all, it means if you change your sound effect file, you only need to modify sounds.json instead of every single place that sound is used in the code. Second, you can have multiple sounds for the same key, in which case the game chooses a random sound from that list. This is very useful for repeating sounds like explosions or bullet collisions, since having the exact same sound play 30 times in a row is very noticeable. Finally, this setup means that multiple mods can add extra sounds for the same key without having conflicts.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 13, 2013, 06:36:42 PM
my turn !
im having trouble with the sound effect line in weapon codes. the file name entered dosent match the file name in the sound folder.
e.g.: in the pulse laser's weapon data, the sound effect line reads "energy_pulse" even tho the sound file that is used for this gun is "fire_beam_burst01"

so im wondering, when ill be modding my guns, what am i supposed to write on that line ?

The sounds used in your weapon files and code are defined in data/config/sounds.json. If you look at this file, you'll see that it maps a key (in this case energy_pulse) to different sound files (fire_beam_burst01). So you put the key in your weapon file, and Starsector looks up what sound file is assigned to it.

Why is Starsector set up this way? Well, first of all, it means if you change your sound effect file, you only need to modify sounds.json instead of every single place that sound is used in the code. Second, you can have multiple sounds for the same key, in which case the game chooses a random sound from that list. This is very useful for repeating sounds like explosions or bullet collisions, since having the exact same sound play 30 times in a row is very noticeable. Finally, this setup means that multiple mods can add extra sounds for the same key without having conflicts.

oooooh okay...
thanks !
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on March 13, 2013, 09:03:55 PM
How would one go about updating .csv files after an update? I only started modding at 0.54.a so I haven't had to deal with an update yet. Do I have to add any new stats from the update to each ship (assuming there are any)?


If so, do I just stick them in any old column? Or do they have to be in the same order they're on in the vanilla .csv?



/annoyingquestionvoice
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 13, 2013, 09:18:58 PM
ok, another one but very insignifiant.
in-game, in the weapon cards, under the weapon's name where it says stuff like "assault", "PD" and "no description yet"
where do i go to change that ? i cant seem to find it  ???
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 06:35:18 AM
Make this green please?
Code
	"fringeColor":[50,50,155,255],
"coreColor":[255,255,255,100],
"glowColor":[100,100,255,255],
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on March 14, 2013, 06:56:56 AM
Make this green please?
Code
	"fringeColor":[50,50,155,255],
"coreColor":[255,255,255,100],
"glowColor":[100,100,255,255],

http://www.colorpicker.com/
R G B
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 07:02:27 AM
Thanks :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 07:04:19 AM
Will someone help me turn a beam weapon into a kind of autopulse cannon please?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 14, 2013, 10:04:52 AM
Will someone help me turn a beam weapon into a kind of autopulse cannon please?

if im not wrong, you just have to go in the weapon.csv and put the charge-up at 0 and the charge-down time at something like 0.2/0.1 and burst to something like 0.2/0.3 while making sure the WPN file for your gun is a beam type instead of projectile type.

this should make a beam gun like the burst laser that shoots like a machinegun
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 02:04:07 PM
Got it sorted, How does one add portraits to the game? :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 14, 2013, 02:06:47 PM
In data/world/factions/<faction>.faction, under portraits. Add them to player.faction if you want them to be selectable at character creation.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 02:14:50 PM
In data/world/factions/<faction>.faction, under portraits. Add them to player.faction if you want them to be selectable at character creation.
Thankyou :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Pelhamds on March 14, 2013, 02:19:39 PM
In data/world/factions/<faction>.faction, under portraits. Add them to player.faction if you want them to be selectable at character creation.
Thankyou :D
Your lucky I had to look through the files to find out how to do it :( (I like Orky Portraits)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 02:54:08 PM
Haha
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 14, 2013, 02:56:53 PM
Your lucky I had to look through the files to find out how to do it :( (I like Orky Portraits)

Questions in this thread have a better-than-normal chance of being answered quickly. Since this thread has been around for a while, more modders are subscribed to new posts in it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 14, 2013, 02:59:23 PM
Is it possible to link a decorative weapon to a ship system? Because I'll be turning the Anamar in my BattleFarer forever mod to open out into it's current stage and have the outer engines engage for extra thrust. Can someone do this for me?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on March 14, 2013, 04:29:10 PM
can someone send me the SensorDishRotationEffect.java file? I can't find it on my computer...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 14, 2013, 04:31:42 PM
ok, another one but very insignifiant.
in-game, in the weapon cards, under the weapon's name where it says stuff like "assault", "PD" and "no description yet"
where do i go to change that ? i cant seem to find it  ???

i must reiterate.
help please ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on March 14, 2013, 04:33:06 PM
ok, another one but very insignifiant.
in-game, in the weapon cards, under the weapon's name where it says stuff like "assault", "PD" and "no description yet"
where do i go to change that ? i cant seem to find it  ???

i must reiterate.
help please ?

Description.csv
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 15, 2013, 04:53:46 PM
ok, another one but very insignifiant.
in-game, in the weapon cards, under the weapon's name where it says stuff like "assault", "PD" and "no description yet"
where do i go to change that ? i cant seem to find it  ???

i must reiterate.
help please ?

Description.csv

O_o
i checked that one. it merely changed a sub-title in the codex, not the weapon card itself...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on March 15, 2013, 04:57:44 PM
Quote
"light_antimatter_laser","WEAPON","A smaller version of the antiproton cannon, firing high intesity bolts in long bursts at huge distances, its high energy consumtion limits it to destroyers and above.",Assault,,

its supposed to look like this, it will say what role the weapon has and its description on the weapon when you mouse over it in refit or codex or whatever.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 15, 2013, 05:22:35 PM
Quote
"light_antimatter_laser","WEAPON","A smaller version of the antiproton cannon, firing high intesity bolts in long bursts at huge distances, its high energy consumtion limits it to destroyers and above.",Assault,,

its supposed to look like this, it will say what role the weapon has and its description on the weapon when you mouse over it in refit or codex or whatever.

well that makes it doubly strange since thats exactly what i tweaked last time and it did nothing...
oh well, if you say thats the thing, then ill just roll with it
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 17, 2013, 03:00:23 PM
Hi guys,

Is it possible to have a decorative weapon effect to be bound to engines? Like an animation for idle, acceleration, decceleration and zero flux speed buff?

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 17, 2013, 07:58:47 PM
how do weapon sounds work? I checked the directory and it doesn't match up with the ones in the file

EDIT: got it, it's in config/sounds.json
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 17, 2013, 08:23:28 PM
setting.json sounds.json *cough* defines the sound id and the actual path to the soundfile
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 17, 2013, 10:31:53 PM
Is it possible to have a decorative weapon effect to be bound to engines? Like an animation for idle, acceleration, decceleration and zero flux speed buff?

Should be possible, though reliably getting the current state of the engines (i.e. idle/accelerating/etc) may be tricky.

The only way I can think of right now would be keeping track of the velocity changes from frame to frame - which might be good enough in many cases, but will fail if there are velocity changes due to collisions.

For the zero flux speed boost, you could check that
ship.getMutableStats().getMaxSpeed().getFlatStatMod("zero_flux_boost") != null

So, you'd be doing these checks in a script attached to the decorative weapon via a "everyFrameEffect", and then playing whatever animations you need using weapon.getAnimation() and some logic to actually manage the animation frames etc.


Made note to add stuff to the API that exposes engine status directly.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 18, 2013, 03:16:56 PM
Thank you Alex for the quick reply.

Here is a concept of what i want to achieve.
(http://i.imgur.com/zpIm1fq.gif)(http://i.imgur.com/0PKDDG2.gif)
Depending on speed the Alphavalue would change and the speed of the rotation of the image.
I guess it is possible to have the decorative weapon be rendered under the actual ship sprite?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 18, 2013, 03:21:35 PM
AWESOME!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 18, 2013, 03:37:49 PM
omg thule !! this is freakin awesome !
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 18, 2013, 05:12:06 PM
Spoiler
Thank you Alex for the quick reply.

Here is a concept of what i want to achieve.
(http://i.imgur.com/zpIm1fq.gif)(http://i.imgur.com/0PKDDG2.gif)
Depending on speed the Alphavalue would change and the speed of the rotation of the image.
I guess it is possible to have the decorative weapon be rendered under the actual ship sprite?
[close]

Hm, crap. I don't think that's going to work - there's no way to render weapons under the ship sprite, nor is there a way to dynamically adjust the alpha. (Well, aside from having specific frames with differing alpha values, but that's practical for a continuous fade or some such.)

Added methods to AnimationAPI to adjust the alpha (not that that's any good in the short term). Hmm. Let me see about allowing decorative slots to render under the hull...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 18, 2013, 07:12:10 PM
is it possible to change how fast a weapon rotates while firing/on cooldown independent of default rotate speed?

I'm trying to make an "assault beam" weapon that doesn't rotate too fast while idle but can still catch up to frigs n stuff while firing
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 18, 2013, 10:05:33 PM
okie, i haz yet another question.
in the ship csv, there's a column simply named "8/6/5/4%" and i have no idea what it means. i cant figure out either since most essential stats seems to be covered in the csv anyway.

what is this black sorcery  ???
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 18, 2013, 11:31:20 PM
pretty sure it's dev hints that's not meant to be used

the forum, afaik, has found no use for it
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 19, 2013, 12:02:36 AM
Actually *does* nothing. Just a balance reminder for myself - the flux vent rate is generally 8/6/5/4% of the capacity, depending on hull size (smaller = vent faster). The value in that column is what the capacity would be if it were based solely on that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 19, 2013, 04:08:55 AM
Hmm. Let me see about allowing decorative slots to render under the hull...

Can you also do this for all weapons PLEASE :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: sdmike1 on March 19, 2013, 07:32:57 AM
Hmm. Let me see about allowing decorative slots to render under the hull...

Can you also do this for all weapons PLEASE :D
I think he said sometime or another that there was an issue with the shots rendering funky when he did that :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 19, 2013, 08:46:20 AM
is it possible to change how fast a weapon rotates while firing/on cooldown independent of default rotate speed?

I'm trying to make an "assault beam" weapon that doesn't rotate too fast while idle but can still catch up to frigs n stuff while firing

Not possible, that multiplier is both global (i.e. not per-weapon) and hardcoded.

(The game started out without that, btw. It turned out to be exceedingly annoying to have weapons turn that slowly when they're not firing. There wasn't a sweet spot where weapons both turn slowly enough for the turn rate to actually matter in-game and quickly enough to where I didn't want to break things while waiting for them to turn. Hence, faster turn rate while idle.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 21, 2013, 02:23:03 AM
shame... guess I'll have to compromise on that....

maybe I'll make it work on ammo instead of cooldown, this way it could be "idle" between shots and still work like I want

does ammo regen start ticking when the weapon is not full? Or is it like it ticks regularly and just gives u a shot when it reaches the point?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 21, 2013, 02:40:33 PM
The latter (ticks regularly), which isn't intentional and doesn't seem good. Changed so that it only starts ticking when ammo is less than full.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 21, 2013, 05:42:06 PM
oh... guess my weapon will have to wait till next version...

thanks alex :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Durandal4532 on March 22, 2013, 11:57:55 AM
So is there absolutely no way to randomize dialog?

I'd love to have people say something other than a single phrase when I met their fleets.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 22, 2013, 12:11:54 PM
So is there absolutely no way to randomize dialog?

I'd love to have people say something other than a single phrase when I met their fleets.

Would be cool if it would work like with the soundfiles, where it picks one randomly if offered multiple choices.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Durandal4532 on March 22, 2013, 12:27:56 PM
So is there absolutely no way to randomize dialog?

I'd love to have people say something other than a single phrase when I met their fleets.

Would be cool if it would work like with the soundfiles, where it picks one randomly if offered multiple choices.

Yeah!

Lacking any real ability to create sprite art, I was hoping to just plug in a gigantic amount of extra dialog to make things less same-y.

I was even thinking maybe having levels of rarity for the sayings and adding variables so that things didn't wind up obviously repeating too quickly. Maybe once every 5000, someone says "Hey, is that [playername]? We were [whatever the player selected at start]'s together! Happy trails!", but also have 10-20 stock hails that could be explained as unfamiliar people reading from a phrasebook.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 23, 2013, 04:01:42 PM
hey hey its me again, noob apprentice mod maker.

this time, the problem is with one of my weapon.

its branded as a PD weapon with 3 barrels (like the heavy autocannon), lower damage than average but much faster fire-rate. its turn rate is the same as the vulcan.

yet, unless the missile is coming dead-on the gun, they cant track them and keep lagging behind.

say a harpoon streak by the ship, the gun just keep shooting, lagging only slightly behind the missile :S
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 23, 2013, 04:08:40 PM
hey hey its me again, noob apprentice mod maker.

this time, the problem is with one of my weapon.

its branded as a PD weapon with 3 barrels (like the heavy autocannon), lower damage than average but much faster fire-rate. its turn rate is the same as the vulcan.

yet, unless the missile is coming dead-on the gun, they cant track them and keep lagging behind.

say a harpoon streak by the ship, the gun just keep shooting, lagging only slightly behind the missile :S

I think I remember someone having a similar problem a while back. If I recall correctly, you need to have the middle barrel of your gun be the first defined in the .weapon file so it uses that one to aim.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 23, 2013, 04:53:14 PM
hey hey its me again, noob apprentice mod maker.

this time, the problem is with one of my weapon.

its branded as a PD weapon with 3 barrels (like the heavy autocannon), lower damage than average but much faster fire-rate. its turn rate is the same as the vulcan.

yet, unless the missile is coming dead-on the gun, they cant track them and keep lagging behind.

say a harpoon streak by the ship, the gun just keep shooting, lagging only slightly behind the missile :S

I think I remember someone having a similar problem a while back. If I recall correctly, you need to have the middle barrel of your gun be the first defined in the .weapon file so it uses that one to aim.

ah, i thought it would be a similar oddity. but i also recall when i did those weapons, the weapon recoil didint properly animated until i put the "-" in a very specific order.
he, ill just do what you said and see what happens

edit : it just occured to me i was trying to have my PD be able to gun down salamenders. are PD supposed to be able to gun those as easily as harpoons and the like ? if no, then my PD are fine after all. if yes, then they are still lagging behind despite doing what lazywizard suggested
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on March 23, 2013, 05:05:34 PM
Target leading accuracy isn't perfect, it depends on your ship's crew level and your character's skills. Try testing with Elite crew and see if there's a difference. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 23, 2013, 05:23:34 PM
Target leading accuracy isn't perfect, it depends on your ship's crew level and your character's skills. Try testing with Elite crew and see if there's a difference. :)

yup it did. i guess that means my PDs are perfectly fine.

thanks

check the sig to try it out ;) (yeah i no, dont spam ads for my mod :P)

running the modding gauntlet up to now has really been daunting. im really scared for the campaign part. its much more stuff than what i did up to now
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 24, 2013, 01:50:04 PM
Hi guys,

i was wondering how i could specify a certain sound for the explosions of my weapons.

i guess it works like with the flak explosion sound.
the code of the shot looks like this:
Code
{
"id":"thule_light_hunker_shot",
"specClass":"projectile",
"spawnType":"BALLISTIC",
"collisionClass":"PROJECTILE_FF",
"collisionClassByFighter":"PROJECTILE_FIGHTER",
"length":20.0,
"width":4.5,
"fadeTime":0.2,
"fringeColor":[165,75,255,255],
"coreColor":[245,235,255,255],
"textureScrollSpeed":64.0,
"pixelsPerTexel":5.0,
"bulletSprite":"graphics/TL/missiles/thule_shell_medium.png",
"behaviorSpec":{"behavior":"PROXIMITY_FUSE",
"range":25,
"explosionSpec":{"duration":0.1f,
"radius":35,
"coreRadius":25, # full damage within core radius - also equal to proximity fuse range
"collisionClass":PROJECTILE_FF,
"collisionClassByFighter":PROJECTILE_FIGHTER,
"particleSizeMin":2.5,
"particleSizeRange":3.0,
"particleDuration":1,
"particleCount":100,
"particleColor":[245,235,255,255],
"sound":"thule_explosion_hunker"},
}

}

what parameters would i have to change (if possible) that it's not triggered like a PROXIMITY_FUSE rather then a normal on_hit effect.?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on March 24, 2013, 01:53:44 PM
I wish there was a more straightforward way for it,

http://fractalsoftworks.com/forum/index.php?topic=2918.0

I don't think there was a way, but the shard autocannon from BRDY does change the sound using the on_hit effect,
If it 's an alternative I think it's hardcoded.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 24, 2013, 02:03:34 PM
Okay i looked it up.

That's a shame, i made the sounds before i even checked if it was possible ;)
Coudn't find the shard autocannon from BRDY unfortunatly, is it in the latest release?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on March 24, 2013, 02:05:08 PM
It should definitely be in atleast UC 17.1 or BRDY 0.30 though if you want to use the code, I'd suggest a pm to Cycerin,  :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 24, 2013, 02:08:48 PM
hmm, the version i have are the same as you mentioned, strange.

i guess you're right about the pm then ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on March 25, 2013, 10:42:43 AM
Shouldnt it be on the plugins? I dont see anywhere else he could have placed/code them in
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 25, 2013, 11:36:16 AM
found it, and yes it's under plugins ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on March 27, 2013, 07:26:56 AM
I'm creating a (will create once i get home) slug casings animation for the Gatling, id like to ask if anyone managed to make a projectile spin once you launch it, this would make a much realistic effect on those projectiles once they are "shoot" into space. Also i intent to make this for everyone, both mods im working dont need this
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 27, 2013, 11:08:38 AM
I'm creating a (will create once i get home) slug casings animation for the Gatling, id like to ask if anyone managed to make a projectile spin once you launch it, this would make a much realistic effect on those projectiles once they are "shoot" into space. Also i intent to make this for everyone, both mods im working dont need this

sounds like a lot of work for nothing. you virtually never see the actual projectile fired when using cannons.

the idea is cool tho
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 28, 2013, 09:48:38 AM
Okay, So I'm looking to hire a weapon specialist for my Battlefarer Forever mod, As I'm useless at decorative weapons and offsets, Any takers? I really need one to get the Anamar done
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 28, 2013, 10:44:39 AM
Okay, So I'm looking to hire a weapon specialist for my Battlefarer Forever mod, As I'm useless at decorative weapons and offsets, Any takers? I really need one to get the Anamar done
what do you need the person to do exactly ?
(im asking cause my skillset is limited, but if its of use to you, id volunteer)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on March 28, 2013, 11:41:25 AM
I might be able to help, but I've got prep testing for the SAT in the coming days. :P Maybe next week, unless I'm not totally immersed in the CoH 2 beta, then I can help.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 28, 2013, 11:56:51 AM
Guys, please start another thread for that. I keep looking here to see if there's a legit question, so this is distracting.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 28, 2013, 12:35:17 PM
Oh, Okay then, I was just trying to reduce clutter
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 28, 2013, 03:14:38 PM
how does the game engine determine which part of the recoil sprite is an individual barrel? As far as I can see all the barrels are in the same image with no apparent distinction...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 28, 2013, 03:50:05 PM
how does the game engine determine which part of the recoil sprite is an individual barrel? As far as I can see all the barrels are in the same image with no apparent distinction...

thats funny, ive been wondering this myself since i started modding, altho i never got up to actually asking it.
maybe it reconize what part of the sprite is separated by transparent zones and assume different groups of colored pixels consitute a barrel
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 28, 2013, 04:04:17 PM
the offset value, 1 barrel , xy offset
2 barrels 2 xy offsets and so on
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 28, 2013, 04:07:03 PM
the offset value, 1 barrel , xy offset
2 barrels 2 xy offsets and so on

oh ? thats it ? i thought the offset were just there to indicate where the barrel ended and the projectile animation was to "appear"
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on March 28, 2013, 04:15:29 PM
hmm, on second thought you might be right, it's to late, sorry not helpful ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 28, 2013, 06:23:37 PM
No, that's right, it uses the offsets to figure out what the spacing between barrels should be, and then just slices it up vertically. If you had a triple-barreled weapon with uneven spacing, it probably wouldn't work right.

The barrels can be specified in any order, though - iirc it sorts them from left to right before figuring out where the dividing lines are.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 28, 2013, 06:30:04 PM
Is there any way to set it so decorative weapons can get damage on them? So that we can make ship parts appear damaged even if they move
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on March 28, 2013, 06:32:56 PM
My only question about the barrel recoil is there any way to have it not always shoot from right to left? Ice if you had a 4 barrel weapon in alternating with only 2 shot burst firing the outer 2 then inner 2, I've tried setting the offsets in the order of how I'd want them to to fire but the recoil does its own thing and decides right to left.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on March 28, 2013, 08:19:36 PM
I think the order matters in the order you put the weapon offset coordinates in (I uninstalled SS to get a fresh start after somehow destroying the core files, haven't gotten to time to reinstall it yet, so that's just from what I remember).  For example, if you have coordinates at {4, 4}, {4, -4}, {4, 2} and  {4, -2}, if you put it into the .wpn file in that order, that's how the barrels will fire.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on March 28, 2013, 08:26:50 PM
It doesn't work, I did try, it just offsets where the projectiles fire while the barrel mismatches, offsets don't seem to affect the order in barrel recoil.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on March 28, 2013, 08:30:59 PM
You changed the order of them, right?  I vaguely remember doing something like that with a quad barrel flak cannon early in my days of weapons making...hmm.  Guess either something change or I can't remember for shite. :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 28, 2013, 10:10:12 PM
My only question about the barrel recoil is there any way to have it not always shoot from right to left? Ice if you had a 4 barrel weapon in alternating with only 2 shot burst firing the outer 2 then inner 2, I've tried setting the offsets in the order of how I'd want them to to fire but the recoil does its own thing and decides right to left.

Looking at the heavyac.wpn file, you have:
"hardpointOffsets":[25, -5, 27, 0, 25, 5],
And it fires from right to left.

If you change it to:
"hardpointOffsets":[25, 5, 27, 0, 25, -5],
It will fire from left to right. Just verified it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on March 28, 2013, 10:46:33 PM
My only question about the barrel recoil is there any way to have it not always shoot from right to left? Ice if you had a 4 barrel weapon in alternating with only 2 shot burst firing the outer 2 then inner 2, I've tried setting the offsets in the order of how I'd want them to to fire but the recoil does its own thing and decides right to left.

Looking at the heavyac.wpn file, you have:
"hardpointOffsets":[25, -5, 27, 0, 25, 5],
And it fires from right to left.

If you change it to:
"hardpointOffsets":[25, 5, 27, 0, 25, -5],
It will fire from left to right. Just verified it.

its weird that you say that because i have two triple-barreled weapons in my mod, and they both showed huge problems if theire offset werent done from right to left.
on my biggest one, there was no recoil animation at all until i putted the right-most barrel first in the offset.

and strangely enough, on my PD one, it kept mistracking target until i putted the middle barrel first in the offset list, and it still fired right-to-left.

maybe there wa san underlying problem but i remember pretty well i was cursing for "having putted the minus on the wrong side"
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on March 28, 2013, 11:12:38 PM
Not exactly what I had in mind, I'll try elaborating

(http://i.imgur.com/KPYjQJj.png)

My original offsets were to of been
   
Code
"turretOffsets":[10, -4.5, 5, 11.5, 10, 4.5, 5,-11.5],

Starting from the middle left barrel to far right barrel, then to middle right barrel and then to far left, and repeat, it didn't work out, as it'll recoil in a right to left fashion while the projectiles were spawned in the method I wanted.

Firing Offset Pattern (projectile spawn)

xOxx
xxxO
xxOx
Oxxx

Ingame Recoil pattern (Sprite Recoil)

xxxO
xxOx
xOxx
Oxxx

Another firing pattern I tried was firing both outer barrels at the same time and then firing the middle 2.
Also unable,

OxxO
xOOx

In the end I had to settle for the only offset that matched the recoil
Code
	"turretOffsets":[5,-11.5, 10, -4.5, 10, 4.5, 5, 11.5],

If I used the reverse,
Code
	"turretOffsets":[5,11.5, 10, 4.5, 10, -4.5, 5, -11.5],
The projectiles wouldn't match up to the recoil,

Firing Offset Pattern (projectile spawn)

Oxxx
xOxx
xxOx
xxxO

Ingame Recoil pattern (Sprite Recoil)

xxxO
xxOx
xOxx
Oxxx

My only question about the barrel recoil is there any way to have it not always shoot from right to left? Ice if you had a 4 barrel weapon in alternating with only 2 shot burst firing the outer 2 then inner 2, I've tried setting the offsets in the order of how I'd want them to to fire but the recoil does its own thing and decides right to left.

Looking at the heavyac.wpn file, you have:
"hardpointOffsets":[25, -5, 27, 0, 25, 5],
And it fires from right to left.

If you change it to:
"hardpointOffsets":[25, 5, 27, 0, 25, -5],
It will fire from left to right. Just verified it.
I'm not sure if I'm doing this correctly But I just tried it on my own version and the recoil doesn't fire in the correct direction,
Code
	"turretOffsets":[20, 5, 22, 0, 20, -5],
"turretAngleOffsets":[0, 0, 0],
"hardpointOffsets":[25, 5, 27, 0, 25, -5],
"hardpointAngleOffsets":[0, 0, 0],

In the screenshots I took (by the way I was getting an OOM*? error every 5-6 screenshots consistently, with and without mods, )
The first barrel to recoil with the new offset doesn't match up,

The right most barrel recoils, but the offset is set to the leftmost barrel,
Spoiler
Firing Offset Pattern (projectile spawn)


Oxx
xOx
xxO

Ingame Recoil pattern (Sprite Recoil)

xxO
xOx
Oxx


(http://i.imgur.com/S4ZVT6q.jpg)

[close]
Spoiler
Firing Offset Pattern (projectile spawn)

Oxx
xOx
xxO


Ingame Recoil pattern (Sprite Recoil)

xxO
xOx
Oxx

(http://i.imgur.com/PaT0Nuk.jpg)

[close]


Kudos to the barrel recoil sprite splitting system on my mod weapon, I actually didn't believe it'll split the barrels seeing as there was no spacing between them, Not to bash or anything even with the above, The recoil system is more than I'd of hoped for :)
Not sure if I got the point across, but this was my best try :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 29, 2013, 08:15:20 AM
Is there any way to set it so decorative weapons can get damage on them? So that we can make ship parts appear damaged even if they move

Not at the moment, no, but I'll add it to the list of things to look at (not necessarily do). Need to decouple being damageable from capable of being disabled, though.


@FlashFrozen: Ah, thank you for clarifying, I see that now. I think I was just paying too much attention to the muzzle flash and didn't see the fact that the barrels were going in the wrong order. I blame it being late :) Anyway, this is fixed for the next release.

(What was happening is it would use the sorted barrel order for figuring out which one pick for recoil, while using unsorted order for figuring out which to fire, both using the same index. Btw, now that I've looked at it again, some detail on how the cutting is done: it'll pick the midpoint between adjacent barrels - adjacent after being sorted in a right-to-left order. So, non-uniformly-spaced barrels should work fine.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 29, 2013, 10:06:08 AM
Great, Thanks!

Guys, How do I make a kind of arc effect? That connects to a central beam from other weapons? :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 29, 2013, 10:32:03 AM
Cause I want this:
(http://i.imgur.com/YO5zkHp.png)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on March 29, 2013, 10:35:10 AM
Hmm. Try spawning EMP arcs with the API, I suppose - that's about as close as you can get.

Was it really necessary to post this here and send me a PM with the same exact thing? :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on March 29, 2013, 11:03:47 AM
I didn't know if it was possible, so if it wasn't, you could make a note :P

I would rather if it was just a case of "mini laser A begin point A" in the weapons file, with an offset as the start and a "Mini laser A end point A" desired length and rotation

Would "somehow" make it a lot easier for this sorta thing :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on March 29, 2013, 06:32:45 PM
You'll need to create a complex animation for the firing while you "Spam" the emps from the side, another great way would be to make the emp arc range very small and fast in the point where it will fire the beam to make it look like "IMMA FIRING MAH LAZOR"
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Doom101 on March 29, 2013, 10:10:20 PM
here's a question, how would i go about adding in music to the game? i dug through the files in the core, to try and learn like i did with ships and such but i got nothing. anyone willing to lend a hand?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on March 30, 2013, 01:46:11 AM
on data/config/sounds:

Quote
   "music":{
      # "source" can also be a directory
      "music_campaign":[
         {"file":"StianStark-Starfarer-Exploration_Alpha.ogg","source":"sounds/music/music.bin"}
      ],
      "music_title":[
         {"file":"StianStark-Starfarer-Exploration_Alpha.ogg","source":"sounds/music/music.bin"}
      ],
      "music_combat":[
         {"file":"battle_ambience_01_v02_loudest.ogg","source":"sounds/music/music.bin"}
      ],
   },
   

on data/sounds/music you can find the bin file it's referring to
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on April 01, 2013, 03:35:16 PM
Being the baddie I am at java, anyone know how to make a fleet spawn only once in the gen file?

      
Code
for (int i = 1; i == 1; i--)U1spawn.spawnFleet();
   

is my latest attempt but i have no idea what i'm doing anymore,
 
I've tried the line as this by itself

      
Code
U1spawn.spawnFleet();	
but it'll spew ships continuously just as if it was in a for loop above.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 01, 2013, 03:39:35 PM
Being the baddie I am at java, anyone know how to make a fleet spawn only once in the gen file?

      
Code
for (int i = 1; i == 1; i--)U1spawn.spawnFleet();
   

is my latest attempt but i have no idea what i'm doing anymore,
 
I've tried the line as this by itself

      
Code
U1spawn.spawnFleet();	
but it'll spew ships continuously just as if it was in a for loop above.

Why not a if i =! 1:

Spawnfleet
I++
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on April 01, 2013, 03:42:19 PM
It'll just readd the ships once you defeat them on the map since i think it sets i = 0 when there's none on the  map
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 01, 2013, 03:55:07 PM
It'll just readd the ships once you defeat them on the map since i think it sets i = 0 when there's none on the  map

Hmmm, message lazy wizard
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 01, 2013, 05:07:08 PM
Is there a way to deny certain events from happening in the "battle" engine, for example, weapons cant be deactivated or overloading, this is mainly to do with Star Control mod, theres no such mechanic in that game, i intent to do the same with the mod

2nd Question, mainly directed to ze verylazywizard, on your work with the black hole, im trying to make the special weapon for the Avatar, that using energy (flux) you can pull ships to your ship, without using a beam and limited to one target (probably this part is not doable) and only enemy targets. I know by increasing the radius you set on the weapon u made i can make it, the problem is, to affect only enemy ships

3rd Question, how can i change the stats of the Asteroids, so it has 1 hp and 1 armor to avoid doing catastrophic damage to ships and still get one-shot by point-defense lasers
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 01, 2013, 07:28:04 PM
Is there a way to deny certain events from happening in the "battle" engine, for example, weapons cant be deactivated or overloading, this is mainly to do with Star Control mod, theres no such mechanic in that game, i intent to do the same with the mod

Make the weapon slot hidden or decorative to make it not damageable. As far as overloading, you could have a script run every frame and call FluxTrackerAPI.stopOverload(), but that wouldn't work so well with shields - it'd make the ship more or less invulnerable.

3rd Question, how can i change the stats of the Asteroids, so it has 1 hp and 1 armor to avoid doing catastrophic damage to ships and still get one-shot by point-defense lasers

Can't.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 02, 2013, 07:22:40 AM
Alright, i guess ill have to make asteroids reaaaaaaaly rare to avoid unwanted "ramming", also anyone managed to have 2 drones deploying at the same time from 2 different directions? This is for the Dreadnought, it deployed a pair of fighters at the same time?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 02, 2013, 08:18:52 AM
I have a problem, i made two sounds for "outOfUsesSound" for a new shipsystem.
Only problem is it isnt working, no error message or anything just no sound at all. what am i missing?

Code
	"thule_hgno":{"sounds":[
{"file":"sounds/TL/fx/systems/thule_hgno01.ogg","pitch":1,"volume":0.75},
{"file":"sounds/TL/fx/systems/thule_hgno02.ogg","pitch":1,"volume":0.75},
]},
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 02, 2013, 09:46:09 AM
I have a problem, i made two sounds for "outOfUsesSound" for a new shipsystem.
Only problem is it isnt working, no error message or anything just no sound at all. what am i missing?

Code
	"thule_hgno":{"sounds":[
{"file":"sounds/TL/fx/systems/thule_hgno01.ogg","pitch":1,"volume":0.75},
{"file":"sounds/TL/fx/systems/thule_hgno02.ogg","pitch":1,"volume":0.75},
]},

im not sure i should even try helping you due to my lack of experience but why add the extra {"sounds": ? and not just directly write

Code
{"thule_hgno":[
           {"file":"sounds/TL/fx/systems/thule_hgno01.ogg","pitch":1,"volume":0.75},
           {"file":"sounds/TL/fx/systems/thule_hgno02.ogg","pitch":1,"volume":0.75},
           ],
}

also, im just comparing to vanilla code but your } was in front of the comma instead of behind on the very last line

im not sure im qualified but i wrote this while comparing it to the vanilla coding

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 02, 2013, 10:12:06 AM
@Thule: that looks right to me. Can you make sure that the sounds actually play in-game if you use them elsewhere? (i.e. point one of the weapons to use "thule_hgno" as the firing sound - just to make sure they actually play.) Conversely, you could try pointing your new "thule_hgno" sound to existing oggs that are known to work.

What I'm getting at is there's a possibility that something about the ogg doesn't work with the game. Are the sounds super short, btw? IIRC there was some issue with loading really, really small oggs, and I don't remember if it was fixed or not.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 02, 2013, 10:41:39 AM
the sound is working, just bound it to a weapon and it played in game just fine.
To be clear, i wouldn't have to specify the sound "outOfUsesSound" anywhere else besides the .system file right?

And to be clear it should play the moment the system is not active, recharging, or ist it specificly for systems that have lets say three uses per battle and i would have to use another "trigger"?

The sounds itself can be heard here, they are i would say normal in length.

https://soundcloud.com/invaderoz/thule-hgno01

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 02, 2013, 10:48:10 AM
And to be clear it should play the moment the system is not active, recharging, or ist it specificly for systems that have lets say three uses per battle and i would have to use another "trigger"?

Ah, that might be the problem. The "outOfUsesSound" plays whenever the player tries to use the system but can't because it's out of charges/ammo/whatever.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 02, 2013, 10:54:47 AM
The system itself is recharging. So "whatever" means anything system related as long as the system ist not "active". Then it should play, but it doesn't ;(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 02, 2013, 10:57:39 AM
Looking at the code: it'll play in response to an failed attempted activation (i.e. not enough ammo or flux), but NOT if it's on cooldown.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 02, 2013, 03:43:40 PM
Oh, okay, then the mystery is solved i guess.
Didn't know that. Thanks for the help
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maffo on April 03, 2013, 10:53:40 AM
i am working on my first little step into a basic mod which will hopefully add some ships to the pirate faction. But i ran into an error that i do understand, but i cant find where to fix it:

Quote
229011 [Thread-6] ERROR com.fs.starfarer.combat.D  - org.json.JSONException: Expected a ':' after a key at 6 [character 7 line 1]
org.json.JSONException: Expected a ':' after a key at 6 [character 7 line 1]
   at org.json.JSONTokener.syntaxError(JSONTokener.java:423)
   at org.json.JSONObject.<init>(JSONObject.java:208)
   at org.json.JSONObject.<init>(JSONObject.java:311)
   at com.fs.starfarer.loading.LoadingUtils.void(Unknown Source)
   at com.fs.starfarer.loading.LoadingUtils.Ö00000(Unknown Source)
   at com.fs.starfarer.loading.ShipHullSpecLoader.super(Unknown Source)
   at com.fs.starfarer.loading.ShipHullSpecLoader.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.H.super(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)

Could anyone help me?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 04, 2013, 06:32:32 AM
Syntax error at the point said at the top of that code :)

Question: How does one add a chargeup sound? :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 04, 2013, 06:40:02 AM
1. is it possible to have a script that would firstly replace the starsector_title_alpha.png and secondly randomize that with every start of starsector another title would appear?

2. The number of burst determines the times a certain sound is played when a weapon is fired, right?
Is it possible to have one fixed sound for a burst of 6 projectiles. This sound would then play only once the weapon is fired.
At the moment i have a premade sound for a burst of 6 and the game is staggering the sound 6 times and that sounds ugly.

1. No. All you can do is replace the image itself, but not dynamically via a script.

2. It's possible (using fireSoundOne - see heavymg.wpn for an example of something that plays a startup sound per burst and then individual sounds per shot). It's probably not a good idea to have all the shot sounds in the same file, though - it could desynced if the fps drops, or the gun could stop firing (due to ship being destroyed, weapon being disabled, flux running out, a vent or phase cloak being initiated, etc), but the full 6 sounds would play anyway.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 04, 2013, 06:45:12 AM
Danke! :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 04, 2013, 07:22:55 AM
Anyone got a sound file for a heavy gauss rifle charge up lasting 10 seconds
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 04, 2013, 08:51:27 AM
1. http://www.freesound.org/
2. http://audacity.sourceforge.net/
3. https://www.google.de/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&sclient=psy-ab&q=audacity%20tutorials&oq=&gs_l=&pbx=1&fp=516e8a442f24f228&ion=1&bav=on.2,or.r_qf.&bvm=bv.44770516,d.Yms&biw=950&bih=974

Try it out, it's really fun mixing sounds and adding effects ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: maffo on April 04, 2013, 12:19:57 PM
i know sprog, but which file is it? Am i missing it and does there a shipspec loader existing or is it a other file?EDIT: nvm, found it with the help of lazy.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 05, 2013, 09:51:42 AM
The file that is used to do the chargeup sound is declared as FireSoundOne

The gun firing sound is FireSoundTwo
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on April 07, 2013, 12:27:17 AM
Trying to load custom missile sound, got this error:
Code
47305 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.RuntimeException: java.io.IOException: Unable to load: sounds/starfighterfx/rocketfire1.ogg
java.lang.RuntimeException: java.io.IOException: Unable to load: sounds/starfighterfx/rocketfire1.ogg
at sound.Sound.<init>(Unknown Source)
at com.fs.starfarer.loading.H.super(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Unable to load: sounds/starfighterfx/rocketfire1.ogg
at sound.OoOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.super(Unknown Source)
... 6 more

Here's what's in sounds.json:
Code
{
"light_rocket_fire":[{"file":"sounds/starfighterfx/rocketfire1.ogg","pitch":1, "volume":0.80}],
}

First time working with sounds, used NeutrinoCorp as a reference for what to do >.>

What do?

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 07, 2013, 05:15:50 AM
Can you send me a copy of the mod as it is? I'll see if I can take a peak, check file structure etc
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 07, 2013, 07:37:43 AM
Ive been trying to get the Dreadnought hull hp to go down depending on how many drones are outside, but it seems i cant do this on the shipsystems for some reason, heres the code i got in right now:
~
Code
package data.shipsystems.scripts;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;

public class DreadnoughtFighters implements ShipSystemStatsScript {

public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
        ShipAPI ship = (ShipAPI) stats.getEntity();

        if (ship == null) {
                return;
            }

        //int HPAmountPerFighter = (int)ship.getMaxHitpoints() / 42;
        float PercPerFighter = 42 / 100; //Grab current perc

            if(ship.getDeployedDrones().isEmpty()) {
                stats.getHullRepairRatePercentPerSecond().modifyFlat(id, (ship.getDeployedDrones().size() * PercPerFighter));
            }
            else {
                stats.getHullRepairRatePercentPerSecond().modifyFlat(id, -(ship.getDeployedDrones().size() * PercPerFighter));
            }
           
}
public void unapply(MutableShipStatsAPI stats, String id) {
stats.getMaxHullRepairFraction().unmodify(id);
        stats.getHullRepairRatePercentPerSecond().unmodify(id);
}

public StatusData getStatusData(int index, State state, float effectLevel) {
if (index == 0) {
return new StatusData("Releasing Autonomous Fighters.", false);
}
return null;
}
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on April 07, 2013, 09:04:18 PM
Mmm, As a question on ship system ai priority... say I have a phase ship, with a ship system that is also phase cloak, the ai will activate both, (redundant yes)

now say that I have a modified ship system that uses the phase_cloak ai (because it's what i sorta want, a system to use when it detects projectiles and missiles, unlike flare which is strictly missile, )

Is there any way to create a way to make it use the ship system as a last ditch instead of concurrently?

I can see in the sample ai of the fast missile racks where there's logic deny it from using the system when high on flux ( I want the exact opposite; use when near critical )
As the ai's aren't public I doubt I could recreate the phase cloak ai in any way shape or form :P


Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 07, 2013, 10:30:53 PM
real quick and easy one.
how do fighters determine when to resupply ?
say a wing of 4 ships equipped with 500 rounds of autocannon and 2 harpoon each.

when will they de-engage for resupply ?
im asking cause im modding very resilient and heavily armed fighters that have a powerful main gun along with a few missiles and i wouldnt want them to prematurely de-engage to resupply theire missiles when they can still aptly fight with theire main gun .
(im worried because in this design, the missiles are only there for powerful opportunity strikes, the fighter's main automatic gun is actually the main weapon and i wouldnt want the AI to act the wrong way)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on April 08, 2013, 07:07:02 AM
They will resupply when all of their ammo is gone depending on what role they have, or when the wing as a whole has taken 50% total damage.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 08, 2013, 11:01:04 AM
They will resupply when all of their ammo is gone depending on what role they have, or when the wing as a whole has taken 50% total damage.

which fighter role should i put in the csv so that it act like i previously described ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on April 08, 2013, 04:07:37 PM
Do anyone knows what an error like this is related to?

Code
455068 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.campaign.ai.CampaignFleetAI.private.Object(Unknown Source)
   at com.fs.starfarer.campaign.fleet.CampaignFleet.advance(Unknown Source)
   at com.fs.starfarer.campaign.BaseLocation.advance(Unknown Source)
   at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
   at com.fs.starfarer.campaign.A.super(Unknown Source)
   at com.fs.starfarer.A.ÖÖÒ000(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on April 08, 2013, 04:34:17 PM
Anyone know if there's a way to have a bullet sprite with multiple frames of animation?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on April 09, 2013, 02:42:49 PM
Alrighty, 'nother question:

I'm in the process of setting up an ai for the Elysiums drive system in the hopes that it will stop crashing into things and if hit a bit of an issue.  I based the ai rather heavily off of the ai example Psiyon put together for his Fire Control system; unfortunately the proximity based nature of it seems to be causing the ai to generate false positives from asteroids and thus leads to the ai repeatedly cycling the system on and off.

I know that the Burn Drive "looks ahead" of itself when deciding whether to activate or not.  Is there, either through the default api or through lazylib, some method by which I could get the ship the check in front of itself when deciding if the system is safe to use or not?  I suspect I could probably use getDirectionalVector from lazylib, but I'm not sure how to implement such a thing.

The actual code trying to imitate a decision making process is as follows:

Spoiler
Quote
//Credit goes to Psiyon for his firecontrol AI script.

package data.shipsystems.scripts.ai;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import data.scripts.plugins.CombatUtils;
import java.util.Iterator;
import org.lazywizard.lazylib.MathUtils;
import org.lwjgl.util.vector.Vector2f;
import com.fs.starfarer.api.util.IntervalUtil;

public class ms_drivechargerai implements ShipSystemAIScript {
    private ShipSystemAPI system;
    private ShipAPI ship;
    private float sinceLast = 0f;   
    private IntervalUtil tracker = new IntervalUtil(1f, 2f);
   
    //This just initializes the script.
    @Override
    public void init(ShipAPI ship, ShipSystemAPI system, ShipwideAIFlags flags, CombatEngineAPI engine)
    {
        this.ship = ship;
        this.system = system;
    }
   
    //So here we will tell the ship how to make use of the system.
    @Override
    public void advance (float amount, Vector2f position, Vector2f collisionDanger, ShipAPI target)
    {
        tracker.advance(amount);
       
        sinceLast += amount;
        //Once the interval has elapsed...
   if (tracker.intervalElapsed()) {
            //First we check if the ship is within closing distance of a target, or imminent danger of colliding with something:
            float check_combat = 1000f;
            float check_close = 750f;
            float check_collide = 100f;
            float cutoff_chance = 0f;
            float impact_alert = 0f;
           
            //Then we set it up so that we can track ships
            int ships = 0;
            ShipAPI ship_tmp;
           
            //Now we iterate through all ships on the map
            for (Iterator iter = CombatUtils.getCombatEngine().getShips().iterator();
                iter.hasNext();)
            {
                ship_tmp = (ShipAPI) iter.next();
               
                //We can't collide with fighters, so ignore 'em
                if (ship_tmp.isFighter()) continue;
                if (ship_tmp.isHulk()) continue;
               
                if (CombatUtils.getDistance(ship_tmp, ship) <= (check_combat)) {
                       
                    ships++;
                   
                    if ((CombatUtils.getDistance(ship_tmp, ship) <= (check_close))) {
                        cutoff_chance += 1f;
                    }
               
                    if ((CombatUtils.getDistance(ship_tmp, ship) <= (check_collide))) {
                        impact_alert += 1f;
                    }
               
                    float fluxLevel = ship.getFluxTracker().getFluxLevel();
               
                    //First, lets make it so if no hostile ships are nearby, and the system isn't active, the vessel will turn on the system:
                    if (cutoff_chance <= 1 && !system.isActive() && (ships <= 3) && fluxLevel <=0.35 && ((float) Math.random() > 0.1f)) {
                        ship.useSystem();
                    }
                    //If the ship is only near a few enemies and the system is active, she has moderate chance of turning the system off:
                    else if  (cutoff_chance >= 2 && system.isActive() && (ships >= 3) && ((float) Math.random() > 0.6f)) {
                        ship.useSystem();
                    }
                    //More hostiles means the ship is more like to use the cutoff:
                    else if  (cutoff_chance >= 3 && system.isActive() && (ships >= 4) && ((float) Math.random() > 0.2f)) {
                        ship.useSystem();
                    }
                    //If there are too many ships in the area the system is too risky to use, so the ship will just shut it down period:
                    else if  (cutoff_chance >= 4 && system.isActive() && (ships >= 5)) {
                        ship.useSystem();
                    }
                    //Also, if the ships flux gets too high and the ships system is active, shut it down:
                    else if  (system.isActive() && fluxLevel >=0.85) {
                        ship.useSystem();
                    }
                    //And, for a bit of fun, if enemy ships are within the combat radius, but not too many, and flux is low enough, the ship might turn the system on:
                    else if  (cutoff_chance <= 3 &&  impact_alert == 0 && !system.isActive() && (ships <= 3) && fluxLevel >=0.35 && ((float) Math.random() > 0.8f)) {
                        ship.useSystem();
                    }
                    //Finally if the ship detects an enemy in the direction she's headed inside the collision radius, and her system is on, we'll turn it off:
                    else if  (impact_alert >= 1  && system.isActive()) {
                        ship.useSystem();
                    }
                } else { return; }
            }
        }
    }
}
[close]

The code above "functions" but is terribly finicky, as already mentioned.  In truth I'd like to cut down on the variables just to seeing if the ship is in a range where it's probably in combat or not and seeing if it's likely to collide with something if it keeps the drive online/turns it on.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 09, 2013, 04:28:51 PM
Hi guys,

Endercore provided me with a modified version of his wing teleporting system. The system in the original would check if a wing was damaged and teleport it back to the carrier where the system was installed.
The new modified one does simply teleport all deployed ships nearby the ship the system is installed. The big question is how could the system itself made more fancier, visual more pleasing as it it lacking this right now.

endercore's code:
Spoiler
Quote
package data.shipsystems.scripts;

import java.util.List;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.plugins.ShipSystemStatsScript;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import data.scripts.plugins.CombatUtils;
import org.lwjgl.util.vector.Vector2f;
import java.util.Random;


/**
 *
 * @author Ender
 */
public class Fleet_Teleporter implements ShipSystemStatsScript {

    private ShipAPI shipsapi;
    private ShipAPI final_shipsapi;
    private CombatEntityAPI combatEntity;
    private CombatEntityAPI currentShip;
    private CombatEngineAPI engine;
    private MutableShipStatsAPI eachShip;
    private boolean hasRun = false;
   
   
    public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
        CombatUtils combatEngine = new CombatUtils();
        engine = combatEngine.getCombatEngine();
       
        if (engine != null && !hasRun) {           
            if (engine.getShips() != null) {
                       
                        Random randomNum = new Random();
                        List ships = engine.getShips();  //get a list of all active ships
                        List shipList = null;
                        currentShip = stats.getEntity(); //we need our current ship so that we know who owns it
                        Vector2f location = currentShip.getLocation();
                        for (int i = 0; i < ships.size(); i++) { //now we loop through the entire list of ships
                            shipsapi = (ShipAPI) (ships.get(i)); //assign the current ship to the ShipAPI so we can give it bonuses or penalties
                            eachShip = shipsapi.getMutableStats(); //now we need something Mutable
                            combatEntity = eachShip.getEntity(); //we need to assign it as an entity as well so we can see who owns it
                           
                            //in here, we're checking to find friendly ships
                            if ((combatEntity.getOwner() == currentShip.getOwner()) && (eachShip != null) && (combatEntity != stats.getEntity())) {
                                float randomX = (randomNum.nextInt(5) - 2) * 400;
                                float randomY = (randomNum.nextInt(5) - 2) * 400;
                                shipsapi.getLocation().x = (location.x + randomX);
                                shipsapi.getLocation().y = (location.y + randomY);
                            }
                        }
                        hasRun = true;
            }           
        }
    }

   
    public void unapply(MutableShipStatsAPI stats, String id) {
      //there's nothing to unapply here, so we can leave this block of code empty
                hasRun = false;
    }
   
    public StatusData getStatusData(int index, State state, float effectLevel) {
      if (index == 0) {
         return new StatusData("Teleporting fleet to near", false); //display status message to the player
      }
      return null;
   }
}
[close]

The ship i had in mind would be this one:(http://i.imgur.com/AdWBgby.png)

Kind of a "deep diver" or long range Phase ship which could sneak behind enemy lines unharmed, teleport the deployed fleet and make its tactical retreat.
The electric thingy and the shape of the ship reminded me of some kind of portal and i guess some emp arcs spawning around or over the ship would be quite suitable.
Or would it be possible to have a decorative weapons take the part of an animation?

Maybe someone has a clue if one or all or none of the above would be possible to code?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 09, 2013, 04:31:40 PM
I just so happen to have arc emitter weapon codes and scripts :)

LazyWizard created them, and you'd have to wait until tomorrow toget them
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on April 09, 2013, 04:37:14 PM
I think some of Flash's newer weapons for Neutrino have animated projectiles, you could take a look at those.

Thule: The energy-looking things in the middle of the circle portion of the hull look like some kind of field generator, Maybe each bit would fire into the middle and cause some kind of EMP (Like, AoE EMP) to nearby ships? Just speculation, I imagine you already have a use for it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 09, 2013, 04:43:00 PM
@vinya

yeah the ship above and the energy looking things in the middle where supposed to match the shipsystems teleporting ability by spawning "visual" emp arcs.
I thought i already made that clear in my text, but i guess not. Sorry for that as english is not my first language ;) but thanks for the input anyway, and i had quite the same in mind
as i made the ship some time ago.

@sprog
Thanks buddy. i guess you wouldnt be able to combine your lazy wizard code with the one endercore created? ^^
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 09, 2013, 05:59:24 PM
I have a couple of questions that I've been wondering about, but Im not really a programmer.

Is there any way to create a projectile that impacts other projectiles? Or at the very least, a missile that doesnt get targeted by PD?

Also, I'd like to know if there is a way to create a projectile that is able to penetrate multiple targets.

Any answers, even "No", would be greatly appreciated.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 09, 2013, 06:10:05 PM
I have a couple of questions that I've been wondering about, but Im not really a programmer.

Is there any way to create a projectile that impacts other projectiles? Or at the very least, a missile that doesnt get targeted by PD?

Also, I'd like to know if there is a way to create a projectile that is able to penetrate multiple targets.

Any answers, even "No", would be greatly appreciated.

what do you mean "a projectile that impacts other projectile ?"
and im pretty sure PDs are hardwired to shoot at missile, its kindof part of the balance mechanism versus missiles. i mean, your missile will become way too strong if its homing and cant be hit by PDs, and if its not homing and youre worried about PDs, then why even make it a missile ?

also, i recall seeing a mod somewhere on another forum of starsector that had a penetrating mechanism, but that was done with modding illegally so of the code
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on April 09, 2013, 06:22:57 PM
I think some of Flash's newer weapons for Neutrino have animated projectiles, you could take a look at those.

Well, I've given it a look-see and it seems like Flash managed to spoof projectile animations by cunningly using MIRV styled missiles for his projectiles; literally spawning the next frame of animation through the projectile mechanics.

Cunning.  Not sure how applicable it'll be, but quite clever.  At the very least it's given me some ideas.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 09, 2013, 06:31:58 PM
Actually, the emitter just targets the closest weapon with the Id you set it in the script, that will allow you to create a central "weapon" that the arcs can aim at to give that awesome portal look
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 09, 2013, 06:44:11 PM

what do you mean "a projectile that impacts other projectile ?"
and im pretty sure PDs are hardwired to shoot at missile, its kindof part of the balance mechanism versus missiles. i mean, your missile will become way too strong if its homing and cant be hit by PDs, and if its not homing and youre worried about PDs, then why even make it a missile ?

also, i recall seeing a mod somewhere on another forum of starsector that had a penetrating mechanism, but that was done with modding illegally so of the code

Well, what I meant was a projectile that can impact other projectiles like a missile does. I wasn't sure if there was something I could do with the Collision Class string in the proj file. Im looking to make a weapon that is used to destroy enemy projectiles, either by firing a large projectile, or an array of smaller ones.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 09, 2013, 06:48:25 PM
I know what you mean, like how to ballistic weapons can't intersect, correct? But a missile can hit another missile, and ballistic can hit missile
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 09, 2013, 06:51:00 PM
Exactly
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 09, 2013, 07:18:51 PM
Ah, I see. Well you COULD just set up a bunch of missile weapons to mimic ballistics xD
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 09, 2013, 07:36:15 PM
Wouldnt PD attack the projectile then? That would look wierd havinga giant shockwave getting shot at by PD lasers ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 09, 2013, 07:47:18 PM
Wouldnt PD attack the projectile then? That would look wierd havinga giant shockwave getting shot at by PD lasers ;)

Shock waves? Doesn't Uozmoz Corvus have a ship in it that creates a huge shock wave? Causing all ships, ballistic and missiles to bounce away
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 09, 2013, 08:19:04 PM
I haven't seen any ship that creates a shockwave in UC.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: EnderNerdcore on April 09, 2013, 09:33:46 PM
Wouldnt PD attack the projectile then? That would look wierd havinga giant shockwave getting shot at by PD lasers ;)

Shock waves? Doesn't Uozmoz Corvus have a ship in it that creates a huge shock wave? Causing all ships, ballistic and missiles to bounce away
You're thinking of the gravity system on the capital ship in Blackrock Drive Yards, but it doesn't do that, it just slows ballistics and missiles down (unless there is something else like it)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 09, 2013, 10:05:48 PM
Wouldnt PD attack the projectile then? That would look wierd havinga giant shockwave getting shot at by PD lasers ;)

Shock waves? Doesn't Uozmoz Corvus have a ship in it that creates a huge shock wave? Causing all ships, ballistic and missiles to bounce away
You're thinking of the gravity system on the capital ship in Blackrock Drive Yards, but it doesn't do that, it just slows ballistics and missiles down (unless there is something else like it)

i know thule's been working on the herzog new system, the heimdall generator that basicly does a huge shockwave
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 10, 2013, 03:25:23 AM
The shockwave system is on the Vatican Mk IV from the Valkyrians mod. The code is being reused for Thule's new system. :)

Also, I'd like to know if there is a way to create a projectile that is able to penetrate multiple targets.

also, i recall seeing a mod somewhere on another forum of starsector that had a penetrating mechanism, but that was done with modding illegally so of the code

That would be xangle13's armor penetration system (http://fractalsoftworks.com/forum/index.php?topic=5819.0), and it's actually implemented entirely within the API. Unfortunately it works by spawning a new projectile every frame there is a hit, so weapon ranges get really messed up.

I've had some luck making true armor piercing rounds by giving projectiles the CollisionClass NONE and using an EveryFrameCombatPlugin to handle collision checks/damage myself. I can polish up that code and release it if you want. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 10, 2013, 06:55:35 AM
The shockwave system is on the Vatican Mk IV from the Valkyrians mod. The code is being reused for Thule's new system. :)

That would be xangle13's armor penetration system (http://fractalsoftworks.com/forum/index.php?topic=5819.0), and it's actually implemented entirely within the API. Unfortunately it works by spawning a new projectile every frame there is a hit, so weapon ranges get really messed up.

I've had some luck making true armor piercing rounds by giving projectiles the CollisionClass NONE and using an EveryFrameCombatPlugin to handle collision checks/damage myself. I can polish up that code and release it if you want. :)

I appreciate the offer, but I dont know the first thing about coding, and I wouldn't know how to implement such code. Makes me wish I had a better C++ teacher back in high school who wasn't teaching out of C++ for dummies :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 10, 2013, 06:59:19 AM
No worries, all you need to do is add a single line to the plugin and it does all the work. :)

Example:
Code
        // Projectile ID (String), pierces shields (boolean)
        PROJ_IDS.put("impaler_shot", false);
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 10, 2013, 07:18:44 AM
Well, Im still working on sprites and such, so theres no rush at all. But if it get implimented in LazyLib, I know I'll use it :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on April 14, 2013, 07:05:39 PM
not sure how the weapon.getId() works

does it return the id, display name, or something else?

so for example, if I get a mining blaster to call that, what's the return gonna be?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 15, 2013, 05:18:05 AM
not sure how the weapon.getId() works

does it return the id, display name, or something else?

so for example, if I get a mining blaster to call that, what's the return gonna be?

The number id on the CSV weapon_data, as a String
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on April 15, 2013, 10:36:21 AM
So I'm working on a system or two for custom ships, not sure how to go about it though.

Essentially the system just allows PD Lasers all over the ship to actually fire while locking other weapon systems.

If possible, the PD matrix should be able to replace shields like phase-tech, but if not it should disable shields.

The other system is an ECM Jamming system that while turned on, any missiles locked onto the ship will lose tracking, and any missiles fired at the ship will lose tracking. Possible by using invisible flares?

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 15, 2013, 10:51:10 AM
So I'm working on a system or two for custom ships, not sure how to go about it though.

Essentially the system just allows PD Lasers all over the ship to actually fire while locking other weapon systems.

If possible, the PD matrix should be able to replace shields like phase-tech, but if not it should disable shields.

The other system is an ECM Jamming system that while turned on, any missiles locked onto the ship will lose tracking, and any missiles fired at the ship will lose tracking. Possible by using invisible flares?



considering some of the ship systems cycerin got into his mod (the nevermore and the kurmaraja especially) i'd say that you just need to find a talented coder to get all those awesome ideas working perfectly
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on April 15, 2013, 09:02:14 PM
is there a way of hiding decorative weapons from the grouping bug? Or are we just waiting on a fix at this point?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 19, 2013, 11:55:33 AM
Is there a way to grab the event of a ship being destroyed? I need to make a passive system that "revives" a ship once its turned into a hulk
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 19, 2013, 11:57:56 AM
is there a way of hiding decorative weapons from the grouping bug? Or are we just waiting on a fix at this point?

Waiting for a fix.

Is there a way to grab the event of a ship being destroyed? I need to make a passive system that "revives" a ship once its turned into a hulk

Yeah, you could iterate through ships every frame and detect when isHulk() starts returning true. There's no way to revive a ship, though. Not that I can think of, anyway.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 19, 2013, 12:03:17 PM

Is there a way to grab the event of a ship being destroyed? I need to make a passive system that "revives" a ship once its turned into a hulk

Yeah, you could iterate through ships every frame and detect when isHulk() starts returning true. There's no way to revive a ship, though. Not that I can think of, anyway.

Well, maybe if the ships hp are about to reach 0 or lower then 0, trying to find a way to replicate the Fury http://wiki.uqm.stack.nl/Fury special ability
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 19, 2013, 01:43:06 PM

Is there a way to grab the event of a ship being destroyed? I need to make a passive system that "revives" a ship once its turned into a hulk

Yeah, you could iterate through ships every frame and detect when isHulk() starts returning true. There's no way to revive a ship, though. Not that I can think of, anyway.

Well, maybe if the ships hp are about to reach 0 or lower then 0, trying to find a way to replicate the Fury http://wiki.uqm.stack.nl/Fury special ability

You could try spawning the same ship again, something like the following:
Code
        engine.getFleetManager((ship.getOwner() == 0 ? FleetSide.PLAYER : FleetSide.ENEMY))
                .spawnShipOrWing(ship.getHullSpec().getHullId(),
                ship.getLocation(), ship.getFacing());
        engine.removeEntity(ship);

You would probably want to change ship.getHullSpec().getHullId() to the variant name. I don't think there's a way to get the variant ID through the API yet, so it would have to be hardcoded (you could use ship.getVariant().getDisplayName() to select between the various default variants).

You'd lose anything customized on the old ship - name, hullmods, vents/caps, etc. I've never used spawnShipOrWing before so I don't know if the ship is added to your fleet, so it's possible you'd lose the ship after the battle anyway.

All in all, not a great solution outside of missions, but it's the best I can see as possible right now. :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 19, 2013, 01:51:57 PM
Slightly better solution (not tested):

Code
    public static String getVariantId(ShipAPI ship)
    {
        CampaignFleetAPI tmpFleet;
        FleetMemberAPI tmpShip;
        for (Iterator fleets = ((StarSystemAPI) Global.getSector().getStarSystems().get(0))
                .getFleets().iterator(); fleets.hasNext();)
        {
            tmpFleet = (CampaignFleetAPI) fleets.next();
            for (Iterator ships = tmpFleet.getFleetData().getMembersListCopy().iterator(); ships.hasNext();)
            {
                tmpShip = (FleetMemberAPI) ships.next();
                if (tmpShip.getId().equals(ship.getFleetMemberId()))
                {
                    return tmpShip.getSpecId();
                }
            }
        }

        return ship.getHullSpec().getHullId();
    }

    public static void revive(ShipAPI ship, CombatEngineAPI engine)
    {
        engine.getFleetManager((ship.getOwner() == 0 ? FleetSide.PLAYER : FleetSide.ENEMY))
                .spawnShipOrWing(getVariantId(ship), ship.getLocation(), ship.getFacing());
        engine.removeEntity(ship);
    }
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on April 19, 2013, 04:09:16 PM
Hey guys I have a weird report for my mod and I'm not sure what it may be related to, any clue?

Spoiler
51418 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.ArrayIndexOutOfBoundsException: 2
java.lang.ArrayIndexOutOfBoundsException: 2
   at com.fs.starfarer.campaign.fleet.FleetMemberStatus.OÒ0000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.CampaignFleetMemberView.super(Unknown Source)
   at com.fs.starfarer.campaign.fleet.CampaignFleetView.private.String(Unknown Source)
   at com.fs.starfarer.campaign.fleet.CampaignFleet.render(Unknown Source)
   at com.fs.starfarer.campaign.BaseCampaignEntity.render(Unknown Source)
   at com.fs.graphics.LayeredRenderer.Õ00000(Unknown Source)
   at com.fs.starfarer.campaign.BaseLocation.render(Unknown Source)
   at com.fs.starfarer.campaign.CampaignEngine.render(Unknown Source)
   at com.fs.starfarer.campaign.A.Óô0000(Unknown Source)
   at com.fs.starfarer.A.ÖÖÒ000(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 21, 2013, 09:42:41 AM
Alright so, for those who dont know, ive been working on a mod for SC2, that means, creating a few mechanics that arent present in the vanilla.
Right now im stuck with a weapon i cant manage to work, know as the Variable power blaster.
More info: http://wiki.uqm.stack.nl/Trader

So how does it work?
It spawns a projectile infront of the ship, that projectile can be used as a shield and its consumed if used like that, but, the more time you charge the weapon, the stronger that projectile gets. The weapon has 4 stages, a green one that does 2000 dmg, next comes the blue does 4000 dmg, then the purple/magenta, does 8000 damage and last comes the red one doing 16000 damage. While the projectile with stay still as long as you keep "firing", meaning holding the LMB, when you release, it will release the projectile that was currently created. While i cant make the weapon permanently chargeable, ive been trying to at list do the projectile animation infront of the ship and once you released the charge it would reset the animation and would spawn the projectile for the current charge level.
So far the weapon plugin i worked on with Lazy's help has ignored every condition i/he set to avoid spawning projectiles with 0 cd.
Heres the code ive changed and got in so far:

Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import java.awt.Color;

public class TraderVariablePowerBlasterEffect implements EveryFrameWeaponEffectPlugin
{  
    // weapon takes 7 seconds to fully charge
    private int currentCharge = 0;
    private float currentChargelvl = 0;

public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
        {
            ShipAPI ship = weapon.getShip();
            if (ship == null)
            {
                return;
            }
            currentChargelvl = weapon.getChargeLevel();
            AnimationAPI animation = weapon.getAnimation();
            
            if (weapon.isFiring())
            {
                ship.getMutableStats().getFluxDissipation().modifyFlat(ship.getHullSpec().getHullId().toString(), 0); //while chargins the dissipation should be set to 0
                
                if (currentChargelvl <= 0.33f)
                {
                    //Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                    if(currentCharge == 0)
                    {
                        engine.addFloatingText(ship.getLocation(), "Power Level 1",25f,Color.GREEN,weapon.getShip(),0f,0f);
                        currentCharge = 1;
                        animation.setFrame(1);
                        animation.play();
                    }
                    
                    if(animation.getFrame() == 5)
                    {
                        animation.setFrame(1);
                        animation.play();
                    }
                }
                
                if (currentChargelvl <= 0.66f && currentChargelvl > 0.33f)
                {
                    if(currentCharge == 1)
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 2",25f,Color.BLUE,weapon.getShip(),0f,0f);
                        currentCharge = 2;
                        animation.setFrame(6);
                        animation.play();
                    }

                    if(animation.getFrame() == 10)
                    {
                        animation.setFrame(6);
                        animation.play();
                    }
                }
                
                if (currentChargelvl <= 0.99f && currentChargelvl > 0.66f)
                {
                    if(currentCharge == 2)
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 3",25f,Color.MAGENTA,weapon.getShip(),0f,0f);
                        currentCharge = 3;
                        animation.setFrame(11);
                        animation.play();
                    }
                    
                    if(animation.getFrame() == 15)
                    {
                        animation.setFrame(11);
                        animation.play();
                    }
                }
                
                if(currentChargelvl > 0.99f)
                {
                    if(currentCharge == 3)
                    {
                        engine.addFloatingText(ship.getLocation(), "Max Power Level",25f,Color.RED,weapon.getShip(),0f,0f);
                        currentCharge = 4;
                        animation.setFrame(16);
                        animation.play();
                    }

                    if(animation.getFrame() == 20)
                    {
                        animation.setFrame(16);
                        animation.play();
                    }
                }
            }  
            else
            {
                switch (currentCharge)
                {
                    case 1:
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_s1_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                        engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s1", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                        ship.getFluxTracker().increaseFlux(500, false);
                        weapon.setRemainingCooldownTo(1f);
                        break;
                    }
                    case 2:
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_s2_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                        engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s2", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                        ship.getFluxTracker().increaseFlux(500, false);
                        weapon.setRemainingCooldownTo(1f);
                        break;
                    }
                    case 3:
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_s3_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                        engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster_s3", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                        ship.getFluxTracker().increaseFlux(500, false);
                        weapon.setRemainingCooldownTo(1f);
                        break;
                    }
                    default:
                    // Whatever happens if it isn't charged
                }
                ship.getMutableStats().getFluxDissipation().unmodify();
                currentCharge = 0;
            }
            
    }//advance
}  

With the code atm, will spawn the lvl 1 projectile without charging anything.

heres a video: http://www.youtube.com/watch?v=FEYfYxM7iVA
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 22, 2013, 10:13:36 AM
Hmm. I don't think you're using the AnimationAPI correctly. play() will loop the animation, so relying on code like this:
if(animation.getFrame() == 15)
{
    animation.setFrame(11);
    animation.play();
}
Is a mistake because you're not guaranteed to actually stop on that frame. It might get missed due to a frame rate hiccup. If the animation is slow enough (<30fps), I suppose it might work, since the engine won't go below that (but will slow time instead)... but still, a bit iffy.

So, if you're going to use setFrame(), you should go all the way and use it to drive the whole animation rather than using play().


Beyond that, I don't see anything glaringly wrong, though it was a rather quick look. I'd suggest adding some messages to the log to help figure out what's going on here (or running with an IDE and hooking a debugger up to the JVM, so you can actually use breakpoints, but that's more involved.)

For logging:
Logger log = Logger.getLogger(this.getClass());
log.info("whatever string you want to print");


Opening up the log file with a text editor capable of updating it on the fly would be helpful if you do that, too. Or using something like "tail" on it (which you could do if you installed cygwin, if you're running Windows).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 23, 2013, 01:13:37 PM
no luck so far, would using IntervalUtil help? Also i do not know exactly how it works, if its a interval from X to X
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 23, 2013, 01:32:34 PM
no luck so far, would using IntervalUtil help? Also i do not know exactly how it works, if its a interval from X to X

It's basically a repeating timer where you can have different intervals each iteration.

The values you pass in are the minimum and maximum intervals. It picks a random number in the range between them as its 'target' (you can just pass in the same number for both for a normal timer behavior). You need to call advance(<amount to advance>) for the IntervalUtil to work; usually you will use the time since the last frame as the amount argument. You can then check intervalElapsed() to see if it hit its target. You need to check intervalElapsed() after each advance(), because it will only return true for one frame. The next frame after time is up, a new random interval in the range you gave is chosen, and the process starts over.

You can change the interval ranges at any time with setInterval(min, max).

IntervalUtil is in the API, by the way, so you can view the source in starfarer.api.zip.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 23, 2013, 04:59:22 PM
hi there,

i am trying to set up a decorative weapon.
i get an error message i can't figure out. It's looking for filenames that arent specified anywhere. Is there a certain file suffix neccesary`?

Code
java.lang.RuntimeException: Error loading [graphics/TL/weapons/decor/thule_heimdahl_0059_Frame-1.png01.png] resource, not found in [D:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\LazyLib,D:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\StealThisStuff,D:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\..\mods\Thule Legacy,../starfarer.res/res,CLASSPATH]
at com.fs.util.C.Ò00000(Unknown Source)
at com.fs.util.C.Object(Unknown Source)
at com.fs.graphics.K.String(Unknown Source)
at com.fs.graphics.K.Ò00000(Unknown Source)
at com.fs.graphics.K$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 23, 2013, 05:16:32 PM
graphics/TL/weapons/decor/thule_heimdahl_0059_Frame-1.png01.png

That part looks suspect, but I can't say without seeing your filenames and what you've got in the .wpn file.

The naming convention has to be:
graphics/weapons/shredder/chaingun2_turret_base00.png
graphics/weapons/shredder/chaingun2_turret_base01.png
graphics/weapons/shredder/chaingun2_turret_base02.png
...
graphics/weapons/shredder/chaingun2_turret_base99.png
graphics/weapons/shredder/chaingun2_turret_base100.png
graphics/weapons/shredder/chaingun2_turret_base101.png
etc. So, has to end in .png, and the number has to precede that, and it has to be 2 digits unless it's 100 or over (i.e. you can't do 001, iirc).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 23, 2013, 05:43:04 PM
ah, i see, okay i guess there is the problem. the frames are numbered in three digits and the number is not at the end of the filename.

What i did:
I took okims mod "ironclad" and tried to mimic his landing lights.

The following files are involved:

D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\scripts\plugins\isHulkCheck.java
Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.FluxTrackerAPI;

public class isHulkCheck implements EveryFrameWeaponEffectPlugin
{

 public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
  {
   if (engine.isPaused()) return;

   AnimationAPI animation = weapon.getAnimation();
 
   if (weapon.getShip().isHulk())
    {
    animation.pause();
    }

   else
    {
     animation.play();
    } 

  }

}




D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\weapons\thule_deco_heimdahl.wpn
Code
{
"id":"thule_deco_heimdahl",
"specClass":"projectile",
"type":"DECORATIVE",
"size":"MEDIUM",

"everyFrameEffect":"data.scripts.plugins.isHulkCheck",

"turretSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",
"hardpointSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",

"numFrames":60,
"frameRate":15,
"alwaysAnimate":"true",

"turretOffsets":[0, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[0, 0],
"hardpointAngleOffsets":[0],

"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"MUZZLE_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
"muzzleFlashSpec":{"length":0.0,   # only used if animationType = MUZZLE_FLASH
   "spread":10,
   "particleSizeMin":4.0,
   "particleSizeRange":18.0,
   "particleDuration":0.2,
   "particleCount":25,
   "particleColor":[255,150,30,200]},

"projectileSpecId":"thule_barbarossa_shot",  # projectile that will be fired
"fireSoundTwo":"thule_barbarossa",
"fireSoundOne":"thule_barbarossa_overload",
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 23, 2013, 05:51:58 PM
the current naming convention looks like this: thule_heimdahl_Frame01.png, ..., thule_heimdahl_Frame60.png

it's still lokking for graphics/TL/weapons/decor/thule_heimdahl_Frame01.png01.png
Don't know how it gets the idea ...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 23, 2013, 06:37:23 PM
A-ha! Looking at the code, the frames have to start with 00. Have fun renaming all the files :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on April 23, 2013, 07:57:54 PM
ouch...

that can't be fun....
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on April 23, 2013, 08:04:40 PM
NO IT WASN'T FUN!!! ;) but at least it did the trick ;)

Thanks alex for the help.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 23, 2013, 08:21:42 PM
oh wow XD thats the kind of mistake that makes you feel dumb when they happens  ;D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on April 23, 2013, 09:09:11 PM
Yeah, I had that problem when I was doing my first animations. Thankfully I've been animating various things for years already so I'm used to finding problems like that. That was nothing compared to this game some guy had me work on. I had to 3D animate a whole helicopter- engine and everything. 0_0
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on April 24, 2013, 12:35:28 AM
anyway, I have found that there seem to be a limited number of smoke particles that can exist simultaneously in a battle, but other particles (like smooth particle) seem to be unlimited. I assume this is intended since a limit like that has to be coded in somehow (unless it's a part of LWJGL?)

is this for performance? If so why isn't smooth particle limited as well? Is there a way to set how many particles can be in a battle?

thanks

gunny
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 24, 2013, 10:40:01 AM
There's a limit for both kinds; as you guessed, for performance reasons. It's currently hardcoded, and I don't know that changing that makes sense.

These are never going to be something you can just spawn at will without worrying about performance. Generally speaking, if whatever effect you're going for requires a LOT of them, then it's probably best to either 1) make sure the effect doesn't happen often or 2) reconsider how the effect's visuals are implemented.

It's sort of like that with EMP arcs, too - yeah, you can go overboard and spawn a lot of them and it looks cool, but that doesn't make it a good idea performance-wise.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sarducar_Dun on April 24, 2013, 01:02:48 PM
Errrrm I think this should go here. I'm thinking of starting a mod and I'm trying to get some ideas down on paper, I'm wondering what kind of health and armourvalues vanilla missiles have to balance my P.D. and missiles?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on April 24, 2013, 01:50:28 PM
Errrrm I think this should go here. I'm thinking of starting a mod and I'm trying to get some ideas down on paper, I'm wondering what kind of health and armourvalues vanilla missiles have to balance my P.D. and missiles?

your best bet is to check the weapon csv and compare values. from there you can do some math yourself and see what works for you
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on April 24, 2013, 05:04:03 PM
There's a limit for both kinds; as you guessed, for performance reasons. It's currently hardcoded, and I don't know that changing that makes sense.

well... I feel that would belong in options rather than anything else. I seem to remember quite a few games (such as GSB i believe) have a slider of number of allowed particles there. But this is a discussion for suggestions I suppose so I'll drop it here and maybe start a thread at some point...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sarducar_Dun on April 24, 2013, 11:45:13 PM
Ah thanks.
Where do I find the CSV's though? I've looked on the forum and yes that's exactly what I need but I don't know where to look.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on April 25, 2013, 12:01:38 AM
/Fractal Softworks/Starsector/starsector-core/data/weapons

check in there, anything that ends in .wpn is well... a weapon, what you're looking for is weapon_data.csv


/Fractal Softworks/Starsector/starsector-core/data/hulls

for ships it is ship_data.csv
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sarducar_Dun on April 25, 2013, 12:22:58 AM
Ahhhh that makes sense. Thanks a bunch.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ShadowFox on April 25, 2013, 01:50:12 AM
So my question is a bit strange, and perhaps might be irrelevant since it may make little sense to keep within Starsector, but I am looking to see if it is at all possible to make it so when max flux is reached and overload happens, can the weapons still be used. I am working on the Star Wars Mod, and I want to try and make it as close to lore as possible. I have no idea if this is possible or not, but it would go a long way to making the mod play how I want it to.

Obviously if that can't be done, I will work around it. But I'm hoping there is some workaround. My weapons generate 0 flux, so flux is only a  measure of shield strength. Thanks in advance to any help with this matter.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 25, 2013, 08:09:57 AM
Custom beam graphics

How does one set the Projectile graphic of a pulse shot, kinda like the Autopulse shot, To be a custom sprite?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 25, 2013, 03:07:28 PM
How does one set the Projectile graphic of a pulse shot, kinda like the Autopulse shot, To be a custom sprite?

"textureType":"SMOOTH",

That line in the .proj file can also point to an array of graphics filenames, like so:
"textureType":["filename1.png","filename2.png"]

IIRC the first one is the fringe and the second one the core of the beam/pulse projectile, but I might have that reversed.


So my question is a bit strange, and perhaps might be irrelevant since it may make little sense to keep within Starsector, but I am looking to see if it is at all possible to make it so when max flux is reached and overload happens, can the weapons still be used. I am working on the Star Wars Mod, and I want to try and make it as close to lore as possible. I have no idea if this is possible or not, but it would go a long way to making the mod play how I want it to.

Obviously if that can't be done, I will work around it. But I'm hoping there is some workaround. My weapons generate 0 flux, so flux is only a  measure of shield strength. Thanks in advance to any help with this matter.

Not possible, sorry :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 25, 2013, 03:12:23 PM
But doesn't that set it up to just as a shaped beam, I'm trying to get it to work like a bullet sprite :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on April 25, 2013, 06:43:17 PM
So my question is a bit strange, and perhaps might be irrelevant since it may make little sense to keep within Starsector, but I am looking to see if it is at all possible to make it so when max flux is reached and overload happens, can the weapons still be used. I am working on the Star Wars Mod, and I want to try and make it as close to lore as possible. I have no idea if this is possible or not, but it would go a long way to making the mod play how I want it to.

Obviously if that can't be done, I will work around it. But I'm hoping there is some workaround. My weapons generate 0 flux, so flux is only a  measure of shield strength. Thanks in advance to any help with this matter.

You could have a plugin that constantly scans the ships on the battlefield, and when it finds one that is overloading it stops the overload, sets the shield unfold rate to zero, and starts a timer to remove the malus X seconds from now. This would (sort of) disable the shields when an overload happens without the rest of the effects of an overload. I think that's as close as you can get to what you want in the current version.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 25, 2013, 07:55:44 PM
But doesn't that set it up to just as a shaped beam, I'm trying to get it to work like a bullet sprite :)

You can use the ballistic projectile spawn type, then.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 25, 2013, 07:58:17 PM
I'm unsure what you mean, sorry :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 25, 2013, 08:22:26 PM
What I mean is, if you're trying to get it to work like a bullet sprite, use a bullet, like the ballistic weapons do.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 25, 2013, 08:31:09 PM
And how is this accomplished? :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on April 25, 2013, 08:42:04 PM
Is it possible to make a 'weapon' that in reality is just an external cargo pod mounted instead of a weapon? Therefore it wouldn't turn or anything- just cost a few OP and add cargo space.

If not, would be a good suggestion.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Silver Silence on April 25, 2013, 10:14:14 PM
I wouldn't mind something similar to add armour or better shielding. Cover up all those mounts I've no use for, or have run out of OP to fit.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 27, 2013, 07:41:42 PM
On another note, I was wondering if any in fact had a way to make projectiles that impacted other projectiles? One of the systems Im working on is basically an anti-projectile system. Basically what I'm building is a weapon that fires a quick burst of projectiles with a wide firing pattern, and destroys other projectiles in a short range in front of the ship. I know I could use missiles, but I find that a missile-based system limits the longevity of this ship considerably due to ammo (I dont want to make too many solid weapon systems that simply regen ammo). Plus, when I have the missile slow down to a crawl and the PDs still focus the non-damaging missiles down, it looks kind of silly.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: sarducardun on April 28, 2013, 01:51:55 AM
Beat me to it arumac. I was looking for a way to not need shields on a high tech ship and I had just settled on powerful integrated pd that will hit anything.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on April 28, 2013, 05:06:07 AM
I tried to create a mod and add a ship in it. First time it worked, but the engines where too bright, so i used Trylobot Ship Editor to change them a bit. Now Starsector dont want to start, i got this in the logs, however i'm not too sure what i am looking at:

Spoiler
--------------------------------
4635 [Thread-6] ERROR com.fs.starfarer.combat.D  - org.json.JSONException: JSONObject["id"] not found.
org.json.JSONException: JSONObject["id"] not found.
   at org.json.JSONObject.get(JSONObject.java:406)
   at org.json.JSONObject.getString(JSONObject.java:577)
   at com.fs.starfarer.loading.LoadingUtils.super(Unknown Source)
   at com.fs.starfarer.loading.LoadingUtils.super(Unknown Source)
   at com.fs.starfarer.loading.ShipHullSpreadsheetLoader.o00000(Unknown Source)
   at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.H.super(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]

Some help please?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 28, 2013, 06:26:09 AM
How to get a ship to show up in the station?

I have the image, the .ship file, the variant; I've added it to the string and ship_data.cvs.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 28, 2013, 06:54:57 AM
Now add it to it's initial cargo, find the station generator you want and ad it :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Silver Silence on April 28, 2013, 07:23:20 AM
One of two ways, you could either open your save game, look at the name of a ship that's currently in the station and search for that ship in your save game's data, then convert that ship into your new one by changing things like the hull ID.
Example;
Here's the KK Kamchatka II, a Novgorod-class cruiser (http://scr.hu/0zoz/27a8n).
Here's the Kamchatka in my savegame (http://scr.hu/0zoz/f6xu7).

A little bit of fiddling, and now the Kamchatka is a Moscow-class battleship (http://scr.hu/0zoz/fax9x).
And here's the Kamchatka in my savegame (http://scr.hu/0zoz/ejmxy).

The other method involves diving into the core files, or mod files if you're tampering with a mod.
You'll wanna go to the data folder, then scripts, then world, then corvus. In the corvus folder, you'll find corvus.java. If you open corvus.java, it'll look something like this (http://scr.hu/0zoz/ldi0o). Now, if you're tampering with a mod that's already been made, you can just search for a ship that you know you always find in a station at the start of the game. Here, I'm using the Moscow battleship again. Duping that line there as many times as I want will let me have as many Moscows as I want in a station at the start of the game.

Another method is fiddling with a convoy to have a really high chance of delivering the ship you want. However, I don't know how to do that. I assume it'd be similar to fiddling with the generation files.
Hope that helped.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 28, 2013, 07:27:56 AM
Yea, I'm using Ironclad mod and I'm adding my own ships, but the game keeps crashing.

Can anyone tell me where the log file is located?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 28, 2013, 07:38:53 AM
Starsector core :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 28, 2013, 09:23:42 AM
What? I checked there twice. It was the first location I checked....how he hell did I miss it?  ??? ??? ???
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 28, 2013, 09:47:38 AM
If you know not of what you are searching for, you may never find the answer

Extract from the Sproginian decree. Book of Sprog Number 4
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Upgradecap on April 28, 2013, 10:18:52 AM
Yea, I'm using Ironclad mod and I'm adding my own ships, but the game keeps crashing.

Can anyone tell me where the log file is located?

Because it needs to be generated, for one. Might be something to look out for, if you delete it. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 28, 2013, 10:29:28 AM
And how is this accomplished? :)

Take a look at any of the weapons that work that way - say, the Assault Chaingun.

I tried to create a mod and add a ship in it. First time it worked, but the engines where too bright, so i used Trylobot Ship Editor to change them a bit. Now Starsector dont want to start, i got this in the logs, however i'm not too sure what i am looking at:

Spoiler
--------------------------------
4635 [Thread-6] ERROR com.fs.starfarer.combat.D  - org.json.JSONException: JSONObject["id"] not found.
org.json.JSONException: JSONObject["id"] not found.
   at org.json.JSONObject.get(JSONObject.java:406)
   at org.json.JSONObject.getString(JSONObject.java:577)
   at com.fs.starfarer.loading.LoadingUtils.super(Unknown Source)
   at com.fs.starfarer.loading.LoadingUtils.super(Unknown Source)
   at com.fs.starfarer.loading.ShipHullSpreadsheetLoader.o00000(Unknown Source)
   at com.fs.starfarer.loading.SpecStore.Ò00000(Unknown Source)
   at com.fs.starfarer.loading.H.super(Unknown Source)
   at com.fs.A.A.new(Unknown Source)
   at com.fs.starfarer.combat.D.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]

Some help please?

Seems like the ship_data.csv might be malformed - looks like it's not finding the "id" column in it. If looking at it doesn't help, might be worth it to create a separate thread for this and post the .ship and the .csv there.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 28, 2013, 11:01:40 AM
Is it possible to make a 'weapon' that in reality is just an external cargo pod mounted instead of a weapon? Therefore it wouldn't turn or anything- just cost a few OP and add cargo space.

If not, would be a good suggestion.

Oh, missed this one. No, not possible. Well, not practical, anyway - you could maybe rig something up with an over-abundance of decorative slots that respond to a ship having a certain hullmod...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on April 28, 2013, 11:32:46 AM
Anyone? Any of the smart programmers on here have any idea how one could make a projectile that collides with other projectiles?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on April 28, 2013, 01:37:11 PM
Seems like the ship_data.csv might be malformed - looks like it's not finding the "id" column in it. If looking at it doesn't help, might be worth it to create a separate thread for this and post the .ship and the .csv there.

Thank you, i found my problem, the ID column has indeed been weirded up by Open Office.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on April 29, 2013, 01:21:12 PM
I need to somehow make a projectile move as long as you keep "firing" the weapon, once it stops (!weapon.IsFiring()) the projectile will fade/despawn and spawn several projectiles clockwise (in this case 6 so its 60,120,180,240,300 and 360) around it with a high velocity.

if i do manage to get the first part running ill be able to replicate the Marauder (http://wiki.uqm.stack.nl/Marauder) Spin-blade and the Broodhome (http://wiki.uqm.stack.nl/Broodhome) Crystal Shard
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 29, 2013, 01:24:16 PM
Oh thats a tuffy, Maybe see how the Harlem Shake spawned other ships, and reverse engineer it to:

 isWeaponFiring !=True
{
  SpawnProjectiles
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 29, 2013, 11:15:14 PM
Shielded fighters?

I saw one or two in the screenshots, but so far I'm unable to replicate it. I tried several types of shields and various values, but my fighters still don't have shields.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 29, 2013, 11:45:21 PM
D they have a shield generator on their ship?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 30, 2013, 02:36:29 AM
Yeah I did put it in.....
unless.... I removed it by accident when I was re-workign all the stats. Now I'll have to check.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on April 30, 2013, 04:36:12 AM
It's Happened to me loads of times man dw about it
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on April 30, 2013, 08:26:52 AM
I need to somehow make a projectile move as long as you keep "firing" the weapon, once it stops (!weapon.IsFiring()) the projectile will fade/despawn and spawn several projectiles clockwise (in this case 6 so its 60,120,180,240,300 and 360) around it with a high velocity.

if i do manage to get the first part running ill be able to replicate the Marauder (http://wiki.uqm.stack.nl/Marauder) Spin-blade and the Broodhome (http://wiki.uqm.stack.nl/Broodhome) Crystal Shard

I'd suggest a beam weapon that fires a short-range, invisible, 0-damage, minimal charge up/down time beam, just so that isFiring() behaves the way you'd want it to here. Then you could handle all projectile spawning exclusively via scripts, similarly to how the Tachyon Lance handles adding the EMP arc effect.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on April 30, 2013, 12:44:32 PM
WEll, I checked hte shadow order mod and I followed hte logical steps..still n oworky...

What I did:


Added this to the hullmods folder:

Code
package data.hullmods;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;

import java.util.HashMap;
import java.util.Map;

public class InfusedHull extends BaseHullMod {

public static final float REPAIR_FRACTION = 1f;
public static final float REPAIR_BONUS = .99f;

private static Map mag = new HashMap();
static {
mag.put(HullSize.FIGHTER, 3f);
mag.put(HullSize.FRIGATE, 1f);
mag.put(HullSize.DESTROYER, .75f);
mag.put(HullSize.CRUISER, .5f);
mag.put(HullSize.CAPITAL_SHIP, .25f);
}

public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
stats.getHullRepairRatePercentPerSecond().modifyFlat(id, (Float) mag.get(hullSize));
stats.getMaxHullRepairFraction().unmodify(id);
stats.getMaxHullRepairFraction().modifyFlat(id, REPAIR_FRACTION);
}

public String getDescriptionParam(int index, HullSize hullSize) {
if (index == 0) return "1";// + ((Float) mag.get(HullSize.FRIGATE)).intValue();
if (index == 1) return ".75";// + ((Float) mag.get(HullSize.DESTROYER)).intValue();
if (index == 2) return ".5";// + ((Float) mag.get(HullSize.CRUISER)).intValue();
if (index == 3) return ".25";// + ((Float) mag.get(HullSize.CAPITAL_SHIP)).intValue();
return null;
}
}



Added this line to hullmods.csv

"Nano-Infused Hull","infusedhull",,0,0,0,0,"data.hullmods.InfusedHull","Repairs %s/%s/%s/%s percent of the ships hull per second."



And this is how my fighter variant looks:
Code
{
"displayName":"Advanced Fighter",
"hullId":"PhnH",
"hullMods": [infusedhull]
"variantId":"PhnH_standard",
"fluxVents":0,
"fluxCapacitors":0,
"mods":[], # array of strings

# mode is either LINKED or ALTERNATING
# slot ids (WS ***) must match what's in the .ship file
"weaponGroups":[
{"mode":"LINKED",
"weapons":{
"WS01":"20mm_rc",
"WS02":"20mm_rc",
   },
},

{"mode":"LINKED",
"weapons":{
"WS03":"stingerx2",
   },
},
],
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 01, 2013, 03:14:38 PM
Anyone know if theres a way to make missiles explode rather than fade away after their flight time expires.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 01, 2013, 05:46:35 PM
Anyone know if theres a way to make missiles explode rather than fade away after their flight time expires.

They won't deal damage when they explode (it's basically the same as if they got shot down), but here's a very simple plugin that should do what you asked:

data/scripts/plugins/MissilesExplodeOnFizzlePlugin.java:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.MissileAPI;
import java.util.Iterator;
import java.util.List;

public class MissilesExplodeOnFizzlePlugin implements EveryFrameCombatPlugin
{
    private static CombatEngineAPI engine;

    @Override
    public void advance(float amount, List events)
    {
        if (engine.isPaused())
        {
            return;
        }

        // Scan all missiles on the field
        MissileAPI missile;
        for (Iterator missiles = engine.getMissiles().iterator(); missiles.hasNext();)
        {
            missile = (MissileAPI) missiles.next();

            // If the missile is fizzling, damage it so it explodes
            if (missile.isFizzling())
            {
                engine.applyDamage(missile, missile.getLocation(), 99999,
                        DamageType.ENERGY, 0f, true, false, null);
            }
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        MissilesExplodeOnFizzlePlugin.engine = engine;
    }
}

If you want a version that does cause damage to nearby targets when a missile explodes, I can make that for you but it would be far more complicated.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 01, 2013, 07:28:28 PM
Anyone know if theres a way to make missiles explode rather than fade away after their flight time expires.

They won't deal damage when they explode (it's basically the same as if they got shot down), but here's a very simple plugin that should do what you asked:

data/scripts/plugins/MissilesExplodeOnFizzlePlugin.java:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.MissileAPI;
import java.util.Iterator;
import java.util.List;

public class MissilesExplodeOnFizzlePlugin implements EveryFrameCombatPlugin
{
    private static CombatEngineAPI engine;

    @Override
    public void advance(float amount, List events)
    {
        if (engine.isPaused())
        {
            return;
        }

        // Scan all missiles on the field
        MissileAPI missile;
        for (Iterator missiles = engine.getMissiles().iterator(); missiles.hasNext();)
        {
            missile = (MissileAPI) missiles.next();

            // If the missile is fizzling, damage it so it explodes
            if (missile.isFizzling())
            {
                engine.applyDamage(missile, missile.getLocation(), 99999,
                        DamageType.ENERGY, 0f, true, false, null);
            }
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        MissilesExplodeOnFizzlePlugin.engine = engine;
    }
}

If you want a version that does cause damage to nearby targets when a missile explodes, I can make that for you but it would be far more complicated.

Now here's the thing, how would I implement that? Will I have to designate it per missile? Or would it do that for every missile fired? I'm not a programmer by any means.

Also, while the extra damage would be nice, I can make due without it, as the exploding missiles in question are actually used to eat projectiles.

And thanks for your help and time, I honestly do appreciate it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 01, 2013, 07:49:26 PM
All you would need to do is place the code in a file named MissilesExplodeOnFizzlePlugin.java in data/scripts/plugins, as Starsector automatically loads any plugin placed in that folder.

It should work for all missiles fired, even vanilla. If you want it to only work for certain missiles, that would be an easy change:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.MissileAPI;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class MissilesExplodeOnFizzlePlugin implements EveryFrameCombatPlugin
{
    private static final Set MISSILES_TO_EXPLODE = new HashSet();
    private static CombatEngineAPI engine;

    static
    {
        // Add the projectile IDs of all missiles that should explode here
        // Example: MISSILES_TO_EXPLODE.add("annihilator_rocket");
        MISSILES_TO_EXPLODE.add("proj id goes here");
        MISSILES_TO_EXPLODE.add("any other missiles go in their own line like this");
    }

    @Override
    public void advance(float amount, List events)
    {
        if (engine.isPaused())
        {
            return;
        }

        // Scan all missiles on the field
        MissileAPI missile;
        for (Iterator missiles = engine.getMissiles().iterator(); missiles.hasNext();)
        {
            missile = (MissileAPI) missiles.next();

            // If the missile is fizzling, damage it so it explodes
            if (missile.isFizzling() && MISSILES_TO_EXPLODE.contains(missile.getProjectileSpecId()))
            {
                engine.applyDamage(missile, missile.getLocation(), 99999,
                        DamageType.ENERGY, 0f, true, false, null);
            }
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        MissilesExplodeOnFizzlePlugin.engine = engine;
    }
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on May 02, 2013, 04:41:35 AM
Silly question:do comments (// texthere ) in .ship and .variant files work?


I would really help with turret groups, especially since I'm working with similar ships with different weapon setups
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 02, 2013, 04:50:50 AM
Silly question:do comments (// texthere ) in .ship and .variant files work?


I would really help with turret groups, especially since I'm working with similar ships with different weapon setups

Yes, except you use # instead of //.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on May 02, 2013, 07:58:58 AM
Oh thanks for the missile script lazy, i had something very close to what u got here for the podship plasmoid, i didnt know about the .isFizzling() existing so i based of with a timer.

Heres an example if you want to "despawn" the old missile and spawn a new one in its place:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.MissileAPI;
import java.util.Iterator;
import java.util.List;

public class PodshipHomingPlasmoid implements EveryFrameCombatPlugin
{

    private String SHELL_ID_1 = "podship_plasmoid";
    private String SHELL_ID_2 = "podship_plasmoid_2";
    private String SHELL_ID_3 = "podship_plasmoid_3";
    private String SHELL_ID_4 = "podship_plasmoid_4";
    private CombatEngineAPI engine;
    
    public void init(CombatEngineAPI engine) {
        this.engine = engine;
    }
    
    public void advance(float amount, List events)
    {
        if (engine.isPaused()) {
            return;
        }    

        for (Iterator allMissiles = engine.getMissiles().iterator();
                allMissiles.hasNext();)
        {
            MissileAPI plasmoid = (MissileAPI) allMissiles.next();
                
            if(plasmoid.isFizzling())
            {
                if(SHELL_ID_1.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_2, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else if(SHELL_ID_2.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_3, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else if(SHELL_ID_3.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_4, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else {
                    return;
                }
            }  
        }
    }//advance
}//class
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 02, 2013, 01:04:19 PM
Lazy you're a gentleman and a scholar. Thank you soo much for your help!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 02, 2013, 01:19:10 PM
No problem, glad to help. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on May 02, 2013, 02:12:43 PM
I'm experiencing the wierdest bug ever.

I made my own faction, addied it to the game (using Ironclad mod) and it's ships (3 fighters, 1 frigate, 2 de's, 1 battleship)

Thing is, the 2 DE's down show up graphics-wise. They are in the System Defene Fleet, but they are invisible. The other ship show up normally.

I checked, double-checked and tripple-checked everything. Cant' find anything wrong or off. When I load the ship file in the editor, it opens the ship image normally.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on May 02, 2013, 02:28:20 PM
Check that the image has been saved with a bit depth greater than 8
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 02, 2013, 03:45:50 PM
Oh thanks for the missile script lazy, i had something very close to what u got here for the podship plasmoid, i didnt know about the .isFizzling() existing so i based of with a timer.

Heres an example if you want to "despawn" the old missile and spawn a new one in its place:
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.combat.MissileAPI;
import java.util.Iterator;
import java.util.List;

public class PodshipHomingPlasmoid implements EveryFrameCombatPlugin
{

    private String SHELL_ID_1 = "podship_plasmoid";
    private String SHELL_ID_2 = "podship_plasmoid_2";
    private String SHELL_ID_3 = "podship_plasmoid_3";
    private String SHELL_ID_4 = "podship_plasmoid_4";
    private CombatEngineAPI engine;
    
    public void init(CombatEngineAPI engine) {
        this.engine = engine;
    }
    
    public void advance(float amount, List events)
    {
        if (engine.isPaused()) {
            return;
        }    

        for (Iterator allMissiles = engine.getMissiles().iterator();
                allMissiles.hasNext();)
        {
            MissileAPI plasmoid = (MissileAPI) allMissiles.next();
                
            if(plasmoid.isFizzling())
            {
                if(SHELL_ID_1.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_2, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else if(SHELL_ID_2.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_3, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else if(SHELL_ID_3.equals(plasmoid.getProjectileSpecId())) {
                    engine.spawnProjectile(plasmoid.getSource(), plasmoid.getWeapon(), SHELL_ID_4, plasmoid.getLocation(), plasmoid.getWeapon().getArcFacing(), plasmoid.getVelocity());
                    engine.applyDamage(plasmoid, plasmoid.getLocation(), 99999,DamageType.ENERGY, 0f, true, false, null);
                }
                else {
                    return;
                }
            }  
        }
    }//advance
}//class

Wow, honestly I could use that as well, you guys are amazing.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on May 02, 2013, 11:15:46 PM
Check that the image has been saved with a bit depth greater than 8

I did, that wasn't the problem.
And for some reason the ships started working. Funnily enough, I had to open them in the editor and re-save them. Why did that work?
Your guess is as good as mine....
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on May 03, 2013, 12:06:16 AM
No idea mate, it happens to me often, just shrug it off
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Upgradecap on May 03, 2013, 01:53:50 AM
Probably because the editor might've gotten stuck or written to the file incorrectly.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on May 04, 2013, 12:50:17 PM
Alrighty, while trying implement a suggestion from strompt I've hit a bit of a brick wall and I'm not entirely certain how to proceed.  Getting the following error:

Code
[Thread-6] ERROR com.fs.starfarer.combat.O0OO  - java.lang.ClassCastException: data.scripts.weapons.WavebeamMaster cannot be cast to com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin
java.lang.ClassCastException: data.scripts.weapons.WavebeamMaster cannot be cast to com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin
at com.fs.starfarer.loading.specs.dosuper.õo0000(Unknown Source)
at com.fs.starfarer.combat.entities.A.A.oooO.<init>(Unknown Source)
at com.fs.starfarer.loading.specs.while.o00000(Unknown Source)
at com.fs.starfarer.loading.specs.while.o00000(Unknown Source)
at com.fs.starfarer.loading.specs.while.o00000(Unknown Source)
at com.fs.starfarer.loading.specs.while.o00000(Unknown Source)
at com.fs.starfarer.title.oOOO.Ò00000(Unknown Source)
at com.fs.starfarer.title.oOOO.String(Unknown Source)
at com.fs.starfarer.title.oOOO.String(Unknown Source)
at com.fs.starfarer.title.oOOO.super(Unknown Source)
at com.fs.starfarer.combat.super.OoOO.o00000(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.title.B.o00000(Unknown Source)
at com.fs.starfarer.super.this.do$super(Unknown Source)
at com.fs.A.super.Ò00000(Unknown Source)
at com.fs.starfarer.combat.O0OO.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

From firing this code:

Code
package data.scripts.weapons;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.ShipAPI;

public class WavebeamMaster implements EveryFrameWeaponEffectPlugin
{
    private ShipAPI ship;
   
    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
    {
        if (engine.isPaused()) {
            return;
        }
       
        {
            if(weapon.isFiring())
            {
                engine.spawnProjectile(ship, weapon, "ms_1wave", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                engine.spawnProjectile(ship, weapon, "ms_2wave", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                engine.spawnProjectile(ship, weapon, "ms_3wave", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
            }
        }
    }
   
}

The error is not entirely clear, and netbeans is giving the script its okay, which is making figuring out what's wrong a bit too tricky for me.  Any ideas?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on May 04, 2013, 01:05:10 PM
instead of declaring the ship outside the advance declare it inside and then using the weapon, get ur ship object:

ShipAPI ship = weapon.getShip();

Also be very careful how your spawning projectiles using when weapon.IsFiring();
Heres an example of a code, that while its not perfect, it shows how many conditions i had to go tro with just so it only spawned the right projectile at the right time:

Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;

public class TraderVariablePowerBlasterEffect implements BeamEffectPlugin

    // weapon takes 7 seconds to fully charge
    private IntervalUtil weaponcooldownlvl = new IntervalUtil(4.0f, 4.0f);
   
    private static int currentCharge = 0;
   
    private static boolean chargedlvl1 = true;
    private static boolean chargedlvl2 = false;
    private static boolean chargedlvl3 = false;
    private static boolean chargedlvl4 = false;

        public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
        {
            ShipAPI ship = beam.getSource();
            if (ship == null)
            {
                return;
            }
           
            AnimationAPI animation = beam.getWeapon().getAnimation();
            WeaponAPI weapon = beam.getWeapon();

                if(ship.isHulk())
                {
                    animation.setFrame(0);
                    animation.pause();
                }
               
                    //Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());           
                if(weapon.isFiring())
                {
                    weaponcooldownlvl.advance(amount);
                     
                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 1) {
                        chargedlvl2 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 2) {
                        chargedlvl3 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 3) {
                        chargedlvl4 = true;
                    }
                   
                    if(chargedlvl1 && weapon.getCooldownRemaining() == 0)
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        //engine.addFloatingText(ship.getLocation(), "Power Level 1",15f,Color.GREEN,weapon.getShip(),0f,0f);
                        chargedlvl1 = false;
                        currentCharge = 1;
                        animation.setFrame(1);
                        animation.play();
                    }
                   
                    if (chargedlvl2)   
                    {
                        chargedlvl2 = false;
                        weaponcooldownlvl.setInterval(4.0f, 4.0f);
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 2",20f,Color.BLUE,weapon.getShip(),0f,0f);
                        currentCharge = 2;
                        animation.setFrame(6);
                        animation.play();
                    }
                   
                    if (chargedlvl3)
                    {
                        chargedlvl3 = false;
                        weaponcooldownlvl.setInterval(4.0f, 4.0f);
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 3",25f,Color.MAGENTA,weapon.getShip(),0f,0f);
                        currentCharge = 3;
                        animation.setFrame(11);
                        animation.play();
                    }
                   
                    if(chargedlvl4)
                    {
                        chargedlvl4 = false;
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Max Power Level",30f,Color.RED,weapon.getShip(),0f,0f);
                        currentCharge = 4;
                        animation.setFrame(16);
                        animation.play();
                    }
                   
                    switch (currentCharge)
                    {
                        case 0:
                        {

                            animation.setFrame(0);
                            animation.pause();
                            break;
                        }
                        case 1:
                        {
                            if(animation.getFrame() == 5)
                            {
                                    animation.setFrame(1);
                                    animation.play();
                            }
                            break;
                        }
                        case 2:
                        {
                            if(animation.getFrame() == 10)
                            {
                                animation.setFrame(6);
                                animation.play();
                            }
                            break;
                        }
                        case 3:
                        {
                            if(animation.getFrame() == 15)
                            {
                                animation.setFrame(11);
                                animation.play();
                            }
                            break;
                        }
                        case 4:
                        {
                            if(animation.getFrame() == 20)
                            {
                                animation.setFrame(16);
                                animation.play();
                            }
                            break;
                        }
                    }
                }
                if(weapon.getChargeLevel() <= 0.1f)
                {
                    switch (currentCharge)
                    {
                        case 1:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s1_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s1", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 2:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s2_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s2", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 3:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s3_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster_s3", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 4:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s4_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                    }       
                }
    }//advance
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: TrashMan on May 04, 2013, 02:55:13 PM
AAAAAAAAAAAAArgh.....

Code
7921 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.RuntimeException: Error compiling [data.scripts.world.corvus.Corvus]
java.lang.RuntimeException: Error compiling [data.scripts.world.corvus.Corvus]
at com.fs.starfarer.loading.scripts.ScriptStore$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Compiling unit "data/scripts/world/corvus/Corvus.java"
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:212)
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 2 more
[b]Caused by: org.codehaus.commons.compiler.CompileException: Source file "data/scripts/world/corvus/xleattackSpawnPoint.java" does not declare class "data.scripts.world.corvus.xleattackSpawnPoint"[/b]


WTFUQ?
How the hell does it not contain?


This is the XLEattackSpawnPoint.java
Code
package data.scripts.world.corvus;

import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;

import data.scripts.world.BaseSpawnPoint;

public class XLEattackSpawnPoint extends BaseSpawnPoint {

private final SectorEntityToken station;

public XLEattackSpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor, SectorEntityToken station) {
super(sector, location, daysInterval, maxFleets, anchor);
this.station = station;
}

@Override
protected CampaignFleetAPI spawnFleet() {


String type = null;
float r = (float) Math.random();
if (r > .5f) {
type = "scouts";
} else {type = "armada";}


CampaignFleetAPI fleet = getSector().createFleet("XLE", type);
getLocation().spawnFleet(getAnchor(), 0, 0, fleet);


if (type.equals("scouts")) {
fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 10);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
} else {
fleet.addAssignment(FleetAssignment.ATTACK_LOCATION, station, 50);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
}

return fleet;
}

}


This is in the Corvus.java
Code
				//XLE strike force
XLEattackSpawnPoint xleattackSpawn = new xleattackSpawnPoint(sector, system, 20, 1, RSFStation, VNSStation);
system.addSpawnPoint(xleattackSpawn);
for (int i = 0; i < 2; i++)
xleattackSpawn.spawnFleet();



The XLE have their fleets,, relatiosn are set to hostile...WWWTTTFFF????
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 04, 2013, 03:05:13 PM
@MShadowy: That source file looks good (except for the ship thing), I don't see why you're getting that error. Tried it myself and it works (again, aside from the ship always being null.) I'd make sure that you're actually running the game with the files you think you're running the game with. A quick way to make sure would be to totally mangle that file so it doesn't compile and make sure the game reflects that (i.e., doesn't even start).

@TrashMan: Language, sir. (Filenames and class names are case sensitive in Java.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on May 04, 2013, 06:28:13 PM
Well, I have the code working now, but the shots keep desynching.  Fiddling with the floating values just changes when they desynch, so I'm putting the idea off for now.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on May 05, 2013, 01:21:08 PM
Ive made the Trader weapon using the Beam as you have suggested Alex, my problem now is, when it stops firing it should "release" the projectile. it seems that !weapon.IsFiring() doesnt work for this, you know any other method to do this?

Heres my code right now (everything's working fine, that includes the animation since they are running blow 30 frames), while i use the weapon.getChargeLevel() to pick up the beam going down, it also means it will spawn quite a few shots before it actually passes that condition:

Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;

public class TraderVariablePowerBlasterEffect implements BeamEffectPlugin
{  
    // weapon takes 7 seconds to fully charge
    private IntervalUtil weaponcooldownlvl = new IntervalUtil(4.0f, 4.0f);
    
    private static int currentCharge = 0;
    
    private static boolean chargedlvl1 = true;
    private static boolean chargedlvl2 = false;
    private static boolean chargedlvl3 = false;
    private static boolean chargedlvl4 = false;

        public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
        {
            ShipAPI ship = beam.getSource();
            if (ship == null)
            {
                return;
            }
            
            AnimationAPI animation = beam.getWeapon().getAnimation();
            WeaponAPI weapon = beam.getWeapon();

                if(ship.isHulk())
                {
                    animation.setFrame(0);
                    animation.pause();
                }
                
                    //Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());            
                if(weapon.isFiring())
                {
                    weaponcooldownlvl.advance(amount);
                    
                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 1) {
                        chargedlvl2 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 2) {
                        chargedlvl3 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 3) {
                        chargedlvl4 = true;
                    }
                    
                    if(chargedlvl1 && weapon.getCooldownRemaining() == 0)
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        //engine.addFloatingText(ship.getLocation(), "Power Level 1",15f,Color.GREEN,weapon.getShip(),0f,0f);
                        chargedlvl1 = false;
                        currentCharge = 1;
                        animation.setFrame(1);
                        animation.play();
                    }
                    
                    if (chargedlvl2)  
                    {
                        chargedlvl2 = false;
                        weaponcooldownlvl.setInterval(4.0f, 4.0f);
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 2",20f,Color.BLUE,weapon.getShip(),0f,0f);
                        currentCharge = 2;
                        animation.setFrame(6);
                        animation.play();
                    }
                    
                    if (chargedlvl3)
                    {
                        chargedlvl3 = false;
                        weaponcooldownlvl.setInterval(4.0f, 4.0f);
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 3",25f,Color.MAGENTA,weapon.getShip(),0f,0f);
                        currentCharge = 3;
                        animation.setFrame(11);
                        animation.play();
                    }
                    
                    if(chargedlvl4)
                    {
                        chargedlvl4 = false;
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Max Power Level",30f,Color.RED,weapon.getShip(),0f,0f);
                        currentCharge = 4;
                        animation.setFrame(16);
                        animation.play();
                    }
                    
                    switch (currentCharge)
                    {
                        case 0:
                        {

                            animation.setFrame(0);
                            animation.pause();
                            break;
                        }
                        case 1:
                        {
                            if(animation.getFrame() == 5)
                            {
                                    animation.setFrame(1);
                                    animation.play();
                            }
                            break;
                        }
                        case 2:
                        {
                            if(animation.getFrame() == 10)
                            {
                                animation.setFrame(6);
                                animation.play();
                            }
                            break;
                        }
                        case 3:
                        {
                            if(animation.getFrame() == 15)
                            {
                                animation.setFrame(11);
                                animation.play();
                            }
                            break;
                        }
                        case 4:
                        {
                            if(animation.getFrame() == 20)
                            {
                                animation.setFrame(16);
                                animation.play();
                            }
                            break;
                        }
                    }
                }
                if(weapon.getChargeLevel() <= 0.1f)
                {
                    switch (currentCharge)
                    {
                        case 1:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s1_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s1", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 2:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s2_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s2", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 3:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s3_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster_s3", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                        case 4:
                        {
                            Global.getSoundPlayer().playSound("trader_var_blaster_s4_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                            engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                            ship.getFluxTracker().increaseFlux(500, false);
                            weapon.setRemainingCooldownTo(0.5f);
                            animation.setFrame(0);
                            animation.pause();
                            weaponcooldownlvl.setInterval(4.0f, 4.0f);
                            currentCharge = 0;
                            chargedlvl1 = true;
                            chargedlvl2 = false;
                            chargedlvl3 = false;
                            chargedlvl4 = false;
                            return;
                        }
                    }        
                }
    }//advance
}

2nd Question:
Ive got very little experience with movement vectors, and its one of my main problems i got since i need to change the actual ship movement on SS to be like SC2, my main issues are with the Probe, its movement is in the diagonal so up, down, left and right would be 45º, 225º , 315º, 135º. they also dont "reverse" movement, so pressing back would only make them stop and not reverse.
If the Probe movement was actually replicated the Skiff movement would be literally a copy/paste.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 10, 2013, 01:41:34 PM
I've got a quick question: is there any way to get the ShipAPI object from a CombatEntityAPI object, assuming the combat entity is an instance of ShipAPI? I've tried quite a few things, and just when I think something should work just fine, I get this when I shoot my beam weapon:



Spoiler
Code
39601 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.VerifyError: (class: data/asc/weapons/mhyp_effect, method: advance signature: (FLcom/fs/starfarer/api/combat/CombatEngineAPI;Lcom/fs/starfarer/api/combat/BeamAPI;)V) Register 7 contains wrong type
java.lang.VerifyError: (class: data/asc/weapons/mhyp_effect, method: advance signature: (FLcom/fs/starfarer/api/combat/CombatEngineAPI;Lcom/fs/starfarer/api/combat/BeamAPI;)V) Register 7 contains wrong type
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.fs.starfarer.loading.scripts.ScriptStore.o00000(Unknown Source)
at com.fs.starfarer.loading.specs.supersuper.ÕÓ0000(Unknown Source)
at com.fs.starfarer.combat.entities.BeamWeaponRay.<init>(Unknown Source)
at com.fs.starfarer.combat.entities.A.A.OOoO.õO0000(Unknown Source)
at com.fs.starfarer.combat.entities.A.A.OOoO.createBeam(Unknown Source)
at com.fs.starfarer.combat.entities.A.OoOO.return.super(Unknown Source)
at com.fs.starfarer.combat.entities.A.OoOO.o0OO.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.A.OoOO.o0OO.o00000(Unknown Source)
at com.fs.starfarer.combat.entities.A.OoOO.return.super(Unknown Source)
at com.fs.starfarer.combat.entities.A.A.OOoO.advance(Unknown Source)
at com.fs.starfarer.combat.systems.WeaponGroup.String(Unknown Source)
at com.fs.starfarer.combat.systems.WeaponGroup.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.super(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.F.ÖÖÒ000(Unknown Source)
at com.fs.A.A.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
[close]


Here's the problematic code in question:


Spoiler
Code
		   ShipAPI ship;
   ShipAPI tmp;
   
   for (Iterator iter = engine.getShips().iterator(); iter.hasNext();) {

tmp = (ShipAPI) iter.next();

if (tmp.getLocation() == target.getLocation()) { //If these two entities are in exact same location, then they're obviously the same ship. Also, target is a CombatEntityAPI object.
ship = tmp;
break;
}

}


//Here's what causes the crash on firing the beam. Technically, none of this should even be ran, as it's only supposed to be ran if the beam is actually hitting a ship. I'm using the same requirements for the tachyon lance's every frame effect.
FluxTrackerAPI flux = ship.getFluxTracker();
flux.forceOverload(2.0f);

[close]


Any help would be greatly appreciated.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 10, 2013, 01:58:04 PM
This looks like a bug with Janino, the error is being thrown because the compiled bytecode it generates is invalid, so it doesn't even get to run.

I've seen this before, too. I think if you make sure to initialize all variables, it'll get around the issue. Alternatively, you could bite the bullet, set up an IDE, and use jar files for your code, sidestepping on-startup compilation via Janino entirely.

Spoiler

         ShipAPI ship;
         ShipAPI tmp;
         
         for (Iterator iter = engine.getShips().iterator(); iter.hasNext();) {
         
         tmp = (ShipAPI) iter.next();
         
            if (tmp.getLocation() == target.getLocation()) { //If these two entities are in exact same location, then they're obviously the same ship. Also, target is a CombatEntityAPI object.
               ship = tmp;
               break;
            }
            
         }
         
         
         //Here's what causes the crash on firing the beam. Technically, none of this should even be ran, as it's only supposed to be ran if the beam is actually hitting a ship. I'm using the same requirements for the tachyon lance's every frame effect.
            FluxTrackerAPI flux = ship.getFluxTracker();
            flux.forceOverload(2.0f);

            
[close]
So, in the above, change it to
ShipAPI ship = null;
ShipAPI tmp = null;
Btw, when you're using == to compare locations, what's happening is you're comparing that the objects (Vector2f for each location) are the same, not that the objects' contents are the same. In this case, that's actually what you want, but using if (tmp == target) would make more "sense".

(Also: code tags in spoliers don't work so well. [pre][/pre] tags seem to work better.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 10, 2013, 02:48:14 PM
Huh, that's an odd bug. Your suggestion worked perfectly though; thank you.

Btw, when you're using == to compare locations, what's happening is you're comparing that the objects (Vector2f for each location) are the same, not that the objects' contents are the same. In this case, that's actually what you want, but using if (tmp == target) would make more "sense".
Oh, cool, good to know that works. I was in "Oh god everything is crashing let's not try to do anything that might not work" mode when I was tinkering with this.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 10, 2013, 06:34:50 PM
Glad that worked. Barely remembered it from a previous time (searching on the forum turned up nothing, guess it was via PM - a good argument for keeping questions to the forum rather than PMs...)

It was a rather odd one, yeah. Janino has some ... issues. It mostly works, and it's nice for a lower barrier-to-entry for some of the scripting, but I've pretty much entirely moved away from using scripts from new dev because of it, and its lack of support for a few things like generics and anonymous classes. Putting new moddable stuff inside an impl package in starfarer.api.jar, with the source code being available in starfarer.api.zip. (A current example would be the on-hit script for the Tachyon Lance, and other such.)

Oh, cool, good to know that works. I was in "Oh god everything is crashing let's not try to do anything that might not work" mode when I was tinkering with this.

Ah yes, I'm quite familiar with that :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WKOB on May 10, 2013, 08:58:09 PM
Sorry, I'm sure I'm asking things I could find my own answers to but the forum has bloated quite a bit over the months I've been on Starsector hiatus.

There are decorative weapons now, yes? How do they work?

Have ships, in general, had any major changes since Ship Systems were introduced?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on May 10, 2013, 09:03:17 PM
yes, there are decorative weapons now, they're still a little bugged though so I'd recommend not using them until the next patch...

to make one, you can start by looking at the sensor dish in starsector-core/data/weapons. the simplest one to make would be just renaming it and changing the picture, then adding the entry on weapons.csv

I'm not quite sure how to put it on a ship, though, at least by code. The newest version of trylobot sfedit has the decorative weapon slot feature so you can use that


no, I don't think ships have had any major changes since ship systems...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WKOB on May 10, 2013, 11:43:43 PM
Thanks, Gunny, I'll hold off on decorative weapons for now. Though, out of curiosity, do any vanilla ships currently use them?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on May 10, 2013, 11:53:28 PM
onslaught, but that was stated as unintentional and will be removed by next version
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on May 11, 2013, 12:56:35 PM
How would one go about adding a crap-ton of new graphics to the debris section? Would I just add them into a mod or is there some code changing needed...?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 11, 2013, 02:50:31 PM
Any chance for a shipsystem that when active, generates Command Points at an incredibly slow rate? I'm looking to make command ships have something to do with tactical commands, rather than just slapping snesor increases on them.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on May 11, 2013, 03:20:38 PM
Any chance for a shipsystem that when active, generates Command Points at an incredibly slow rate? I'm looking to make command ships have something to do with tactical commands, rather than just slapping snesor increases on them.
I'd love to see that!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WKOB on May 11, 2013, 03:23:09 PM
That'd definitely have to be scripted rather than done with in-game mechanics, but I can't help you any further than that. Neat idea, by the way.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Pelhamds on May 13, 2013, 01:50:05 AM
Is there any way to have the campaign character creation questions before picking a portrait picture?

e.g.

"I was a Imperial captain" --> Which would only allow me to use certain portraits depending upon which option I choose

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: WKOB on May 13, 2013, 10:15:33 AM
Also, is it feasible to change station graphics yet?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 16, 2013, 06:48:14 PM
Is there an easy and efficient way to modify mutable stats for every ship in combat at once? Essentially, I want the effects of a specific hullmod to be universal on all ships in combat. The best I can think of is having an every-frame combat plugin that cycles through all the ships in play every few seconds, and then applies the modifications to each of them. That, however, seems really stupid to me, and I'm curious if there's a better way.


@Austupaio: You can change station graphics as a whole, but not individually.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 16, 2013, 06:58:16 PM
An EveryFrameCombatPlugin would probably be the way to go. If you're worried about efficiency, a simple optimization would be to have it only run when the amount of ships on the field changes.

Code
public class Test implements EveryFrameCombatPlugin
{
    private CombatEngineAPI engine;
    private int numShips = 0;

    @Override
    public void advance(float amount, List events)
    {
        if (engine.isPaused())
            return;
        
        List allShips = engine.getShips();
        if (allShips.size() != numShips)
        {
            numShips = allShips.size();
            
            // Number of ships has changed, iterate through and re-apply bonus
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        this.engine = engine;
        numShips=0;
    }
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 16, 2013, 07:12:56 PM
Ah, okay. That's too bad... but, with your optimization, using EveryFrameCombatPlugin for this shouldn't feel too stupid. Thanks :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 17, 2013, 01:17:26 PM
Forgive the double post, but there seems to be an issue with the above solution.


Code
...
public static final float RANGE_BONUS = 150f;
private static final float HEALTH_BONUS = 1100f;
private static final float ENGINE_BONUS = 450f;
...



if (interval.intervalElapsed()) {

List ships = engine.getShips();

if (ships.size() != numShips) {

numShips = ships.size();
ShipAPI ship = null;

for (Iterator iter = ships.iterator(); iter.hasNext();) {

ship = (ShipAPI) iter.next();
if (ship.isHulk()) continue;


MutableShipStatsAPI stats = ship.getMutableStats();
stats.getWeaponHealthBonus().modifyPercent(ship.getFleetMemberId(), HEALTH_BONUS); //Will not apply bonus to ship.
stats.getEngineHealthBonus().modifyPercent(ship.getFleetMemberId(), ENGINE_BONUS); //Will not apply bonus to ship.
//stats.getBallisticWeaponRangeBonus().modifyPercent(ship.getFleetMemberId(), RANGE_BONUS); //Bonus is applied to ship.
//stats.getEnergyWeaponRangeBonus().modifyPercent(ship.getFleetMemberId(), RANGE_BONUS); //Bonus is applied to ship.
//engine.addFloatingText(ship.getLocation(), "!!", 15f, textColor, ship, 2f, 0.2f);
}
}
}

For some reason, the ship's weapon health and engine health will not be modified. The two commented-out lines, however, will apply the proper bonuses to weapon range without a problem. Any reason why this might be happening? The only thing I can think of is that for the hullmod, these bonuses were applied in "applyEffectsBeforeShipCreation", rather than "applyEffectsAfterShipCreation". So maybe these particular health modifications can't actually be applied while in combat?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 17, 2013, 01:28:04 PM
Is there any way to have the campaign character creation questions before picking a portrait picture?

There isn't.

Also, is it feasible to change station graphics yet?

No, not yet.


For some reason, the ship's weapon health and engine health will not be modified. The two commented-out lines, however, will apply the proper bonuses to weapon range without a problem. Any reason why this might be happening? The only thing I can think of is that for the hullmod, these bonuses were applied in "applyEffectsBeforeShipCreation", rather than "applyEffectsAfterShipCreation". So maybe these particular health modifications can't actually be applied while in combat?

Right. That, along with the hull hitpoints, flux capacity, the armor rating, and possibly a few other values, only get used at ship creation. You do, on the other hand, have stats to control the damage taken by weapons etc to work around that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on May 17, 2013, 01:37:23 PM
Right. That, along with the hull hitpoints, flux capacity, the armor rating, and possibly a few other values, only get used at ship creation. You do, on the other hand, have stats to control the damage taken by weapons etc to work around that.
Oh, derp. Totally forgot about all the other methods that could accomplish the same goal...

Thanks for the answer.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on May 17, 2013, 03:54:39 PM
How would one go about adding a crap-ton of new graphics to the debris section? Would I just add them into a mod or is there some code changing needed...?

Need to know.

>feel ignored
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 17, 2013, 04:02:25 PM
Sorry, missed it :) The debris graphics are in these locations:
graphics/debris/debris_sml0.png
graphics/debris/debris_sml1.png
graphics/debris/debris_sml2.png
graphics/debris/debris_sml3.png
graphics/debris/debris_med0.png
graphics/debris/debris_med1.png
graphics/debris/debris_lrg0.png
graphics/debris/debris_lrg1.png
You can replace them, but can't add new ones.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on May 17, 2013, 04:30:23 PM
/sadface


They have to referenced somewhere, right? Changing the API would be relatively easy.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thaago on May 24, 2013, 11:48:58 PM
I don't think this exists, but I'd love to be wrong: can we get a hook for just after a battle with a reference to the fought fleet (or their name)? For modifying faction relations for example.

If not, has anyone written a tracking script to hack around it?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 25, 2013, 12:12:26 AM
I don't think this exists, but I'd love to be wrong: can we get a hook for just after a battle with a reference to the fought fleet (or their name)? For modifying faction relations for example.

If not, has anyone written a tracking script to hack around it?

For player-vs-AI battles, you can use a custom BattleCreationPlugin implementation that broadcasts the fleets passed in. That will let you know what fleet the player is fighting, though obviously only if things get to the battle map stage.

For AI-vs-AI battles, I don't know of a good way to do it in the current version. I think the best you could do is constantly scan all fleets in the system for FP loss, then see if there was a nearby enemy fleet who could be the culprit. Not exactly the most accurate system (and accidents would really throw it off, obviously). :(

It's a moot point, though; the upcoming .6a patch's custom autoresolve plugin (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/impl/campaign/BattleAutoresolverPluginImpl.html) will give us access to all AI-vs-AI battles, leaving just the above solution for player-vs-AI for complete monitoring. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 25, 2013, 10:17:09 PM
Got a question. Is ther any way to make a projectile that doesn't inherit velocity? Or at the very least bring it's velocity down to 0?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on May 26, 2013, 09:03:16 AM
Got a question. Is ther any way to make a projectile that doesn't inherit velocity? Or at the very least bring it's velocity down to 0?

Space Mines?

Maybe by adding a burndrive-like script to the projectile. Basically missiles with some burndrive system, and when it run out, slow down to zero. Dunno if it could work with other weapons though.

I also got a question. Is it possible to make a weapon that ignore armor? Like hitting directly the hull of the enemy ship?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on May 26, 2013, 09:46:11 AM
I did it for a MIRV weapon, It's in my Battlefarer Forever mod, Dunno whether it's in current release :P

All i did was set the first projectile to have 0 top speed and acceleration, but 400000ish deceleration, with an insane launch speed, The launch speed controls distance :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 26, 2013, 11:11:33 AM
Right, a missile with a 0 top speed ought to do it.

I also got a question. Is it possible to make a weapon that ignore armor? Like hitting directly the hull of the enemy ship?

Could do it with an on-hit effect and directly setting the hull value/spawning floaties as appropriate. See the ion cannon .wpn file for more details on an on-hit effect.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 26, 2013, 11:14:47 AM
I also got a question. Is it possible to make a weapon that ignore armor? Like hitting directly the hull of the enemy ship?

Could do it with an on-hit effect and directly setting the hull value/spawning floaties as appropriate. See the ion cannon .wpn file for more details on an on-hit effect.

We can set the hull level manually? Where is that defined in the API? I feel like an idiot for missing it all this time...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 26, 2013, 11:20:53 AM
Erm. Sorry about that; ShipAPI.get/setHitpoints() will actually only be in 0.6a. Thought it was there already, but I was mistaken.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on May 26, 2013, 01:45:24 PM
Right, a missile with a 0 top speed ought to do it.

It still seems to inherit the speed of the launching ship. I have it sat as a phase_charge missile type because I need to have an AoE effect, I'm not sure if there's a missile type or something like that that doesn't inherit velocity and still enables the proximity fuse effect.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on May 26, 2013, 02:04:31 PM
If the missile has a non-zero acceleration value, yeah, it'll inherit the speed's velocity, but then it'll gradually stop - more quickly if the acceleration is high.

You could also add an EveryFrameCombatPlugin that checks all the projectiles every frame, and when it sees them for the first time, subtracts the source's velocity from the projectile's. I think that the currently-released API has all the methods to let you do that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on May 26, 2013, 02:09:12 PM
My way did it, but a big problem was that it sticks to the first target it sees, and will not change, regardless of distance
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on May 26, 2013, 02:19:35 PM
Right, a missile with a 0 top speed ought to do it.

It still seems to inherit the speed of the launching ship. I have it sat as a phase_charge missile type because I need to have an AoE effect, I'm not sure if there's a missile type or something like that that doesn't inherit velocity and still enables the proximity fuse effect.

As Alex said, you could have an EveryFrameCombatPlugin to strip the inertia. Here's some example code that would allow this (not tested!):
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamagingProjectileAPI;
import com.fs.starfarer.api.combat.EveryFrameCombatPlugin;
import com.fs.starfarer.api.input.InputEventAPI;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.lwjgl.util.vector.Vector2f;

public class RemoveShipInertia implements EveryFrameCombatPlugin
{
    // This is the ID of the projectile you want to remove imparted inertia from
    private static final String PROJECTILE_ID = "insert projectile ID here";
    // Contains the projectiles that have had their inertia stripped
    private Set done = new HashSet();
    // The engine instance for this battle, used to get all projectiles
    private CombatEngineAPI engine;

    @Override
    public void advance(float amount, List<InputEventAPI> events)
    {
        if (engine.isPaused())
        {
            return;
        }

        // Scan all projectiles on the map each frame
        DamagingProjectileAPI tmp;
        for (Iterator iter = engine.getProjectiles().iterator(); iter.hasNext();)
        {
            tmp = (DamagingProjectileAPI) iter.next();
            // Check if this projectile is the proper type and
            // hasn't had its imparted velocity removed yet
            if (PROJECTILE_ID.equals(tmp.getProjectileSpecId())
                    && tmp.getSource() != null && !done.contains(tmp))
            {
                // Subtract the veloctiy imparted by the firing ship
                Vector2f.sub(tmp.getVelocity(), tmp.getSource().getVelocity(),
                        tmp.getVelocity());
                done.add(tmp);
            }
        }

        // Remove all expired projectiles from the 'finished' list
        for (Iterator iter = done.iterator(); iter.hasNext();)
        {
            if (!engine.isEntityInPlay((CombatEntityAPI) iter.next()))
            {
                iter.remove();
            }
        }
    }

    @Override
    public void init(CombatEngineAPI engine)
    {
        this.engine = engine;
        // I'm 99% sure plugins aren't persistent, but just in case...
        done.clear();
    }
}
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on June 02, 2013, 05:23:40 PM
I haven't had the chance to try that script out until tonight. It works perfectly, literally perfectly. Thanks for your time Lazy, I honestly appreciate it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on June 08, 2013, 05:08:16 AM
Quote
AI Hints for weapons, we could use a few more of those. Myself I could very much use the following, or at least a few of them.
BAD_TRACKING: similar to the STRIKE hint for torpedoes, the weapon has a very poor turn rate so watch where you fire it.

HIGH_FLUX: the weapon uses a lot of flux whenever it fires or builds up flux very rapidly, so don't put it on autofire unless you have the flux to spare.

LOW_AMMO(should be AI integrated): The weapon has a very low ammo count or is running out of ammo, so try to make sure every single shot fired connects with the target.

Quote
We could also use a few more SHIP hints, like the following.

SLOW: The ship in question is very slow or does not maneuver very well, so fly it accordingly

HEAVY: The ship in question has a lot of mass to it, so if you have an opportunity to ram your enemy, do it ;D

WEAK: The ships armor or shields are very weak and perhaps does not have a very impressive armament, so this ship is clearly not designed for slugging with other ships, but rather flanking them and letting others ships do the slugging for you, so do exactly that.

STRONG: This ship has very strong armor or shields and powerful weapons, it's clearly designed to be in your face or be slugging against enemies, use it that way.

BALANCED: This ship has moderate of all the above, Use it for whatever job you need it to do.

BROADSIDER: This ships weapons are all mounted on its side(s), try to keep its side(s) facing the enemy.
Quote
Ideas?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on June 08, 2013, 07:51:30 AM
Quote
AI Hints for weapons, we could use a few more of those. Myself I could very much use the following, or at least a few of them.
BAD_TRACKING: similar to the STRIKE hint for torpedoes, the weapon has a very poor turn rate so watch where you fire it.

HIGH_FLUX: the weapon uses a lot of flux whenever it fires or builds up flux very rapidly, so don't put it on autofire unless you have the flux to spare.

LOW_AMMO(should be AI integrated): The weapon has a very low ammo count or is running out of ammo, so try to make sure every single shot fired connects with the target.

Quote
We could also use a few more SHIP hints, like the following.

SLOW: The ship in question is very slow or does not maneuver very well, so fly it accordingly

HEAVY: The ship in question has a lot of mass to it, so if you have an opportunity to ram your enemy, do it ;D

WEAK: The ships armor or shields are very weak and perhaps does not have a very impressive armament, so this ship is clearly not designed for slugging with other ships, but rather flanking them and letting others ships do the slugging for you, so do exactly that.

STRONG: This ship has very strong armor or shields and powerful weapons, it's clearly designed to be in your face or be slugging against enemies, use it that way.

BALANCED: This ship has moderate of all the above, Use it for whatever job you need it to do.

BROADSIDER: This ships weapons are all mounted on its side(s), try to keep its side(s) facing the enemy.
Quote
Ideas?

+1, especially for the broadside.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on June 08, 2013, 07:33:39 PM
Is it possible to make a weapon fire flares, and for the flares to actually work? Always wanted to make a flare turret but was never quite sure where to start/if it was possible.



Also, can missile weapons have recoil sprites? It'd make bay doors way easier if I could just have the door slide off with recoil, rather than animating it.

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on June 09, 2013, 05:08:30 PM
Any tips how to create a list of a specific class of ships Mothballed in a station?

To start:

List station_ships = station.getCargo().getMothballedShips().getMembersListCopy(); <-- This gets me a complete list of ships

Then I add this to the mix:

for (int i = 0; i < station_ships.size(); i++) {
                                MemberAPI = (FleetMemberAPI)station_ships.get(i);
                                if  (MemberAPI.isCapital()) {
                                Missing the needed line here to create a list of MemberAPI ships with only Capitals in it.
                                }
                            }
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on June 09, 2013, 09:17:14 PM
Any tips how to create a list of a specific class of ships Mothballed in a station?

To start:

List station_ships = station.getCargo().getMothballedShips().getMembersListCopy(); <-- This gets me a complete list of ships

Then I add this to the mix:

for (int i = 0; i < station_ships.size(); i++) {
                                MemberAPI = (FleetMemberAPI)station_ships.get(i);
                                if  (MemberAPI.isCapital()) {
                                Missing the needed line here to create a list of MemberAPI ships with only Capitals in it.
                                }
                            }

You'd need to declare the List of capitals outside the for loop, like this:
Code
List capitalShips = new ArrayList();
Then the line you would use in the for loop would be:
Code
 if  (MemberAPI.isCapital()) capitalShips.add(MemberAPI);


Also, you might want to be careful how you name things. It can be very confusing for other people to read your code if you don't follow standard naming conventions (http://java.about.com/od/javasyntax/a/nameconventions.htm).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on June 10, 2013, 02:51:04 AM
I see your point LW, but I never ever read anything about java and when a document talk me about identifiers I have no idea what is talking about.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on June 10, 2013, 05:07:17 AM
No worries, it was just an idle comment. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on June 12, 2013, 06:14:03 AM
CSV files, how do they work?

That's not the first time it happen to me. When i edit the CSV file and save it, no problem. But when i re-open the file, some numbers aren't in the right columns. So how do i get my CSV files to stay still and not doing weird stuffs whenever i modify them? I tried with OpenOffice and silentstormpt CSV Editor.

Also, what does "8/6/5/4%" means? I read somewhere that this column is unused, yet i see some mods using it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on June 12, 2013, 11:04:16 AM
CSV files, how do they work?

That's not the first time it happen to me. When i edit the CSV file and save it, no problem. But when i re-open the file, some numbers aren't in the right columns. So how do i get my CSV files to stay still and not doing weird stuffs whenever i modify them? I tried with OpenOffice and silentstormpt CSV Editor.

Also, what does "8/6/5/4%" means? I read somewhere that this column is unused, yet i see some mods using it.


i have no clue why your csv wont stay still (sounds weird) but i can answer for the 8/6/5/4 thingy, its only a benchmark on flux dissipation that alex did, it is indeed useless and if you see mods that do use it, its most likely because the mod maker is using that column for the same reason alex initially putted it.

dont worry about it, it really is unused as far as mechanical ship stats goes

answer from : personal experience, i asked that very question months ago when i started modding  ;D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on June 12, 2013, 02:12:54 PM
Another question. Still on the CSV. Especially the weapon CSV.

How do i put number with decimals? Let's say i want the burst delay of my weapon to be 0,5. But when i put a number with a "," the game register it as a zero and the weapon fire extremely fast.  While using the value 1 it work, but is too slow for my taste.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ValkyriaL on June 12, 2013, 02:14:49 PM
you put a dot instead of a comma. ,0.5,
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Silver Silence on June 12, 2013, 04:27:59 PM
Another question. Still on the CSV. Especially the weapon CSV.

How do i put number with decimals? Let's say i want the burst delay of my weapon to be 0,5. But when i put a number with a "," the game register it as a zero and the weapon fire extremely fast.  While using the value 1 it work, but is too slow for my taste.

Seeing as the CSV is formatted with commas, that would read simply as "0" to the game and the gun would presumably have a fire rate of "2147arblghtoofast"
So do it the normal american way instead of the european way and use a period. I assume you also know how the decimal point works? 0.5 is twice a second, 0.25 is 4 times a second, 0.1 is 10 times a second, yada yada yada.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Pelhamds on June 13, 2013, 12:51:33 PM
Well.....

I have made a Fatal error and have no idea what it is (I have checked the code ect and its correct) The fatal message was:

Fatal: 1
Check  starfarer.log for more info.

Had a look through the logs and could not find anything that was glaringly obvious, this was caused by changing the default text in the settings file to one i made....though when Silent did it in his thread he didn't have any problems....

Heres the Error Log:

 13837 [Thread-8] INFO  com.fs.profiler.Profiler  - ID                     Calls   Duration    Percent
 13837 [Thread-8] INFO  com.fs.profiler.Profiler  - --------------------------------------------------
 13838 [Thread-8] ERROR com.fs.starfarer.combat.String  - java.lang.ArrayIndexOutOfBoundsException: 1
 java.lang.ArrayIndexOutOfBoundsException: 1
   at com.fs.graphics.super.O0OO.o00000(Unknown Source)
   at com.fs.graphics.super.O0OO.o00000(Unknown Source)
   at com.fs.starfarer.loading.H.o00000(Unknown Source)
   at com.fs.super.A.?00000(Unknown Source)
   at com.fs.starfarer.combat.String.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:680)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on June 25, 2013, 12:08:55 PM
Hi folks,

i returned to the Thule Meteor Missile to change the color.

in the .proj file there is always the part about the engineslots:
   
Code
"engineSlots":[{"id":"ES1",
"loc":[-38, 0],
    "style":"TORPEDO_ATROPOS",
    "width":50.0,
    "length":100.0,
    "angle":180.0}]
if i change the style to a customized engine it gets an error. To make things worse i can't find the id "ES1" anywhere.
Anyone a hint for me?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on June 26, 2013, 06:49:04 PM
I have a ship system that basically boosts the systems of the ship for a set amount of time (Shield efficiency, flux dissipation, etc). When I use the ship it works fine, but when I run against it in a simulation it crashes the game. It's currently using the manuvering jets AI. I'm not sure if it has to do with that, or if I can somehow make my own system AI. Anyone have any ideas?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 08, 2013, 06:53:13 AM
Where is defined that Guardian PD got multiple beams, their number and position?
I am able to recreate tachyon beam with all its´ effects, but can´t find this.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 08, 2013, 09:11:37 AM
@Thule:  The problem there is that you're using an incompatible style, I think.  Build a custom engine style:

Code
	"engineSlots":[
{"id":"ES1",
"loc":[0, 0],
    "style":"CUSTOM",
"styleSpec":{
"engineColor":[100,255,100,255],
"contrailParticleSizeMult":6,
"contrailParticleDuration":2,
"contrailMaxSpeedMult":-0.2,
"contrailAngularVelocityMult":0f,
"contrailColor":[55,255,55,35],
"type":"GLOW" # GLOW or SMOKE
},
    "width":9.0,
    "length":10.0,
    "angle":180.0},
   ]

@Arumac:  You can code a custom System AI that will regulate the System according to your wishes.  See the API documentation for details about how to implement this.

@Ravendarke:  You need to add a line to the wpn, after defining all of your firing points: 

Code
"convergeOnPoint":true,

Bear in mind that the first point must be the one closest to zero on the Y axis; the first firing point is the one used to aim the weapon.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on July 08, 2013, 06:47:54 PM
Xeno thanks for the code, the colorchange worked fine ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on July 08, 2013, 07:43:48 PM

@Arumac:  You can code a custom System AI that will regulate the System according to your wishes.  See the API documentation for details about how to implement this.


Thanks, I'm not really a coder, but I like to fiddle around with things. I never knew there was any kind of actual API documentation on the web. After you mentioned it I started digging and found http://fractalsoftworks.com/starfarer.api/ which I think is what you're talking about.

Thanks again for pointing me in the right direction.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 12, 2013, 01:40:20 PM
Looking for script that makes possible beam weapon with charge up time (not that smooth build up that can be done by default, but really charge up with possible frame by frame deco animation as some projectile weapons got).

Just checking if this was done before, if not, I will look into it myself, thx.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on July 13, 2013, 04:27:07 PM
AFAIK, being a weapons expert (albeit kind of rusty), I don't think it's possible.

Although I do remember from the Ironclads mod a weapon that's pretty close to the one you want, called the "Heavy Beamer."  At least, if I remember what it was. :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on July 13, 2013, 04:45:17 PM
Looking for script that makes possible beam weapon with charge up time (not that smooth build up that can be done by default, but really charge up with possible frame by frame deco animation as some projectile weapons got).

Just checking if this was done before, if not, I will look into it myself, thx.

Try the Trader ship on the Star Control 2 mod im doing and see if its that what ur searching for
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 15, 2013, 03:39:47 PM
Do you mean variable blaster?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on July 15, 2013, 04:17:33 PM
Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Uomoz on July 15, 2013, 05:28:20 PM
This part of the code I'm working on gives me a lot of errors.

Spoiler

139116 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.StackOverflowError
java.lang.StackOverflowError
   at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at com.fs.starfarer.campaign.fleet.FleetData.ÖøÕ000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)

[close]

------------------------------------------------------------------------------

        private void Cycle (CampaignFleetAPI fleet) {   
                float a = (float) Math.random();
                if (a > 0.3)    {
                    fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, null, (int) Math.random()*10 + 5);
                    } else {
                    fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), (int) Math.random()*10 + 5);
                    }   
                Script script = null;
      script = createArrivedScript(fleet, getAnchor());
                fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, getAnchor(), 10, script);
                }
       

   private Script createArrivedScript(final CampaignFleetAPI fleet, final SectorEntityToken station ) {
      return new FleetScript(fleet, station) {
                    public void run() {
                    Cycle(fleet);

...
... various checks on the fleet using many local variables and parameters changing the cargo of the fleet and the fleet composition. ...
...
                }
            };
   }

------------------------------------------------------------------------------

Is there any way I can make it prettier or less prone to crashes? It seems that this things I try to do gets smashed quickly by StackOverflow.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 16, 2013, 03:51:54 AM
Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray

It is using "projectile" tag, and therefor it is using charge up for projectile weapons.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on July 16, 2013, 09:48:14 AM
Is is possible to have one .wpn file be the base for different weapons?  For example, I've got "mmm_1.wpn" and I want to make two different versions of it, same sprite, etc. but one has more ammo than the other.  That possible without having to copy the "mmm_1.wpn" twice?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Silver Silence on July 16, 2013, 09:53:49 AM
Why not just have mmm_1_2?
It'd mean greater control if the weapon was built-in for example. You can tweak the built-in and non-built in versions to offset their natures.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on July 16, 2013, 09:55:20 AM
It's not so much tweaking it.  It's that the base weapons for both are exactly the same (aside from the stuff inside the weapons.cvs file), and it'd save me a few headaches when coding into the game.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on July 16, 2013, 10:00:00 AM
Spoiler
This part of the code I'm working on gives me a lot of errors.

Spoiler

139116 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.StackOverflowError
java.lang.StackOverflowError
   at java.util.Arrays.mergeSort(Arrays.java:1270)
   at java.util.Arrays.sort(Arrays.java:1210)
   at java.util.Collections.sort(Collections.java:159)
   at com.fs.starfarer.campaign.fleet.FleetData.ÖøÕ000(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.syncIfNeeded(Unknown Source)
   at com.fs.starfarer.campaign.fleet.FleetData.getHangarSpace(Unknown Source)

[close]

------------------------------------------------------------------------------

        private void Cycle (CampaignFleetAPI fleet) {   
                float a = (float) Math.random();
                if (a > 0.3)    {
                    fleet.addAssignment(FleetAssignment.PATROL_SYSTEM, null, (int) Math.random()*10 + 5);
                    } else {
                    fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), (int) Math.random()*10 + 5);
                    }   
                Script script = null;
      script = createArrivedScript(fleet, getAnchor());
                fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, getAnchor(), 10, script);
                }
       

   private Script createArrivedScript(final CampaignFleetAPI fleet, final SectorEntityToken station ) {
      return new FleetScript(fleet, station) {
                    public void run() {
                    Cycle(fleet);

...
... various checks on the fleet using many local variables and parameters changing the cargo of the fleet and the fleet composition. ...
...
                }
            };
   }

------------------------------------------------------------------------------

Is there any way I can make it prettier or less prone to crashes? It seems that this things I try to do gets smashed quickly by StackOverflow.
[close]

Changing the fleet composition is what's triggering this. It's a bug in the game, fixed it a little while ago actually.


Is is possible to have one .wpn file be the base for different weapons?  For example, I've got "mmm_1.wpn" and I want to make two different versions of it, same sprite, etc. but one has more ammo than the other.  That possible without having to copy the "mmm_1.wpn" twice?

No.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on July 16, 2013, 12:10:55 PM
Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray

It is using "projectile" tag, and therefor it is using charge up for projectile weapons.

It uses the "advance" and pre-set timers while its "weapon.IsFiring()", once a timer condition is met, the actual animation loop is changed.
The reason im using a beam for this would be because i can keep track of how long its been firing and also i can use the beam brightness to check if it stopped firing.
If you try the ship on a mission you can understand how the code works. Theres a small problem tho, when you release (fire) it still shoots a few extras due to the brightness condition still triggering.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 17, 2013, 04:24:35 AM
Do you mean variable blaster?
Yes, while  it shoots projectiles, its actually a beam weapon, it where i based the death ray

It is using "projectile" tag, and therefor it is using charge up for projectile weapons.

It uses the "advance" and pre-set timers while its "weapon.IsFiring()", once a timer condition is met, the actual animation loop is changed.
The reason im using a beam for this would be because i can keep track of how long its been firing and also i can use the beam brightness to check if it stopped firing.
If you try the ship on a mission you can understand how the code works. Theres a small problem tho, when you release (fire) it still shoots a few extras due to the brightness condition still triggering.

I am not sure we are talking about same version, the newest version of star control II, uses 4 weapons to define variable blaster, each of them just energy PROJECTILE with default chargup mechanism for projectile weapons, not using any scripts. (basicly there are 4 different PROJECTILE blasters in one group, with different charge up time, no script etc).

And by the way, is there way how to modify engines other then engine_styles.json ?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on July 17, 2013, 03:39:16 PM
Theres 2 Mods of SC2, one made by Trylobot: http://fractalsoftworks.com/forum/index.php?topic=171.0
And a newer one by me: http://fractalsoftworks.com/forum/index.php?topic=3984.0

Im very sure you downloaded Try's mod, thats why its lacking the scripts and weapons
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 17, 2013, 04:26:40 PM
I've got a small question. In my Bushi mod there's a dark matter weapon available, which charges up when you fire it and then releases its projectile.
The problem is: If you rapidly click your fire button, the sounds will overlap eachother, like you're firing a ton of shots, but the weapon only has 1 ammunition. Ofcourse it only fires once.

Is there a way to stop the charge-up sound from playing if you're out of ammo? Or some other way to only have the sound play once?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Silver Silence on July 17, 2013, 04:59:03 PM
I'd like to know as well, so that I can go off and fix every weapon that has this issue. IFed Mass Drivers, IFed Hadrons, Thule Barbarossas, Hiigaran Singularity Cannons, to name a few.

So long as the trigger is held, the weapon will continue to fire. In the case of the Hadron, it's caused me to take quite significant damage due to being under the impression that the Hadron Accelerator is not in use as I haven't recently heard the long and distinct charge up.

Preferably, there should be an option to force the charge-up sound effect every time the weapon has the ability to fire. I say option because otherwise weapons like vanilla Thumpers would produce ghastly sounds as they whir up and simultaneously fire several times a second.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on July 18, 2013, 12:09:54 AM
I've noticed this as well and it's became a really bother for me in the past.

I'd say that there is no solution from my experience, but perhaps some bright minds know better :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on July 18, 2013, 01:05:28 AM
MWahahah I'll dig up old relevant quotes,

It's probably not a good idea to have the whole burst in the same sound file - consider what would happen if the ship overloaded / started venting / ran out of flux / etc mid-burst. Also consider that hull mods can change the rate of fire for a weapon.

That said, it shouldn't be playing the pre-burst sound if the weapon is on cooldown or can't fire for any other reason - I'll take a look.

The charge up/fireSoundOne is still imo a little wonky, it can play on chargedown/cooldown, empty ammo, while firing.

It something weird, all I know is that some of the problem comes from releasing the trigger before it fires, but having the weapon still play the sound,
It's fine if it charges up all the way fully (without releasing the trigger), but if you start clicking like mad, it just doesn't work well.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 18, 2013, 03:31:43 AM
That's a bummer.  :-\ I'll hope for a fix in the next update then. Thanks.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on July 18, 2013, 04:46:18 AM

And by the way, is there way how to modify engines other then engine_styles.json ?

Like this:

Code
      "style": "CUSTOM",
      "styleSpec": {
        "type": "GLOW",
        "engineColor": [
          68,
          250,
          50,
          255
        ],
        "contrailColor": [
          68,
          250,
          50,
          80
        ],
        "contrailParticleSizeMult": 1.0,
        "contrailParticleDuration": 0.25,
        "contrailMaxSpeedMult": 0.075,
        "contrailAngularVelocityMult": 0.0
      },
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 18, 2013, 06:32:37 AM

And by the way, is there way how to modify engines other then engine_styles.json ?

Like this:

Code
      "style": "CUSTOM",
      "styleSpec": {
        "type": "GLOW",
        "engineColor": [
          68,
          250,
          50,
          255
        ],
        "contrailColor": [
          68,
          250,
          50,
          80
        ],
        "contrailParticleSizeMult": 1.0,
        "contrailParticleDuration": 0.25,
        "contrailMaxSpeedMult": 0.075,
        "contrailAngularVelocityMult": 0.0
      },

Yep I know about this, I mean other properties, like texture etc, or if this ("engine_styles.json") is all we can redefine for engines.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 18, 2013, 06:50:24 AM
I think engine editing is fairly limited now, but I think I read somewhere that engines and shields will be able to custimized more in the upcoming version.
Please correct me if I'm wrong.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 21, 2013, 06:05:36 PM
Hello,

This script makes a decorative weapon turn 360 degrees and joy, it sure works. (Code is taken from Ironclads. Hope you don't mind!)
Code
package data.scripts.plugins;

import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.ShipAPI;

public class BushiVentilatorRotationEffect implements EveryFrameWeaponEffectPlugin {

private float currDir = Math.signum((float) Math.random() - 0.5f);

public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon) {
if (engine.isPaused()) return;
if (weapon.getShip().isHulk()) return;

float curr = weapon.getCurrAngle();
curr += currDir * amount * 100f;
float arc = weapon.getArc();

weapon.setCurrAngle(curr);
}

public static float normalizeAngle(float angleDeg) {
return (angleDeg % 360f + 360f) % 360f;
}
}

Unfortunately there's magic in it which makes the object turn left or right at a random chance, and I'd like it to only go left.
Does anyone know what magic to remove or adjust in order to get the decoration go left?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on July 22, 2013, 01:17:08 AM
Gotcha!:

The variable currDir is responsible for direction, and is randomly set to 1 or -1 near the top. If you want to rotate counterclockwise, change it to always be 1f. For clockwise, it'd be -1f.

If you want to change the rotation speed, you would change the amount * 100f to amount * <degrees per second>.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 22, 2013, 04:47:04 AM
Thanks! :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 22, 2013, 03:56:03 PM
I should probably try it before I ask, but still: Is it possible to make PD that will target even incoming projectiles? I know it is possible to set pierce set to actually hit projectile, but I need PD to actively target them.

I would also like to ask if there is a way how to make hull mods and weapons unusable by player in mission. I mean different way them make everything inbuilt.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: PCCL on July 22, 2013, 04:42:55 PM
1 is not possible afaik

2 can be done, if nothing else you can make something cost like 1000 OP and give them to the AI via variant editing. But depending on what exactly you're trying to do I might be able to suggest a more elegant solution
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Flare on July 22, 2013, 07:03:32 PM
I'm making a general hullmod, and one issue that came up was the IDs and the names.

In hullmods.csv There's a column for "names", "id", and "script".

In the individual hullmods files like heavy armor, there's only one term that references the terms in hullmods.csv and that is:

Code
public class HeavyArmor

Lets say that I'm adding a range of armor hullmods, and am working with one file right now.

What references "HeavyArmor"? Is it "names" or "id"? I know "script" pretty much already points to the file the csv file needs to look at, so what are the other two? Is "id" for heavy armor in public class heavy armor in the hullmod file, and name is what shows up in game? Isn't the "id" redundant since the csv file already points to the hullmod file in question?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Thule on July 22, 2013, 11:10:50 PM
I would also like to ask if there is a way how to make hull mods and weapons unusable by player in mission. I mean different way them make everything inbuilt.

Look up my mod, the R.U.N.E hull mod was coded by Lazywizard in a way that only ships with the hull id prefix "thule_xxx" can use it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 23, 2013, 12:58:06 AM
I would also like to ask if there is a way how to make hull mods and weapons unusable by player in mission. I mean different way them make everything inbuilt.

Look up my mod, the R.U.N.E hull mod was coded by Lazywizard in a way that only ships with the hull id prefix "thule_xxx" can use it.

Great, thank you.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 23, 2013, 01:19:58 AM
The other way to approach that is to simply code up a Plugin that regulates any player-only features specifically for them and only if played by the AI.  Then it's a silent buff that players can't have and won't see.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on July 23, 2013, 06:10:48 AM
I'm making a general hullmod, and one issue that came up was the IDs and the names.

In hullmods.csv There's a column for "names", "id", and "script".

In the individual hullmods files like heavy armor, there's only one term that references the terms in hullmods.csv and that is:

Code
public class HeavyArmor

Lets say that I'm adding a range of armor hullmods, and am working with one file right now.

What references "HeavyArmor"? Is it "names" or "id"? I know "script" pretty much already points to the file the csv file needs to look at, so what are the other two? Is "id" for heavy armor in public class heavy armor in the hullmod file, and name is what shows up in game? Isn't the "id" redundant since the csv file already points to the hullmod file in question?


None of the three need to be the same (look at Insulated Engine Assembly).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 24, 2013, 06:42:21 AM
Did I miss something or there isn´t way how to repair armor during battle?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 24, 2013, 07:29:23 AM
There is no method to repair Armor during battle at this time.

However, you can repair Hull and make it act almost identically to regenerating Armor in terms of effects on damage.  That gets a little complicated, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 24, 2013, 10:13:11 AM
Yeah, thx. I wished for armor regeneration, due to psychological effect: Damaged armor can be seen on the ship, it´s like.. "yeaaah, I´ve finally get through shields, I will finish it sooner or later"... but when ship could, even by graphic effect, repair itself to state when it is "like a new" it should couse: "Oh my god, what is this think".

Anyway thank you for answer :)

Let´s continue in my spam of questions: I know this isn´t probably possible, but maybe someone will have workaround
I would like to make mission where player will pilot only one ship. There should be two fleets, one allied (or neutral) to player, second hostile to all. I know I can make that the player has flagship that he can´t leave (transfer command), but I don´t want him to be able to command other ships... hmm thinking about it, maybe some way how to limit command points to 1?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 24, 2013, 11:23:04 AM
Command points are set via the mission's code.  So just remove all the CP. 

It won't make the "friendly" fleet behave very intelligently, though- they'll be on default Search 'n Destroy orders; to achieve that goal you'll have to set their AIs during the initial phase via a plugin and occasionally give them new orders.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 24, 2013, 12:04:19 PM
That will be fine, it suppose to be slaughter anyway :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 24, 2013, 12:19:20 PM
Bear in mind that all their losses will count against the player when the score's tabulated, though  ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 25, 2013, 02:00:01 PM
Yeah, that doesn´t matter, it suppose to be really impossible mission, just a part of story telling. So no score above 0% expected.

Question about pierce sets: I tried few combinations, created ship piercing beam and such, but I didn´t manage to create beam weapon that actually collide and destroy projectiles (tho they have hitpoints), ideas?

Btw is there some mod using plugins to setup missions? (So I could get some inspiration and see what is possible)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 25, 2013, 07:48:40 PM
LazyWizard provided an example and I've written one that does a pretty explicit job of creating a specific environment (I created a bunch of "space junk" as part of the mission). 

There are some minor hangups I've been having, primarily having to do with assigning things to neutral parties (for 3-way missions and other tasks) but it's very flexible, only major limitations on mission structures are time and coding skill.  You could make a simple RPG mission with FedEx questing and the like, even.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on July 27, 2013, 06:46:05 PM
Is there a way to reproduce the explosion effect form a large ship (screen whiteout) with a missile? Also, for the same missile, how do I get large AoE EMP damage?

If you can't tell I'm trying to make realistic-ish nukes >.>
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 28, 2013, 10:45:46 AM
I got a problem with my first weapon ever. I got the sprite in the game with no errors, but it doesn't fire when you use LMB. It has its own projectile file, .wpn and graphics for both of the above. The only thing it doesn't have is a custom sound file. (I just took the vanilla sound config and put it in my mod for now). It uses the light_needler_gun sound. Is ther any reason why it won't fire? I'm really excited for my mod!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 28, 2013, 10:54:09 AM
Can you post your weapon_data.csv and your .weapon file?

Edit: I too have a desire for help.

I'm making two mini factions, and the game starts fine when these are enabled. But the Nexus fleets do not seem to attack enemies and vice versa. When another fleet meets with a Nexus fleet, they just stack on top of eachother like two mating flies. What gives? O_o

Download: Nexus (http://avatar.home.xs4all.nl/crap/Nexus_v001.rar)

Two screenshots, Tritachyon and Nexus just sitting there, nothing happening:
Spoiler
(http://avatar.home.xs4all.nl/crap/screenshot011.png)
(http://avatar.home.xs4all.nl/crap/screenshot012.png)
[close]


And the Free Miners Guild fleets simply won't appear. *scratches head*
They should appear in the same manner as independent fleets, that was my goal.

Download: Free Miners Guild (http://avatar.home.xs4all.nl/crap/FreeMinersGuild_v001.rar)

Can someone help me out please? :-X
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 28, 2013, 05:39:24 PM
http://www.mediafire.com/download/owv7bl7794py26p/Citadel_Defenders_0.5pre.zip (http://www.mediafire.com/download/owv7bl7794py26p/Citadel_Defenders_0.5pre.zip)

Alright, here is the link to download my pre-release. The weapon is called fox_lightacel. By the way, the sounds are the sounds of the needler, so I just renamed the needler shots and changed their addresses in the sound config file. Thanks!

Also, how do you get only one station defense fleet to spawn? Do you just create another spawn point that only spawns defense fleets with one max fleet, or what?


Oh yeah, another question. When do the convoys spawn? I don't know how to get them to spawn. It doesn't create and error, so I assume its ok.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on July 28, 2013, 06:04:16 PM
Can you post your weapon_data.csv and your .weapon file?

Edit: I too have a desire for help.

I'm making two mini factions, and the game starts fine when these are enabled. But the Nexus fleets do not seem to attack enemies and vice versa. When another fleet meets with a Nexus fleet, they just stack on top of eachother like two mating flies. What gives? O_o

Download: Nexus (http://avatar.home.xs4all.nl/crap/Nexus_v001.rar)

Two screenshots, Tritachyon and Nexus just sitting there, nothing happening:
Spoiler
(http://avatar.home.xs4all.nl/crap/screenshot011.png)
(http://avatar.home.xs4all.nl/crap/screenshot012.png)
[close]


And the Free Miners Guild fleets simply won't appear. *scratches head*
They should appear in the same manner as independent fleets, that was my goal.

Download: Free Miners Guild (http://avatar.home.xs4all.nl/crap/FreeMinersGuild_v001.rar)

Can someone help me out please? :-X

Did you make sure nexus and the Tritachyons are actually hostile to each other?

http://www.mediafire.com/download/owv7bl7794py26p/Citadel_Defenders_0.5pre.zip (http://www.mediafire.com/download/owv7bl7794py26p/Citadel_Defenders_0.5pre.zip)

Alright, here is the link to download my pre-release. The weapon is called fox_lightacel. By the way, the sounds are the sounds of the needler, so I just renamed the needler shots and changed their addresses in the sound config file. Thanks!

Also, how do you get only one station defense fleet to spawn? Do you just create another spawn point that only spawns defense fleets with one max fleet, or what?


Oh yeah, another question. When do the convoys spawn? I don't know how to get them to spawn. It doesn't create and error, so I assume its ok.

When you create the spawn point higher up in the file, there's an argument that sets how many fleets it can create maximum - I believe it's the fourth argument. Set that to zero; this means the spawn point only works when you call it manually. Then later in the gen file, call YourNameHerespawn.spawnFleet();

Example:
Code
	HegemonyPatrolSpawnPoint patrolSpawn = new HegemonyPatrolSpawnPoint(sector, system, 10, 0, hegemonyStation);
system.addSpawnPoint(patrolSpawn);
patrolSpawn.spawnFleet();

Anyone know how to slow down a ship to it's current max top speed while the ship system is active?

Think a maneuvering jets but slows you down to the current maximum speed ( of 0 units ).

I know the Burn drive slows you down at the end of it's use but does it work for active use?

Code
	public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
if (state == ShipSystemStatsScript.State.OUT) {
stats.getMaxSpeed().unmodify(id);
} else {
stats.getMaxSpeed().modifyFlat(id, 200f * effectLevel);
stats.getAcceleration().modifyFlat(id, 200f * effectLevel);
}
}

Into:

Code
	public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
if (state == ShipSystemStatsScript.State.OUT) {
stats.getMaxSpeed().modifyFlat(id, 100f * effectLevel);
stats.getAcceleration().modifyFlat(id, 100f * effectLevel);
} else {
stats.getMaxSpeed().unmodify(id);
}
}

Lol idk.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 28, 2013, 06:09:23 PM
Thanks!
I'm still having trouble with my light ACEL weapon though. Any help on that?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on July 28, 2013, 06:18:30 PM
Not sure what the problem is with your gun, it works fine for me,

Spoiler
(http://i.imgur.com/U843CQE.png)
[close]

Though my only concern is that they use a lot of flux to fire, are you sure the ship you mount them on has enough flux for them to fire?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 28, 2013, 06:21:19 PM
@Foxer360: It works for me. BUT. I think the ship you're using might not have enough flux to fire it, since it uses an insane amount of flux.
You make it burstfire 25 rounds and each shot will use 55 energy. That's 55x25=1375 flux with one burst.
Edit: Ninja'd by FlashFrozen.

@FlashFrozen: Yes, they're enemies. I included two screenshots too. It's very weird. I don't understand it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 28, 2013, 06:23:45 PM
Whoops. I think I went a bit overboard on the flux. I mounted my ACEL on the hound, but it didn't have enough capacity to fire.
XD Oh yeah, and the Zenta you used doesn't drain soft flux with its shields up ATM.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Zaphide on July 28, 2013, 06:39:54 PM
@FlashFrozen: Yes, they're enemies. I included two screenshots too. It's very weird. I don't understand it.

Check the StarSector log; sometimes the game will throw an exception that is caught, and it should appear in the log. IIRC I had a similar problem once and exceptions were appearing in the log but StarSector carried on merrily :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 28, 2013, 07:22:43 PM
Quote
Is there a way to reproduce the explosion effect form a large ship (screen whiteout) with a missile?
Largish numbers of really huge glow particles in the AOE definition of the projectile.

Quote
Also, for the same missile, how do I get large AoE EMP damage?
EMP is handled just like regular damage.  If it has 20K EMP damage, everything in the AOE that is able to collide is going to take 20K EMP.

Quote
Anyone know how to slow down a ship to it's current max top speed while the ship system is active?
Just do Burn Drive's script in reverse, but that will not change current velocity.  If you want to change current velocity when it's active, you need to have it alter the velocity component of the Entity over time (like, just multiply the XY by 0.99f or whatever).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vinya on July 28, 2013, 11:07:54 PM
Also how is AoE determined with weapons?

>.>
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on July 29, 2013, 05:09:12 AM
AoE is determined in the .proj file for it.  As far as I know, only missiles weapons can actually have that setting, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 29, 2013, 05:29:09 AM
Check the StarSector log; sometimes the game will throw an exception that is caught, and it should appear in the log. IIRC I had a similar problem once and exceptions were appearing in the log but StarSector carried on merrily :)

Nothing in the log as well. Go figure.
I am going to create two separate threads for both my issues.

Edit: It suddenly struck me! Gawd, what an idiot I am. I solved the Nexus issue.
They do initiate a fight with the player and after I let my second in command handle the fight (which I tried 2 seconds ago) the enemy all fled! Then this old light bulb began to burn above my head.
Problem is: They have no crew! They're an AI, and only AI. No robots or whatever. So I gave the ships no crew. This generates a huuuge side effect apparently.
Cripes. Hopefully future versions will allow fleets to have no crew or have no option to be conquered.

Edit2: No, scrap all that. Problem still persists. -_-
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 29, 2013, 08:52:14 AM
They must have Crew, Supplies and Fuel, and be hostile.  Start a new game after fixing the no-crew problem and re-try. Other than that... should work?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 29, 2013, 10:37:21 AM
I always start a new game after fixing something, to be on the safe side. No luck though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 29, 2013, 10:56:25 AM
Ok, I have some free timelater on. I'll get back to you, 4 hours at most.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 29, 2013, 11:36:12 AM
civilian tag by any chance? :D
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: The Soldier on July 29, 2013, 02:30:54 PM
I think there is a civilian tag, in the ship.cvs in the "HINTS" area.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 29, 2013, 02:57:12 PM
I know, it was just suggestion for Gotcha!... if by any chance he doesn´t set civilian tag for those ships.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 29, 2013, 03:05:00 PM
I might not be the brightest lightbulb in the christmas tree, but give me SOME credit at least. :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 29, 2013, 04:36:20 PM
I am sorry, I have meant no offense, it just could happen while testing something.. it was just idea.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 29, 2013, 05:44:39 PM
Don't worry, I took no offense. I was just kidding with you. ;)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Lightfeather on July 29, 2013, 06:15:16 PM
Hey guys, new to the forums here (although I've stalked it for some time). I had a question about fleet points; I started a new game a couple weeks ago with Exerelin installed (great mod, btw), and I've since reached about as far as I can go with fleet points before risking accidents that make my fleet un-usable. I've tried editing my save to increase my fleet points, the only problem is I load my save and my cap hasn't changed! ??? I'm 95% sure I found the correct Fleet Point value, so any help would be greatly appreciated.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 29, 2013, 06:26:06 PM
My fighter squadrons are broked! Oh noes! Can anyone tell me what's wrong?

FoxLWing and FoxGunship are the in-game ID's

http://www.mediafire.com/download/dg8htdrm0x0238r/Citadel_Defenders_0.6pre.zip (http://www.mediafire.com/download/dg8htdrm0x0238r/Citadel_Defenders_0.6pre.zip)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on July 29, 2013, 06:33:21 PM
Anyone know anything about on hit effects for missiles?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on July 29, 2013, 06:38:25 PM
Anyone know anything about on hit effects for missiles?

I do believe it is mentioned in 0.60a patch notes... so.. later :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 29, 2013, 06:41:46 PM
@Foxer360: What's broken about them?
I can't add them through the console. Console seems to be ensisting on adding _wing after FoxLWing when I try to add it. (FoxLWing_wing, which ofcourse does not exist.)

Edit: When I add the ships with the addship command and fly in them they seem to work just fine.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on July 29, 2013, 06:44:54 PM
Anyone know anything about on hit effects for missiles?

I do believe it is mentioned in 0.60a patch notes... so.. later :)

Aha, I haven't read the patchnotes in awhile.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on July 29, 2013, 06:48:46 PM
You aren't supposed to fly them! Is the fox wing an actual fighter wing?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 30, 2013, 03:27:55 AM
I guess so, you made them a fighter wing, right? /confused
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on July 31, 2013, 02:48:18 PM
Is there a way to really limit a missile's range? I've created some sort of energy missile (in appearance) and want to have it a range of 800-1000, but it flies really far. Even when setting the range to 0 in weapons.csv it still goes off screen. (Probably because missiles still travel after their engines go out, even though mine doesn't have one.)

Has anyone found a workaround for this?


Edit: Gawd, I am such a tard sometimes. The flight time field was empty. x)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Flare on July 31, 2013, 08:49:19 PM
Might want to change the range back up from 0 when you're done. The AI uses that variable when deciding when they should shoot the enemy. On other weapons it might not be all that out of place, but I'm sure you know missiles' flight time and the range are separate values.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on July 31, 2013, 09:40:37 PM
Since the reverse burn drive thing I tried didn't work, on to the next one :D


0.54.1a

Modding:
Beam and burst beam weapons can now be animated (but the glow sprite can not, must remain the same for all frames)

Well I tried to make an animated weapon, but the animation part of it doesn't work >>"

Apology for not being able to take consecutive screenshots, Starsector crashes after just one screenshot, So this is how it looks,

Spoiler
(http://i.imgur.com/uyALNOK.png)

(http://i.imgur.com/2wpy2xT.jpg)
[close]

It shows only the first frame, once you fire, the weapon disappears, and the reappears after what probably means it cycled through all the frames.

Code
{
"id":"neutrino_phasedarray2",
"specClass":"beam",
"type":"ENERGY",
"size":"LARGE",
"displayArcRadius":1100,
"turretSprite":"graphics/neut/weapons/phasedarray/neutrino_phasedarray_base00.png",
"hardpointSprite":"graphics/neut/weapons/phasedarray/neutrino_phasedarray_base00.png",
"numFrames":16,
"frameRate":30,
"turretOffsets":[-80, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[-80, 0],
"hardpointAngleOffsets":[0],
"fringeColor":[212,60,25,255],
"coreColor":[255,255,255,255],
#"glowColor":[212,60,25,235],
"darkCore":false,
"width":50.0,
"textureType":ROUGH,
#"textureType":["graphics/fx/emp_arcs.png","graphics/fx/emp_arcs.png"],
"textureScrollSpeed":292.0,
"pixelsPerTexel":5.0,
"pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],
"fireSoundOne":"neutrino_heavybeam_firing",
"fireSoundTwo":"beam_heavy_loop",
}

Am I missing something  ???
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on July 31, 2013, 10:23:44 PM
It's type ENERGY; pretty sure it has to be type BALLISTIC.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on July 31, 2013, 10:29:10 PM
It's type ENERGY; pretty sure it has to be type BALLISTIC.

Tried that, it still produces the same result lol.

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 02, 2013, 05:47:31 AM
Missiles can accelerate after being fired. I wonder, is this also possible for ballistic projectiles? If so, does anyone know a weapon that uses this?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: phyrex on August 02, 2013, 08:15:42 AM
Missiles can accelerate after being fired. I wonder, is this also possible for ballistic projectiles? If so, does anyone know a weapon that uses this?

i think it isint possible. its because missiles are objects with theire own propulsion, so they have a "flying" speed and a "launched" speed.

but im not lazywizard either so im not sure :P
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 02, 2013, 09:22:06 AM
You can by setting its velocity in a script, just grab a interval timer and once it ends you can set a new velocity to it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on August 04, 2013, 04:53:01 PM
Anyone know of a way to make an invisible beam? I'm pretty sure I can't get it via the RGBA values :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 04, 2013, 04:55:30 PM
Set it like

0,0,0,255
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on August 04, 2013, 05:48:38 PM
Set it like

0,0,0,255

Wouldn't that just make it black?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on August 04, 2013, 05:51:53 PM
Set it like

0,0,0,255

Wouldn't that just make it black?
Yes, it would--make sure the last of the four numbers is 0 (it's the alpha channel). So, 0,0,0,0. Though the first 3 numbers don't actually matter. Though actually, 0,0,0,255 might work if the beams are only additive.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 04, 2013, 06:16:42 PM
Sorry, it's either 0,0,0,0 or 0,0,0,255
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on August 05, 2013, 04:42:35 PM
Another question. I have a system I want to make, were it will instantly vent a set amount of flux and play an animation. I think I can do that part. However I need a second part were there's a percent chance to damage and overload the ship instead. Basically the ship is an unstable prototype generator with the bare minimum ship parts.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 07, 2013, 05:43:09 AM
Got a custom beam weapon, seems like
"   "textureType":["graphics/BR/missiles/plasmaray.png","graphics/BR/missiles/plasmaray2.png"],"
is valid and used by the game, the question is which texture is used and why? Is one for the core of the beam and one for the edge?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 07, 2013, 08:13:51 AM
Got a custom beam weapon, seems like
"   "textureType":["graphics/BR/missiles/plasmaray.png","graphics/BR/missiles/plasmaray2.png"],"
is valid and used by the game, the question is which texture is used and why? Is one for the core of the beam and one for the edge?

Exactly, one for core, one for fringe.... second one should be core btw.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 07, 2013, 08:52:39 AM
Awesome, thanks!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ThePinkPanzer on August 09, 2013, 01:42:04 AM
Can anyone point me towards a custom weapons tutorial? The wiki has nothing and I can not find one for the life of me.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sleepyfish on August 09, 2013, 08:01:01 AM
Search up Psyion on youtube. He should have a tutorial for ya'!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 09, 2013, 09:10:25 AM
I'd make one, but can't get fraps to work to record desktop
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: ThePinkPanzer on August 09, 2013, 10:48:58 AM
Search up Psyion on youtube. He should have a tutorial for ya'!
Righto, goof stuff. Thanks.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 10, 2013, 09:50:57 AM
(http://i.imgur.com/8xGw2vK.jpg)
I have a few theories myself but don't have time to check right now, what is it that causes the glow to be offcenter from the actual projectile sprite like this? Do I need to add a center value like on a missile? The sprite is square.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 11, 2013, 11:24:10 AM
That's just where the engine renders the glow, at the "real" location of the projectile, which is right on the edge between the bullet and the tail. Which is definitely problematic in some cases, I've got to take another look at it.

Don't want to just blanketly change it to be the middle of the bullet, though, as that tends to completely overwhelm the bullet sprite.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 11, 2013, 11:42:51 AM
Well, ideally it would be great to have another field to input the offset of the glow from the center of the sprite or something.

A different question, what would be the most practical way to add an effect similar to a 360 muzzle flash to an OnHitEffect? Tons of particles with random vectors? Seems like a bit of a roundabout way to do it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 11, 2013, 11:44:18 AM
Glow offset would be great.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 11, 2013, 11:57:36 AM
A different question, what would be the most practical way to add an effect similar to a 360 muzzle flash to an OnHitEffect? Tons of particles with random vectors? Seems like a bit of a roundabout way to do it.

CombatEngineAPI.addSmoothParticle(), yeah. That's how regular muzzle flash works, the MUZZLE_FLASH spec contents are just parameters to the code that spews them out, nothing more special than that.


Well, ideally it would be great to have another field to input the offset of the glow from the center of the sprite or something.
Glow offset would be great.

Right, that sounds sensible. Added to the (rather long) list.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 11, 2013, 12:06:56 PM
You da man, Alex. Would it be possible to see the muzzle flash spec blown up into code, just for the sake of learning?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 11, 2013, 12:21:00 PM
It just uses polar coordinates to spawn stuff in an arc.

Spoiler

for (int i = 0; i < numParticles; i++) {
   float size = range * (float) Math.random() + min;
   float theta = (float) (Math.random() * Math.toRadians(spread) + Math.toRadians(angle - spread/2f));
   float r = (float) (Math.random() * length);
   float x = (float)Math.cos(theta) * r;
   float y = (float)Math.sin(theta) * r;
   Vector2f pos = new Vector2f(point.x + x, point.y + y);
   Vector2f vel = new Vector2f(x + shipVel.x, y + shipVel.y);
   // add particle here, using size/pos/vel
}
"point" is where the flash starts. Also note that it's using the offset from the point as the velocity, too; there's no reason it *has* to be that way, just happens to work fairly well.
[close]

Edit: I should say, there are definitely other ways to approach generating a muzzle flash. This one is pretty simplistic, but generally seems good enough.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Zaphide on August 12, 2013, 01:32:12 AM
Does anyone know how to check if a mod is installed, and if so which version?

Currently I am checking if a mod is installed like this (example):
Code
try
{
Global.getSettings().getScriptClassLoader().loadClass("data.scripts.world.HiigaraGen");
return true;
}
catch (ClassNotFoundException ex)
{
return false;
}

which works well, but doesn't get me the version of the mod. Anyone have any ideas? :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: JosephPierce on August 12, 2013, 10:45:27 AM
ah, i see, okay i guess there is the problem. the frames are numbered in three digits and the number is not at the end of the filename.

What i did:
I took okims mod "ironclad" and tried to mimic his landing led light (http://www.niceledlights.com).

The following files are involved:

D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\scripts\plugins\isHulkCheck.java
Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.combat.FluxTrackerAPI;

public class isHulkCheck implements EveryFrameWeaponEffectPlugin
{

 public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
  {
   if (engine.isPaused()) return;

   AnimationAPI animation = weapon.getAnimation();
 
   if (weapon.getShip().isHulk())
    {
    animation.pause();
    }

   else
    {
     animation.play();
    }  

  }

}




D:\Program Files (x86)\Fractal Softworks\Starsector\mods\Thule Legacy\data\weapons\thule_deco_heimdahl.wpn
Code
{
"id":"thule_deco_heimdahl",
"specClass":"projectile",
"type":"DECORATIVE",
"size":"MEDIUM",

"everyFrameEffect":"data.scripts.plugins.isHulkCheck",

"turretSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",
"hardpointSprite":"graphics/TL/weapons/decor/thule_heimdahl_Frame-01.png",

"numFrames":60,
"frameRate":15,
"alwaysAnimate":"true",

"turretOffsets":[0, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[0, 0],
"hardpointAngleOffsets":[0],

"barrelMode":"ALTERNATING", # or LINKED.  whether barrels fire at the same time or alternate.
"animationType":"MUZZLE_FLASH",  # NONE, GLOW, MUZZLE_FLASH, SMOKE
"muzzleFlashSpec":{"length":0.0,   # only used if animationType = MUZZLE_FLASH
  "spread":10,
  "particleSizeMin":4.0,
  "particleSizeRange":18.0,
  "particleDuration":0.2,
  "particleCount":25,
  "particleColor":[255,150,30,200]},

"projectileSpecId":"thule_barbarossa_shot",  # projectile that will be fired
"fireSoundTwo":"thule_barbarossa",
"fireSoundOne":"thule_barbarossa_overload",
}
[/u]
hello were you able to sort out the problem.. I am facing similar issue with my program files so please help.. Please reply thanks in advance:)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on August 12, 2013, 11:10:52 AM
It just uses polar coordinates to spawn stuff in an arc.

Spoiler

for (int i = 0; i < numParticles; i++) {
   float size = range * (float) Math.random() + min;
   float theta = (float) (Math.random() * Math.toRadians(spread) + Math.toRadians(angle - spread/2f));
   float r = (float) (Math.random() * length);
   float x = (float)Math.cos(theta) * r;
   float y = (float)Math.sin(theta) * r;
   Vector2f pos = new Vector2f(point.x + x, point.y + y);
   Vector2f vel = new Vector2f(x + shipVel.x, y + shipVel.y);
   // add particle here, using size/pos/vel
}
"point" is where the flash starts. Also note that it's using the offset from the point as the velocity, too; there's no reason it *has* to be that way, just happens to work fairly well.
[close]

Edit: I should say, there are definitely other ways to approach generating a muzzle flash. This one is pretty simplistic, but generally seems good enough.

Thanks a lot!!! One question, is there a boolean to determine if a weapon is charging? I want to make a reverse muzzle flash animation while the Nevermore's built-in weapon is charging, but I think it could prove somewhat tricky.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 13, 2013, 10:02:00 AM
Spoiler
Does anyone know how to check if a mod is installed, and if so which version?

Currently I am checking if a mod is installed like this (example):
Code
try
{
Global.getSettings().getScriptClassLoader().loadClass("data.scripts.world.HiigaraGen");
return true;
}
catch (ClassNotFoundException ex)
{
return false;
}

which works well, but doesn't get me the version of the mod. Anyone have any ideas? :)
[close]

There's nothing official, though you might be able to come up with something even more creative :) Made a note on my list - not sure if I'll be able to get to it, though.

One question, is there a boolean to determine if a weapon is charging? I want to make a reverse muzzle flash animation while the Nevermore's built-in weapon is charging, but I think it could prove somewhat tricky.

You could get a pretty good idea using the various WeaponAPI methods (isFiring(), getCooldownRemaining(), etc).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 13, 2013, 12:45:53 PM
I think it is possible, but just to make absolutely sure (I need to know while spriting and I don´t want to switch to coding until I finish actual ship sprite).

I need to fire few containers in specific directions after firing weapon (projectile). So basically through everyframe plugin I will check if weapon fired, if so I will spawn few containers floating away from ship (they should explode after a while). It is possible, right?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 13, 2013, 12:54:46 PM
Like cartridges from a gun, yes it possible, you should use a Interval timer to from x to x seconds to make sure its both firing and it doesn't spawn too many "projectiles".
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 13, 2013, 01:43:14 PM
Like cartridges from a gun, yes it possible, you should use a Interval timer to from x to x seconds to make sure its both firing and it doesn't spawn too many "projectiles".

There is going to be long cooldown, like 15-20 seconds, it should fire 3 cartridges on each side (basically flux pods for cooldown - so I will basicly hardcode 6x cartridges per shop with preset direction and speed)... but now tricky party: Those cartridges ejectors suppose to be animated... it is possible to create them as deco, attach them to ship and then call them through their ID while main weapons fire to start their few frame animations?

And thank you very much for answer.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 13, 2013, 02:00:46 PM
You can play around with animation frames, with a script making it play the animations until it reaches a certain frame, heres a example with a currentCharge being set on the script to avoid overlapping frames:
Code
                    switch (currentCharge)
                    {
                        case 0:
                        {

                            animation.setFrame(0);
                            animation.pause();
                            break;
                        }
                        case 1:
                        {
                            if(animation.getFrame() == 5)
                            {
                                    animation.setFrame(1);
                                    animation.play();
                            }
                            break;
                        }
                        case 2:
                        {
                            if(animation.getFrame() == 10)
                            {
                                animation.setFrame(6);
                                animation.play();
                            }
                            break;
                        }
                        case 3:
                        {
                            if(animation.getFrame() == 15)
                            {
                                animation.setFrame(11);
                                animation.play();
                            }
                            break;
                        }
                        case 4:
                        {
                            if(animation.getFrame() == 20)
                            {
                                animation.setFrame(16);
                                animation.play();
                            }
                            break;
                        }
                    }

I can set 4 different rotations on the decorative animation, you can use a timer to get "the right time" to change the animations
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 13, 2013, 02:10:18 PM
Yeah but it is possible to start animation for different sprite? I mean if it is possible to start animation of some deco while weapon is firing (so basically link deco to weapon). I can, ofc, create weapon sprite big enough to cover main weapon and those cartridges ejectors, but due to ship size and distance between those it would be kinda overkill.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on August 14, 2013, 12:21:30 AM
Quick question: Can anyone tell me what the "proper" dimensions for weapon sprites are? If they're too big they just seem to not show up in game, but I can't determine any kind of rhyme nor reason to it... i.e. one 68 x 72 weapon sprite will show up and a different one will not despite both being .PNGs with transparent backgrounds and the same dimensions (and hell, only slightly dissimilar actual images). Is there a certain aspect ratio they have to keep to? A certain maximum dimensions?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 14, 2013, 04:09:17 AM
I don't think there's a max to them. I created a ridiculously large beam weapon (101x368) and it showed up fine.
Maybe you can post the images here?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 14, 2013, 05:22:21 AM
Sounds stupid, but did you assign the right images? And did you mount the weapon :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on August 14, 2013, 01:06:23 PM
Yeah, the same images have been assigned forever, and I haven't renamed them or moved them out of the directory -- doing that causes a crash, so it's easy to catch. I haven't messed with the .variant or .wpn files either. Plus anyway, I can see that they're mounted in the ship refit window (they show up in text under "weapons". The sprite itself just randomly seems to go AWOL sometimes when I edit it.

I'm testing this by loading starsector after every change and going to Missions, so it's not a matter of needing to reload the save either :(

I'll post a screenshot and the weapon sprites in a little bit, I don't have them here.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 14, 2013, 01:12:37 PM
May I suggest that you should post whole mod?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 14, 2013, 01:34:31 PM
Yeah, Send me the mod in a PM, I'll take a look and get it fixed pal
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on August 14, 2013, 01:57:11 PM
I'm one of those people who doesn't like to post anything they've done until it's "finished".  :-* Really though, I don't see how it could be anything else in the mod interacting with it. It literally seems to only depend on the dimensions of the weapon sprite.

Here's an imgur album. Composite screenshots of weapons both showing up and not, and the exact weapon sprites i used in each case.

http://imgur.com/a/F3IbI

For now I'm just going to trial-and-error different amounts of negative space around the sprite until everything works, but I would really appreciate someone shedding some light on this. Maybe just a weird bug?

EDIT: Maybe it's not the dimensions alone... A different weapon doesn't show up even with the sprite set to the same dimensions. :'(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 14, 2013, 02:01:55 PM
My guess is some kind of collision between mod and core data.... I am really not able to help you if you wont post the mod itself.

Edit, how many pixels of space do you have between sprite and canvas borders?

But yeah, sometimes strange thing happens, for example there is glow on one of my ships appearing from nowhere, while it build up together with flux (but also with High energy focus glow boost, tho it is not caused by any weapon)...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 14, 2013, 02:05:35 PM
My guess is some sort of issue with the png itself; I've seen this mentioned before. I suspect just re-saving without changing the canvas size would have fixed it. There's nothing about the size of the sprite that should make a difference here.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 14, 2013, 02:15:29 PM
OH I KNOW I REMEMBER!!!

BIT DEPTH LEVEL!!!

Open it in paint.net and resave it with a different bit depth
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on August 14, 2013, 02:43:49 PM
OH I KNOW I REMEMBER!!!

BIT DEPTH LEVEL!!!

Open it in paint.net and resave it with a different bit depth

My guess is some sort of issue with the png itself; I've seen this mentioned before. I suspect just re-saving without changing the canvas size would have fixed it. There's nothing about the size of the sprite that should make a difference here.

Thanks for the quick responses, guys. :D All good now.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 14, 2013, 02:45:45 PM
Yeah but it is possible to start animation for different sprite? I mean if it is possible to start animation of some deco while weapon is firing (so basically link deco to weapon). I can, ofc, create weapon sprite big enough to cover main weapon and those cartridges ejectors, but due to ship size and distance between those it would be kinda overkill.

Just don't forget, the images should not change in size, a script should be limiting the animation frames, you can make it do the animation and spawn the cartridges easily, you'll need to have all your timers set to, the rate of fire your weapons has so the animation and the cartridges don't overlap. you can also have your first X images for a start animation and the script limiting them from going to the cartridges animations, i got a example on Star Control mod,the Trader doesn't have any animation when its not firing, but once it does, a new animation group comes in and replays, this process repeats 4 times (its a weapon that has 4 levels of charge), once fired the animation goes back to the non firing one. Tryout the ship on a mission, ull understand what i mean and hopefully it helps you solve that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Erick Doe on August 14, 2013, 10:19:57 PM
(http://i1022.photobucket.com/albums/af343/erick_doe/Starfarer/Tore%20Up%20Plenty/raidermk2_ff.png)

Any idea why this little fighter doesn't seem to use its bomb bay? It faces backward with a 160 degrees arc. I've also tried having it face forward, but it still won't fire it. Should I decrease the arc? Should I set its role to BOMBER?

Ideally I'd like to see it make a pass at an enemy, then fire off a bomb after passing the target.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 15, 2013, 06:02:30 AM
Should I set its role to BOMBER?
I'd definitely try that first. Or maybe second. I'd first try to make the bomb bay face forward and see if the AI uses it then.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on August 15, 2013, 08:30:19 PM
Can anyone tell me what the "8/6/5/4%" field in ship_data.csv is used for?

edit: thanks  :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on August 15, 2013, 08:34:58 PM
Alex uses it for his internal balance purposes.  Can be set to zero without any harm.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Chronosfear on August 16, 2013, 10:35:54 AM
Hey guys.

startet to play around with the .csv files.
I´m using OpenOffice, opening the file with following config :
language : English ( USA )
from row : 1
separated by "Comma"

the spreadsheet looks fine.
playing around with the ship_data.csv worked

but when playing around with the weapons, in the end it doesn´t work
some weapons like the machine gun , the assault gun and others will change to an incredible rate of fire, flux/sec, damage ( 21......... Number )

any idea ?
thanks

Chronosfear
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 16, 2013, 10:38:48 AM
be careful when doing the 0.0, some editors use 0,0 instead of 0.0 because here in the EU we use , to separate decimals from integers
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 16, 2013, 10:41:32 AM
Don't add comma's anywhere yourself, because they'll be separated into more columns when you save your changes.

My language is Default - English (UK). Maybe try that. I got tons of issues when my native language was selected.

Also enable Quoted field as text.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Arumac on August 17, 2013, 12:07:41 PM
Is there any way to get an onhiteffect to activate even when it hits a shield? I have a weapon that's basically a large power jack used to suppliment power to damaged or in construction space stations. I'd like it to crackle with electricity whenever it hits anything, shielded or not.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on August 17, 2013, 11:38:04 PM
Quote
Is there any way to get an onhiteffect to activate even when it hits a shield?
It will always work that way in this build, provided that:

1.  The onHitEffect is designed to work that way and doesn't exclude shielded target(s).  IIRC, the only example the API, the Ion Cannon script, excludes shielded targets.  See the stuff I posted to the Radioactive Code Dump thread for some examples of different projectile behaviors.
2.  You haven't tried to combine an onHitEffect with any BehaviorSpecs.  This is supposed to be fixed with 0.6, ideally meaning that we'll be able to run a script when that triggers (but we don't have any details yet other than a hint that classic "flak" weapons may work now).
3. The projectile must be of the correct type to use onHitEffect scripts.  I.E., no BehaviorSpec defined, not a missile of any kind (and yes, dumbfire rockets count- if you want "rockets" that can run onHitEffect, they must be ballistic projectiles and all physics issues such as acceleration would need to get handled via script).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 05:09:46 PM
I think my head will just pop, here is the problem:

I am creating animated beam weapon, base sprite is loaded and visible, on fire it disappears and become visible at the end of animation. BUT! (and that´s what grinds my gears) if I replace it with different animated sprite, for example shredder or something from different mod it works. BUT WAIT, there is more. If I move that working sprite from different mod to my mod (whole folder with animation), and change path it just stops to work again (same error as in first place). If I move my sprite to different mode and try to load it from there, then again same error. Ideas?

If I move that sprite to my mod (remove it from original folder in another mode) and turn off that mod then same bug as always, on the other hand if the second mod is still active then it is working again. It seems to like there is some config file (similar to sounds config file) that just point on "that is animation". But ffs I went through every single file six times and there is (and actually there is no reason to be) anything like that. So what the hell?

Hmm, maybe I got it

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 21, 2013, 05:29:03 PM
I think my head will just pop, here is the problem:

I am creating animated beam weapon, base sprite is loaded and visible, on fire it disappears and become visible at the end of animation. BUT! (and that´s what grinds my gears) if I replace it with different animated sprite, for example shredder or something from different mod it works. BUT WAIT, there is more. If I move that working sprite from different mod to my mod (whole folder with animation), and change path it just stops to work again (same error as in first place). If I move my sprite to different mode and try to load it from there, then again same error. Ideas?

If I move that sprite to my mod (remove it from original folder in another mode) and turn off that mod then same bug as always, on the other hand if the second mod is still active then it is working again. It seems to like there is some config file (similar to sounds config file) that just point on "that is animation". But ffs I went through every single file six times and there is (and actually there is no reason to be) anything like that. So what the hell?

How is ur sprites named?
Heres an example of a huge animation sprite group:
Spoiler
(https://dl.dropboxusercontent.com/u/32263294/starsector/animation_sprites_example.jpg)
[close]

Do you see anything different from what ur doing (note that the size is not the same for one reason, my weapon is outside the ship)?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 21, 2013, 05:32:03 PM
Also worth making sure, just in case, that all the frames are saved as 24-bit pngs, not 8-bit.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 05:47:00 PM
As I said, when I moved that sprite from other mode to my mod then it wasn´t working again as long as I didn´t had second mode activated (when I activated it it was ok). I´ve named frames according to shredder.. so in this case terror_rail_00.png .... terror_rail_30.png ...

And yeap, format is alright....

Point is this, it looks like, some script is actually checking if there are all frames of sprites while loading the game.

EDIT: I mean, if I remove one frame of shredder (or rename it) for example if I remove chaingun2_hardpoint_base02.png then game crash on loading, where is defined that engine should load this up? How does it know how many frames while starting the game?


AAAA I think I got it... but this is imho bug, let me test it, brb in 5 minutes.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 21, 2013, 05:59:58 PM
As I said, when I moved that sprite from other mode to my mod then it wasn´t working again as long as I didn´t had second mode activated (when I activated it it was ok). I´ve named frames according to shredder.. so in this case terror_rail_00.png .... terror_rail_30.png ...

And yeap, format is alright....

Point is this, it looks like, some script is actually checking if there are all frames of sprites while loading the game.

EDIT: I mean, if I remove one frame of shredder (or rename it) for example if I remove chaingun2_hardpoint_base02.png then game crash on loading, where is defined that engine should load this up? How does it know how many frames while starting the game?
In these lines:
Code
	"numFrames":21,
"frameRate":10,
"alwaysAnimate":"false",

And your weapon needs to be the "_00" of the animation sprites:
Quote
   "everyFrameEffect":"data.scripts.plugins.TraderVariablePowerBlasterEffect",
   "turretSprite":       "graphics/missiles/animation/trader_variant_00.png",
   "hardpointSprite":    "graphics/missiles/animation/trader_variant_00.png",
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 06:08:19 PM
Got it, fixed it (workaround) and yes it is a bug... When weapon is set to beam mode then game doesnt suppose that there is going to be animation (when loading game), so it wont load .pngs... tho animation for beam weapons is implemented so then it is trying to render frames that are not loaded (that´s why it disappear)... Work around: Create PROJECTILE weapon, that will load that animation and then just use it in beam weapon (so I just created projectile weapon vs_load_rail that I wont never ever use)... WIN

EDIT: I am not sure if I didn´t lose some of my sanity.. so I am just going to kill few of those pink kitties with shaving blade just to make sure.

Btw: I need to control beam weapon animation through script (pause it for few frames, just it only on beam charging up and such a things) I know it can be done easily for Projectile weapons through implementing EveryFrameWeaponEffect... but I suppose it is going to be pain for beam weapon with BeamEffectPlugin... but let´s see. (actually I suppose the "only" problem will be to prevent beam weapon from animating while it is on cooldown, in case if someone would press fire button... but it is going to be weapon used only by Ai anyway, so not such a big deal I guess)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 21, 2013, 06:39:20 PM
Heres an example (i need to update this code but im waiting for 0.6a to do it):

Code
package data.scripts.plugins;

import com.fs.starfarer.api.AnimationAPI;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import java.awt.Color;

public class TraderVariablePowerBlasterEffect implements BeamEffectPlugin
{  
    // weapon takes 7 seconds to fully charge
    private IntervalUtil weaponcooldownlvl = new IntervalUtil(4.0f, 4.0f);
    
    private static int currentCharge = 0;
    
    private static boolean chargedlvl1 = true;
    private static boolean chargedlvl2 = false;
    private static boolean chargedlvl3 = false;
    private static boolean chargedlvl4 = false;

    @Override
        public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
        {
            ShipAPI ship = beam.getSource();
            if (ship == null)
            {
                return;
            }
            
            AnimationAPI animation = beam.getWeapon().getAnimation();
            WeaponAPI weapon = beam.getWeapon();

                if(ship.isHulk())
                {
                    animation.setFrame(0);
                    animation.pause();
                }
                
                    //Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());            
                if(weapon.isFiring())
                {                    
                    weaponcooldownlvl.advance(amount);
                    
                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 1) {
                        chargedlvl2 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 2) {
                        chargedlvl3 = true;
                    }

                    if(weaponcooldownlvl.intervalElapsed() && currentCharge == 3) {
                        chargedlvl4 = true;
                    }
                    
                    if(chargedlvl1 && weapon.getCooldownRemaining() == 0)
                    {
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        //engine.addFloatingText(ship.getLocation(), "Power Level 1",15f,Color.GREEN,weapon.getShip(),0f,0f);
                        chargedlvl1 = false;
                        currentCharge++;
                        animation.setFrame(1);
                        animation.play();
                    }
                    
                    if (chargedlvl2)  
                    {
                        chargedlvl2 = false;
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 2",20f,Color.BLUE,weapon.getShip(),0f,0f);
                        currentCharge++;
                        animation.setFrame(6);
                        animation.play();
                    }
                    
                    if (chargedlvl3)
                    {
                        chargedlvl3 = false;
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Power Level 3",25f,Color.MAGENTA,weapon.getShip(),0f,0f);
                        currentCharge++;
                        animation.setFrame(11);
                        animation.play();
                    }
                    
                    if(chargedlvl4)
                    {
                        chargedlvl4 = false;
                        Global.getSoundPlayer().playSound("trader_var_blaster_intro",0.5f, 0.5f, weapon.getLocation(), ship.getVelocity());
                        engine.addFloatingText(ship.getLocation(), "Max Power Level",30f,Color.RED,weapon.getShip(),0f,0f);
                        currentCharge++;
                        animation.setFrame(16);
                        animation.play();
                    }
                    
                    switch (currentCharge)
                    {
                        case 0:
                        {

                            animation.setFrame(0);
                            animation.pause();
                            break;
                        }
                        case 1:
                        {
                            if(animation.getFrame() == 5)
                            {
                                    animation.setFrame(1);
                                    animation.play();
                            }
                            break;
                        }
                        case 2:
                        {
                            if(animation.getFrame() == 10)
                            {
                                animation.setFrame(6);
                                animation.play();
                            }
                            break;
                        }
                        case 3:
                        {
                            if(animation.getFrame() == 15)
                            {
                                animation.setFrame(11);
                                animation.play();
                            }
                            break;
                        }
                        case 4:
                        {
                            if(animation.getFrame() == 20)
                            {
                                animation.setFrame(16);
                                animation.play();
                            }
                            break;
                        }
                    }
                }
                
                if(weapon.getChargeLevel() <= 0.1f && currentCharge > 0)
                {
                    switch (currentCharge)
                    {
                        case 1:
                        {
                                Global.getSoundPlayer().playSound("trader_var_blaster_s1_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                                engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s1", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                                ship.getFluxTracker().increaseFlux(500, false);
                                weapon.setRemainingCooldownTo(0.5f);
                                animation.setFrame(0);
                                animation.pause();
                                weaponcooldownlvl.forceIntervalElapsed();
                                currentCharge = 0;
                                chargedlvl1 = true;
                                chargedlvl2 = false;
                                chargedlvl3 = false;
                                chargedlvl4 = false;
                            return;
                        }
                        case 2:
                        {
                                Global.getSoundPlayer().playSound("trader_var_blaster_s2_launch", 1f, 1f, weapon.getLocation(), ship.getVelocity());
                                engine.spawnProjectile(ship, weapon, "trader_variable_power_blaster_s2", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                                ship.getFluxTracker().increaseFlux(500, false);
                                weapon.setRemainingCooldownTo(0.5f);
                                animation.setFrame(0);
                                animation.pause();
                                weaponcooldownlvl.forceIntervalElapsed();
                                currentCharge = 0;
                                chargedlvl1 = true;
                                chargedlvl2 = false;
                                chargedlvl3 = false;
                                chargedlvl4 = false;
                            return;
                        }
                        case 3:
                        {
                                Global.getSoundPlayer().playSound("trader_var_blaster_s3_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                                engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster_s3", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                                ship.getFluxTracker().increaseFlux(500, false);
                                weapon.setRemainingCooldownTo(0.5f);
                                animation.setFrame(0);
                                animation.pause();
                                weaponcooldownlvl.forceIntervalElapsed();
                                currentCharge = 0;
                                chargedlvl1 = true;
                                chargedlvl2 = false;
                                chargedlvl3 = false;
                                chargedlvl4 = false;
                            return;
                        }
                        case 4:
                        {
                                Global.getSoundPlayer().playSound("trader_var_blaster_s4_launch",1f, 1f, weapon.getLocation(), ship.getVelocity());
                                engine.spawnProjectile(ship, weapon,"trader_variable_power_blaster", weapon.getLocation(), weapon.getCurrAngle(), ship.getVelocity());
                                ship.getFluxTracker().increaseFlux(500, false);
                                weapon.setRemainingCooldownTo(0.5f);
                                animation.setFrame(0);
                                animation.pause();
                                weaponcooldownlvl.forceIntervalElapsed();
                                currentCharge = 0;
                                chargedlvl1 = true;
                                chargedlvl2 = false;
                                chargedlvl3 = false;
                                chargedlvl4 = false;
                            return;
                        }
                    }
                }
    }//advance
}

EDIT: my weapon has    "alwaysAnimate":"false",
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on August 21, 2013, 06:47:20 PM
Got it, fixed it (workaround) and yes it is a bug... When weapon is set to beam mode then game doesnt suppose that there is going to be animation (when loading game), so it wont load .pngs... tho animation for beam weapons is implemented so then it is trying to render frames that are not loaded (that´s why it disappear)... Work around: Create PROJECTILE weapon, that will load that animation and then just use it in beam weapon (so I just created projectile weapon vs_load_rail that I wont never ever use)... WIN

EDIT: I am not sure if I didn´t lose some of my sanity.. so I am just going to kill few of those pink kitties with shaving blade just to make sure.

Btw: I need to control beam weapon animation through script (pause it for few frames, just it only on beam charging up and such a things) I know it can be done easily for Projectile weapons through implementing EveryFrameWeaponEffect... but I suppose it is going to be pain for beam weapon with BeamEffectPlugin... but let´s see. (actually I suppose the "only" problem will be to prevent beam weapon from animating while it is on cooldown, in case if someone would press fire button... but it is going to be weapon used only by Ai anyway, so not such a big deal I guess)

Guess you were having the same problem as me, but I guess you solved yours lol

Spoiler
Since the reverse burn drive thing I tried didn't work, on to the next one :D


0.54.1a

Modding:
Beam and burst beam weapons can now be animated (but the glow sprite can not, must remain the same for all frames)

Well I tried to make an animated weapon, but the animation part of it doesn't work >>"

Apology for not being able to take consecutive screenshots, Starsector crashes after just one screenshot, So this is how it looks,

Spoiler
(http://i.imgur.com/uyALNOK.png)

(http://i.imgur.com/2wpy2xT.jpg)
[close]

It shows only the first frame, once you fire, the weapon disappears, and the reappears after what probably means it cycled through all the frames.

Code
{
"id":"neutrino_phasedarray2",
"specClass":"beam",
"type":"ENERGY",
"size":"LARGE",
"displayArcRadius":1100,
"turretSprite":"graphics/neut/weapons/phasedarray/neutrino_phasedarray_base00.png",
"hardpointSprite":"graphics/neut/weapons/phasedarray/neutrino_phasedarray_base00.png",
"numFrames":16,
"frameRate":30,
"turretOffsets":[-80, 0],
"turretAngleOffsets":[0],
"hardpointOffsets":[-80, 0],
"hardpointAngleOffsets":[0],
"fringeColor":[212,60,25,255],
"coreColor":[255,255,255,255],
#"glowColor":[212,60,25,235],
"darkCore":false,
"width":50.0,
"textureType":ROUGH,
#"textureType":["graphics/fx/emp_arcs.png","graphics/fx/emp_arcs.png"],
"textureScrollSpeed":292.0,
"pixelsPerTexel":5.0,
"pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],
"fireSoundOne":"neutrino_heavybeam_firing",
"fireSoundTwo":"beam_heavy_loop",
}

Am I missing something  ???
[close]
Do You mind if I ask to see the .wpn file? I tried it with projectile type, but the beam part of the weapon doesn't work now but I've got the animation part, lol sigh.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 07:06:01 PM
You will just use .wpn for Beam weapon (for animated one), as you suppose to, you just need to create one more .wpn as Projectile weapon, that will load animation sprites (.png sequence) that you are going to use for Beam weapon .wpn file. Ofc you need to have both weapons in weapon_data.csv. If you still need any help I will upload my .wpns files.

silentstormpt: Your weapon is animated all the time, basicly there is no time when player could press button and weapon not to be animated (no CD)... but anyway I think I have solution for that problem.. I have already implemented pause for specific frame of animation (derived from Lazy´s solution for projectile animation pause).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 21, 2013, 07:32:05 PM
Ahhh! Thank you for catching that beam-animation-not-loading bug, fixed it up. That's pretty evil.

By the way - beam weapons can have an everyFrameEffect, along with a beamEffect. The difference is that beamEffect will be called for every beam, if the weapon happens to have multiple barrels.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 07:51:22 PM
Ahhh! Thank you for catching that beam-animation-not-loading bug, fixed it up. That's pretty evil.

By the way - beam weapons can have an everyFrameEffect, along with a beamEffect. The difference is that beamEffect will be called for every beam, if the weapon happens to have multiple barrels.

Np. Observation about that BeamEffectPlugin: lets say I have some declared and defined variables for that class. It seems like (not seems, I am pretty sure) engine resets them to their initial values. Point is this: I need  to animate sprite while charging up (done) then after weapon is firing no more, then I need to finish rest of animation and also there is cooldown for this weapon, in which if someone click fire then animation of sprite is played (which I don´t want to). And now I have to chose, I can prevent animation when weapon is on CD, but then I am unable to finish part of animation after weapon stops to fire... (coz I basicaly stop and prevent animation when weapon.isFiring() = false)... I would create a interval and countdown that will prevent animation from stopping for some time after beam is finished with firing but I am afraid that countdown wont work coz it will be always set to it´s initial value... actually not sure if I even can anyhow manipulated with those done in BeamEffectPlugin when the weapon is not actually firing.....

Hmmmm... I should just rewrite as EveryFrame.. :D

Simply: BeamEffectPlugin isn´t called when beam isn´t active, right? (while everyframe should be called on everyframe no matter what is weapon doing... or do I get it wrong?)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 21, 2013, 08:15:44 PM
Np. Observation about that BeamEffectPlugin: lets say I have some declared and defined variables for that class. It seems like (not seems, I am pretty sure) engine resets them to their initial values.

Almost sounds like you're creating local variables inside the method, rather than data members inside the class. If you look at  com.fs.starfarer.api.impl.combatTachyonLanceEffect (in starfarer.api.zip), it declares some member variables and those certainly don't get reset, or the effect wouldn't work.

If that's not what you're doing, can you post your code here?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 08:18:31 PM
Nope, variables were right, just observation kinda wrong... so new statement:

BeamEffectPlugin isn´t called when beam is actually not active and when it get active next time it will start with initial values of variables.

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on August 21, 2013, 09:03:35 PM
You will just use .wpn for Beam weapon (for animated one), as you suppose to, you just need to create one more .wpn as Projectile weapon, that will load animation sprites (.png sequence) that you are going to use for Beam weapon .wpn file. Ofc you need to have both weapons in weapon_data.csv. If you still need any help I will upload my .wpns files.

silentstormpt: Your weapon is animated all the time, basicly there is no time when player could press button and weapon not to be animated (no CD)... but anyway I think I have solution for that problem.. I have already implemented pause for specific frame of animation (derived from Lazy´s solution for projectile animation pause).

Now I got it working, was a little confused, but It's just a second weapon just to load the sprites itself, sneaky. :D

But why is the dilemmas always similar, Just gotta make the animation hold mid way for couple of seconds, and rather not rename 60 frames of... the same thing.
Though Cycerin has a script that does this, idk how to make it work midway instead at the beginning of it.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 21, 2013, 09:06:05 PM
You will just use .wpn for Beam weapon (for animated one), as you suppose to, you just need to create one more .wpn as Projectile weapon, that will load animation sprites (.png sequence) that you are going to use for Beam weapon .wpn file. Ofc you need to have both weapons in weapon_data.csv. If you still need any help I will upload my .wpns files.

silentstormpt: Your weapon is animated all the time, basicly there is no time when player could press button and weapon not to be animated (no CD)... but anyway I think I have solution for that problem.. I have already implemented pause for specific frame of animation (derived from Lazy´s solution for projectile animation pause).

Now I got it working, was a little confused, but It's just a second weapon just to load the sprites itself, sneaky. :D

But why is the dilemmas always similar, Just gotta make the animation hold mid way for couple of seconds, and rather not rename 60 frames of... the same thing.
Though Cycerin has a script that does this, idk how to make it work midway instead at the beginning of it.

If you are talking about pausing animation then that isn´t a problem. But I am not sure that I understand what do you mean.

Edit: got everything working, uploading, result in few minutes :)

Result: http://www.youtube.com/watch?v=Gi18_BVSOFY&feature=youtu.be
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 22, 2013, 07:48:01 AM
Nope, variables were right, just observation kinda wrong... so new statement:

BeamEffectPlugin isn´t called when beam is actually not active and when it get active next time it will start with initial values of variables.

Correct. That generally seems desirable for actual beam effects, doesn't it? But probably makes it a bad place to govern the weapon's animation from. There's also the part about it being passed in a BeamAPI, which doesn't exist while the weapon isn't firing, though I suppose that could be null...


(I've got the say, the railgun impact looks pretty amazing. As does the ship itself, but we weren't talking about that :))

Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 22, 2013, 08:56:15 AM

Correct. That generally seems desirable for actual beam effects, doesn't it? But probably makes it a bad place to govern the weapon's animation from. There's also the part about it being passed in a BeamAPI, which doesn't exist while the weapon isn't firing, though I suppose that could be null...



Yeah, I understand it now, and probably if it wouldn´t be so late yesterday then I would understand it earlier :D( I´ve simply believed it is everyframe specific to beam weapons, dunno why). I have just changed it to everyframe and it was working without problem, thx for help :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 24, 2013, 09:40:00 AM
Question about png, bit-depth is obvious but what about interlacing and compression? It seems like (by their size) every vanilla png use highest/slowest compression, not sure about interlacing but I guess it even doesnt matter in this case.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 24, 2013, 10:25:42 AM
Question about png, bit-depth is obvious but what about interlacing and compression? It seems like (by their size) every vanilla png use highest/slowest compression, not sure about interlacing but I guess it even doesnt matter in this case.

Not sure. It's using java's ImageIO.read, so whatever that does.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 24, 2013, 10:36:10 AM
I guess ImageIO doesnt consider it, it is mostly used for web aplication (ability to preload few rows and fill rest with random pixels, then load the rest, basically progressive loading), anyway thx. Still curious about that compression, coz none-fast produce bigger image but they could be actually easier and faster to load by the engine itself, but not completely sure about that.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 24, 2013, 11:30:32 AM
Still curious about that compression, coz none-fast produce bigger image but they could be actually easier and faster to load by the engine itself, but not completely sure about that.

I'd be shocked if the time spent decoding was significant compared to the time spent loading the image from disk for any non-trivial number of computer setups. Shocked, I tell you :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 24, 2013, 11:46:07 AM
Still curious about that compression, coz none-fast produce bigger image but they could be actually easier and faster to load by the engine itself, but not completely sure about that.

I'd be shocked if the time spent decoding was significant compared to the time spent loading the image from disk for any non-trivial number of computer setups. Shocked, I tell you :)

Went exploring to help you out and found this:
http://lwjgl.org/wiki/index.php?title=Loading_PNG_images_with_TWL's_PNGDecoder
http://lwjgl.org/forum/index.php?topic=4762.0
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 24, 2013, 12:14:39 PM
Ah, thanks :)

I actually experimented with that particular decoder a while ago; it only handled power-of-two-sized pngs and wasn't significantly faster, if at all (refer to part about time to load from disk dwarfing everything else).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 24, 2013, 03:01:54 PM

Well I was not suggesting it is bad, actually I wasn´t 100 percent sure if they are actually compressed or not, just checking if I was using proper format or if it actually matters, so thx for informations.

Observation: Ai compares OP of two enemy ships, if OP of one ship is significaly lower then it is "afraid" of other one and try to avoid combat (run from it, even if it cannot retreat just trying to outrange it all the time)

-correct? Also only weapon OPs count? Or what? If this theory is alright then I am pretty sure only actual OP counts (not maximum ship OP, just current loadout).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 24, 2013, 03:16:39 PM
It's ... involved. It considers damage, weapon type/size, shield type/state/efficiency, direction the weapon is pointing at, one-shot damage/dps, etc. Ordnance points are just about the only thing that's actually not considered here, iirc :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 24, 2013, 03:22:46 PM
Point is, I have ship with DPS, shield efficiency and other stats far above any other ships, still it is running even from cruisers. (dps is actually several thousands). Tho it has only inbuilt weapons, so no OP from that.

Edit: I just tried to boost OP from hullmods, actually multiplied it by 3.. now it is much more aggressive. Before it was running from Dominator class, now it is willingly rushing against onslaughts.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 24, 2013, 03:35:12 PM
Ah yes, that makes sense. If a variant's actual spent OP are below a certain fraction of the maximum OP (30%? not sure what it is in 0.54.1a), the AI considers it a civilian ship and runs away no matter what.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 24, 2013, 03:47:23 PM
Ahhh that would explain a lot
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on August 25, 2013, 01:27:32 PM
Am I missing something, or does MutableShipStatsAPI.getShieldArcBonus not actually function during combat?  Trying to make a ship system that increases shield arc when it's active, and, err, either the method's broken or I'm doing something wrong...
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 25, 2013, 01:48:12 PM
Right, that doesn't work dynamically. The shield's initialization depends on knowing its arc.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: NITROtbomb on August 26, 2013, 07:27:15 AM
I cannot find to log so i don't know how to say this but I am getting a fatal error loading a projectile sprite, in graphics/WFE/Missiles/bomlete3.png I don't know what is happening I have compared my weapon data and stuff to that of other mods and the core files and cannot see what the fatal difference is, any suggestions?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 26, 2013, 09:51:19 AM
My first suggestion would be to post the mod or people'd take potshots into the dark forever. *pew pew*
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 26, 2013, 09:52:29 AM
I cannot find to log so i don't know how to say this but I am getting a fatal error loading a projectile sprite, in graphics/WFE/Missiles/bomlete3.png I don't know what is happening I have compared my weapon data and stuff to that of other mods and the core files and cannot see what the fatal difference is, any suggestions?

C:\Program Files (x86)\Fractal Softworks\Starsector\starsector-core\starfarer(.log) but as always best thing would be if you can upload it.

Btw, guys.. I would really, really, really like to create projectile weapon with trail... I have idea for effect that I consider better then anything I done so far (in case if execution will be done correctly).. but I don´t want to use just particles... in the worst case scenario I will just map path of projectile, or actualy keep spawning particles on projectile location, tho I didn´t checked if is possible to return projectile location, but I am pretty sure it is, aynway I would rather spawn beam with same speed as projectile and use it as grahpic effect, problem is, as far as I am aware there is no way how to spawn beam through api, right? (It would be ofc just burst with some decay time, also it need to be beam rather then praticles coz I would creat very specific texture for that trail).
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: HELMUT on August 26, 2013, 10:10:13 AM
While i'm not sure if i clearly understand what you are asking for but i think you should look for silentstormpt post where he talk about a ballistic projectile with a beam looking trail behind it. Not sure if it's what you need though.

http://fractalsoftworks.com/forum/index.php?topic=5539.210
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on August 26, 2013, 10:16:58 AM
Nope, I would need that trail to stay on place for few seconds and then slowly disapper, it should behave like trails behind airplanes irl, if you know what I mean (ofc disappering much faster)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: xenoargh on August 26, 2013, 10:22:01 AM
You can't spawn beams through the API atm, no.

That said, there are various options for short bolts.  Do an operation that spawns particles of a given width in a row, rotate the row after applying velocity.  Should look like a small bolt.  

It's expensive to do it this way though, because it requires quite a few particles for any given length.  

The better way is to spawn an actual projectile that is a short beam segment, using BALLISTIC_AS_BEAM, like the Mining Blaster.  Just make the weapon harmless and set the CollisionType to NONE.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 26, 2013, 10:37:32 AM
You can also make the projectile spawn a smoke on its location every X.X seconds, creating that trail you wanted but it is heavy CPU usage specially if you spam those projectiles
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: NITROtbomb on August 26, 2013, 04:56:49 PM
Im on a mac so i think this is what you want?
Spoiler
37757 [Thread-8] ERROR com.fs.starfarer.combat.String  - java.lang.RuntimeException: Error loading [graphics/EFA/missiles/bomblet3.png] resource, not found in [/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/Console,/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/LazyLib,/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/MYMOD,../starfarer.res/res,CLASSPATH]
 java.lang.RuntimeException: Error loading [graphics/EFA/missiles/bomblet3.png] resource, not found in [/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/Console,/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/LazyLib,/Users/nicholascruse/Desktop/NOT SCHOOL/Starsector.app/Contents/Resources/Java/../../../mods/MYMOD,../starfarer.res/res,CLASSPATH]
   at com.fs.util.ooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.?00000(Unknown Source)
   at com.fs.util.ooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.?00000(Unknown Source)
   at com.fs.graphics.TextureLoader.new(Unknown Source)
   at com.fs.graphics.TextureLoader.o00000(Unknown Source)
   at com.fs.graphics.TextureLoader.o00000(Unknown Source)
   at com.fs.graphics.TextureLoader.o00000(Unknown Source)
   at com.fs.graphics.F.super(Unknown Source)
   at com.fs.starfarer.loading.H.o00000(Unknown Source)
   at com.fs.super.A.?00000(Unknown Source)
   at com.fs.starfarer.combat.String.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:680)
AL lib: FreeContext: (0x1001e5c30) Deleting 77 Source(s)
AL lib: FreeDevice: (0x104162000) Deleting 155 Buffer(s)
logout
/spoiler]
 
[close]
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 27, 2013, 12:03:39 AM
Nitro, it would appear that the mod is looking for that specific file somewhere on the desktop, can you post the contents of any weapon files you have made?

Edit: Oh and projectile files
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: NITROtbomb on August 27, 2013, 04:11:46 AM
ok I'll look into that

http://www.mediafire.com/folder/rs6o9b536tvd7wl,04e3igji5fkospd,4g66hvf15kk32l4/shared
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Sproginator on August 27, 2013, 04:43:18 AM
Thanks, I'll look when I'm home tonight
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: NITROtbomb on August 27, 2013, 05:45:45 AM
also for those interested here is the mod file, it was just something to fill me over till my spiriting skill improves :P

http://www.mediafire.com/download/58kcbdyhyhzji85/MYMOD.zip
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on August 27, 2013, 06:34:49 AM
Check your spelling, NITROtbomb. Your folder name is missles, not missiles. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: NITROtbomb on August 27, 2013, 06:42:14 AM
Oh my god :O I fell like I should be in year 1 not year 12 lol

Ok it loads now but ahh, the weapon does not seem to exist :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Wyvern on August 27, 2013, 10:25:34 PM
Is there any way to get at what a ship's armed with?  I'm working on a ship system AI; the system in question primarily benefits energy weapons, but the ship has universal slots - I'd like the AI to react intelligently to noticing that it has missiles or ballistics instead of energy weaponry.  (This one I'm pretty sure isn't doable until 0.6, but hey, worth asking right?)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on August 31, 2013, 09:19:57 AM
Thought this may be useful:

How to get a ShipAPI from a FleetMemberAPI:
Code
        ListIterator Fleetships = FleetID.getFleetData().getMembersListCopy().listIterator();
        while(Fleetships.hasNext())
        {
            FleetMemberAPI fmember = (FleetMemberAPI)Fleetships.next();
            MutableShipStatsAPI stats = fmember.getStats();
            ShipAPI ship = (ShipAPI) stats.getEntity();
}

not 100% sure it works, if it does, i wish i had found out alot sooner.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on August 31, 2013, 09:28:39 AM
It doesn't. Rather, it only does if you're calling stats.getEntity() from within combat. A ShipAPI doesn't exist for a FleetMember in the campaign.

Is there any way to get at what a ship's armed with?  I'm working on a ship system AI; the system in question primarily benefits energy weapons, but the ship has universal slots - I'd like the AI to react intelligently to noticing that it has missiles or ballistics instead of energy weaponry.  (This one I'm pretty sure isn't doable until 0.6, but hey, worth asking right?)

I'm not exactly sure what's in it as of 0.54.1a, but take a look at ShipAPI.getVariant(). That may have what you need. Also, is there a ShipAPI.getAllWeapons()? In any event, this will definitely be possible in 0.6a.

... actually, take a look at data.shipsystems.scripts.ai.FastMissileRacksAI. That's doing pretty much what you are talking about.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on September 03, 2013, 09:40:30 AM
Ive hit a bump here, so far theres alot of work done into making a possible Utilitymod, that adds dynamic starsystem gen, an mining system, more control over each element of a starsystem, factiondata and products, product schematics (allows adding possible cargo creation using 2 or 3 different cargos) and hopefully a economy.
https://bitbucket.org/silentstormpt/starsector-utility-mods/commits/all

Question how would you create a productSchematic class that by providing x productentities will result in a specific productentity?
https://bitbucket.org/silentstormpt/starsector-utility-mods/src/8b77fdbc22bd2db1bcfeec97dcb17f1a26c64c01/data/scripts/world/economy/ProductSchematic.java?at=default

Btw the productEntity is suppose to save info for a certain cargo, so you can see it as a model that saves all the info on that cargo, provided by a CSV or JSON file, so any mod that provides that info can create their specific unique products and schematics, that can be used to create that cargo. For example:

everyday i generate X amount of productEntity.createCargo(yourminingship.getCargo(), productEntity, Quantity);

That productEntity can be "gold" or any type of product you want used as a mineral.

Disclaimer: this is all pretty much work in progress and should only work once 0.6a arrives and i can finally set all the missing methods into this "puzzle"
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on September 08, 2013, 02:40:24 PM
What is in your opinion most effective way (resource wise) to convert specific beam weapon to deal hard flux instead of soft?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on September 08, 2013, 03:23:42 PM
Lazy wizard has a implementation that changes beam soft flux damage to hard here

I don't know if this suggestion has been made yet- only read through the last few pages, but here is a possible idea that could balance out the problems with using beams to kite while still giving them killing power.  What if beams did full DPS throughout their range, but scaled from 100% hard flux at zero range to 100% soft flux at max range?  (or maybe something like 50% soft at 20% max range and lower to 100% soft at 80% max range and higher).  You could even put in a slight color or gamma gradient over the beam's range so there is visual feedback on whether you are in the soft or hard flux range bands. 

Thus - if you try to kite with your superior range you're only doing soft flux, but if you want to abuse your manly tri-tac shields you can fly in close for some hard flux damage, but risk the return fire.

I liked this idea so much I decided to try it out. Here's (http://www.mediafire.com/download/rt9b5lirjogrs3h/Alternate_Beam_Mechanics.zip) a small test mod that gives all vanilla beams 0-100% hard flux based on distance to the target (requires LazyLib (http://fractalsoftworks.com/forum/index.php?topic=5444.0)).

I've only tested it briefly, but the most noticeable effect is that the famed Disco Paragon has gone from "able to kill anything smaller than it" to "able to kill anything, period" (including taking on two Conquests and an Onslaught simultaneously). I'll try making a version using the other variant you mentioned, as I think that might be more balanced. :)

http://www.mediafire.com/download/rt9b5lirjogrs3h/Alternate_Beam_Mechanics.zip
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on September 08, 2013, 03:52:18 PM
I believe there was a bug in that version of the code. Here's the version I currently have in my sandbox project:

Code
package data.scripts.weapons;

import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.FluxTrackerAPI;
import com.fs.starfarer.api.combat.ShieldAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.WeaponAPI;
import org.lazywizard.lazylib.MathUtils;
import org.lazywizard.lazylib.combat.DefenseType;
import org.lazywizard.lazylib.combat.WeaponUtils;

public class HardFluxBeam implements BeamEffectPlugin
{
    @Override
    public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
    {
        if (beam.getDamageTarget() instanceof ShipAPI)
        {
            ShipAPI target = (ShipAPI) beam.getDamageTarget();
            ShieldAPI shield = target.getShield();
            if (shield != null && shield.isWithinArc(beam.getTo()))
            {
                WeaponAPI wep = beam.getWeapon();
                float damage = WeaponUtils.calculateDamagePerSecond(wep,
                        target, DefenseType.SHIELD) * amount;

                // Hard flux dealt is based on distance to target
                float hardFluxRatio = 1f - (MathUtils.getDistance(
                        beam.getFrom(), beam.getTo()) / wep.getRange());
                float softFlux = damage * (1f - hardFluxRatio);
                float hardFlux = damage * hardFluxRatio;


                // Undo the vanilla flux damage, add our custom damage
                FluxTrackerAPI flux = target.getFluxTracker();
                flux.decreaseFlux(damage);
                flux.increaseFlux(softFlux, false);
                flux.increaseFlux(hardFlux, true);
            }
        }
    }
}

It's not 100% accurate, unfortunately. Guessing how much damage is being dealt is complicated, and beam damage especially so.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Ravendarke on September 08, 2013, 04:59:32 PM
I like that idea with range, really, gave me a idea... using it (for one specific weapon) not just for hard/soft flux ration but for dmg overall, while inverted (longer range = more dmg). Or it could be even used to create weapon with deadzone.. doing lot of dmg on close range, lot of dmg on max range but almost non in middle.. hmm.. anyway thanks a lot :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on September 09, 2013, 09:19:16 PM
Alrighty, so, the code I'm having trouble with at the moment is this ai script, based off of the ReflectorAI from BRDY.  Honestly, it feels like the problem shouldn't be that hard to deal with, except every time I end up calling up the autocomplete in netbeans the program hangs, which is kind of annoying.

Code
package data.shipsystems.scripts.ai;

import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import java.util.Iterator;
import org.lwjgl.util.vector.Vector2f;
import org.lazywizard.lazylib.combat.*;
import org.lazywizard.lazylib.MathUtils;

public class ms_siegemodeAI implements ShipSystemAIScript {
    private ShipSystemAPI system;
    private ShipAPI ship;

    @Override
    public void init(ShipAPI ship, ShipSystemAPI system, ShipwideAIFlags flags, CombatEngineAPI engine)
    {
        this.ship = ship;
        this.system = system;
    }

    @Override
    public void advance(float amount, MutableShipStatsAPI stats, Vector2f missileDangerDir, Vector2f collisionDangerDir, ShipAPI target)
    {
        float goLive = 1200f; //the AI needs to know (roughly) how big the range of our weapons boost is.
        float fuzzyLogic = 0f; //set our logic counter to 0
        
        int ships = 0;
        ShipAPI ship_tmp;
    
        for (Iterator iter = CombatUtils.getCombatEngine().getShips().iterator();
                iter.hasNext();)
        
        {
            ship_tmp = (ShipAPI) iter.next();
            ship_tmp.getMutableStats();
                
            if ((ship_tmp.getOwner() != ship.getOwner()) && (MathUtils.getDistance(ship_tmp, ship) >= (goLive * 1.05f)))
            { //Check hostility and range
                    fuzzyLogic += ship_tmp.getFluxCapacity(); //Watch out for lots of Flux  --  This is the first line bearing an error.
                    fuzzyLogic += ship_tmp.getMaxHitpoints(); //And big hitpoint pools - we can generally presume that vessel with both/either would require sieging
                    fuzzyLogic -= (ship_tmp.getMaxSpeed() * 2.5f); //Of course, we don't really want to hold still when we're dealing with fast targets   --  And this is the second.
            }
        }
        float fluxLevel = ship.getFluxTracker().getFluxLevel();
                
        if (fuzzyLogic > 5000f && !system.isActive() && fluxLevel < 0.95f) {
            //compare our counter to a magic number, make sure the system is already off, and that our flux level isn't too high
            ship.useSystem();
        } else if ((fuzzyLogic <= 2000f || fluxLevel >= 0.95f || goLive >= goLive * 1.15f) && system.isActive()) {
            //if there is little-to-no threat OR if our flux level is too high OR if the enemies are far enough away, turn the system off if it is currently active
            ship.useSystem();
        } else { return; }
    }

}

I've been playing around with MutableShipStatsAPI to see if that would work, but it doesn't seem to be playing nicely with ship_tmp.  Alas.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on September 09, 2013, 09:26:55 PM
You're looking for ship_tmp.getFluxTracker().getMaxFlux(), ship_tmp.getMaxHitpoints(), and ship_tmp.getMutableStats().getMaxSpeed().getModifiedValue().

Quote
Honestly, it feels like the problem shouldn't be that hard to deal with, except every time I end up calling up the autocomplete in netbeans the program hangs, which is kind of annoying.

Try following the instructions here (http://fractalsoftworks.com/forum/index.php?topic=3674.0) to clear Netbean's cache and see if that helps with the hanging issues.


Edit: also, you'll want to change
Code
public void advance(float amount, MutableShipStatsAPI stats, Vector2f missileDangerDir, Vector2f collisionDangerDir, ShipAPI target)
to
Code
public void advance(float amount, Vector2f missileDangerDir, Vector2f collisionDangerDir, ShipAPI target)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: MShadowy on September 09, 2013, 09:46:22 PM
Unfortunately clearing the cache hasn't seemed to resolve the issue with netbeans.

At least the code is working pretty well now, though.  Thanks for your help, Lazy!
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Erick Doe on September 13, 2013, 07:16:01 AM
I completely missed this:

Will we be able to assign specific graphics to stations in 0.6a?

I realise that we can do this now, but as of now it overwrites the graphics of all stations.

To elaborate my question: can we make station graphics faction specific in 0.6a?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on September 13, 2013, 01:53:18 PM
Will we be able to assign specific graphics to stations in 0.6a?

I realise that we can do this now, but as of now it overwrites the graphics of all stations.

To elaborate my question: can we make station graphics faction specific in 0.6a?

No - it's definitely on my list, just couldn't get to it. Hoping to sneak it in in 0.6.1a.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Verrius on September 13, 2013, 11:03:35 PM
Can somebody explain to me in a nutshell, what Jars are, and how they work with Starsector? It seems like a pretty standard Java thing. Funnily enough I don't know much about Java.

(I'm asking because it seems like you need them to get around generics are something. It's hard to explain because I'm realizing just now how little I know about Java.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on September 14, 2013, 01:18:58 AM
Can somebody explain to me in a nutshell, what Jars are, and how they work with Starsector? It seems like a pretty standard Java thing. Funnily enough I don't know much about Java.

(I'm asking because it seems like you need them to get around generics are something. It's hard to explain because I'm realizing just now how little I know about Java.)

Just a note - you don't actually need generics, they just make life slightly easier. You can code pretty much anything without them that you could using them. :)

Anyway, the explanation:

Most mods implement their scripts as loose java files in their mod folders. When the game launches, it finds all these scripts and passes them to Janino. Janino is a very small, very fast compiler that Starfarer uses to compile scripts. While it is fast, the downside is that it doesn't support the full list of Java language features, generics being foremost among that list.

A jar is basically an archive (like a zip or rar) that contains compiled java code (.class files), 'compiled' meaning it's been translated into a form the computer can understand. Since the code in a jar is already readable by the Java VM, the game can load these classes directly into memory, bypassing Janino and its restrictions.

If you are already using an IDE you should have an easy time creating a jar - in NetBeans it'd be Clean and Build (Shift+F11), and you'd find the jar in your NetBeans project folder inside the dist directory. Just put that jar somewhere in your mod folder, then add a line to your mod_info.json telling the game where to find it.

For example, LazyLib's compiled code is stored in jars/LazyLib.jar. So it requires the following line in its mod_info.json:
Code
    "jars":["jars/LazyLib.jar",],

There is one pitfall you have to watch out for. Unless Alex has changed it in .6a, scripts in data/scripts/plugins need to be outside a jar to be automatically loaded by the game.


Again, you don't need to know anything about using generics or jars to write a mod. Just create mods the way you are most comfortable and everything will continue to work. :)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Cycerin on September 14, 2013, 06:39:04 AM
How should I implement custom engine sounds in a similar way to the core game without ruining compatibility with other mods?

Code
	"engine_loop":{
"sounds":[
{"file":"sounds/BR/fx/brdyshipsounds/blackrockengine_frig.ogg","pitch":1,"volume":1},    # index:  14
{"file":"sounds/BR/fx/brdyshipsounds/blackrockengine_frig.ogg","pitch":1,"volume":1}, # index:  15
{"file":"sounds/BR/fx/brdyshipsounds/blackrockengine_destroyer.ogg","pitch":1,"volume":1},    # index:  16
{"file":"sounds/BR/fx/brdyshipsounds/blackrockengine_cruiser.ogg","pitch":1,"volume":1},  # index:  17
{"file":"sounds/BR/fx/brdyshipsounds/blackrockengine_capital.ogg","pitch":1,"volume":1},    # index:  18
],

"BLACKROCKHULL":{"sounds":[15,16,17,18,19], "pitch":1, "volume":1},
"FIGHTER":{"sounds":[15], "pitch":1, "volume":0.5},
"FRIGATE":{"sounds":[16], "pitch":0.9, "volume":0.6},
"DESTROYER":{"sounds":[17], "pitch":0.9, "volume":0.7},
"CRUISER":{"sounds":[18], "pitch":0.9, "volume":0.75},
"CAPITAL_SHIP":{"sounds":[19], "pitch":1, "volume":0.8},
},

As far as I can see, if I use an index from 0 and out it uses core sounds. But if a different mod tried to call the same list entries as the ones I'm using, would there be a conflict? Can I do this in a more... isolated fashion?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Alex on September 14, 2013, 10:41:35 AM
As far as I can see, if I use an index from 0 and out it uses core sounds. But if a different mod tried to call the same list entries as the ones I'm using, would there be a conflict? Can I do this in a more... isolated fashion?

Hm, that's a good point, this is a problem. Will take a look.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on September 14, 2013, 01:46:51 PM
Hey, I've noticed that my ships aren't spawning with the proper names.

If have
Code
    "shipNameSources":{
"regime":1,
},
in the .faction file and then a ship_names.json in data/strings of my mod that looks like this
Code
{
"regime":
[
"Hand of God",
"Repentant",
],
}
is there any reason why my ships are showing up in stations etc. with names pulled from other lists? Bug, or am I overlooking something dumb?

edit: I have quite a few names on there, but I'll add more and see if that fixes anything? I don't think that's it, though.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Gotcha! on September 14, 2013, 02:55:33 PM
Maybe your name list is too short so the game gets needed names from other lists as well? (Dunno if it is short, haven't checked.)
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on September 14, 2013, 02:55:51 PM
Why do ships with 0 crew (As in, unmanned--there shouldn't be any crew) always have 0% combat readiness? Is there a way to override the automatically-assigned 0% CR, or is this a bug?
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Vayra on September 14, 2013, 03:14:46 PM
I updated my mod to the new ModPlugin system as per LazyWizard's post and it kept calling the OnEnabled part every time a saved game was loaded -- as if it wasn't reading the "if (!wasEnabledBefore)" or rather I suppose as if wasEnabledBefore never got set. I was under the impression the game's built-in mod handling set it automatically, is there a way I can do it manually in the onNewGame? I'm sure it's really simple but I can't really into java :v

Code
     @Override
     public void onEnabled(boolean wasEnabledBefore)
     {
         if (!wasEnabledBefore)
         {
            // Calling a separate method avoids duplicate code with onNewGame()
            initVayra();
         }
     }

I fixed the problem for now by just commenting that block of code out, but that's obviously nonoptimal as it means I can't add my mod to existing games.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on September 14, 2013, 03:36:12 PM
Why do ships with 0 crew (As in, unmanned--there shouldn't be any crew) always have 0% combat readiness? Is there a way to override the automatically-assigned 0% CR, or is this a bug?

I can't give a why , but I had the same prob.

http://fractalsoftworks.com/forum/index.php?topic=6634.0
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Verrius on September 14, 2013, 05:53:05 PM
Thanks Lazy, that's pretty helpful. Although I'm still confused, I may as well try to describe what I want to do.

All I wanna do is add special dialogue options for Stations controlled by a specific faction.
Also would like to do a special dialogue that only plays when you interact with a planet.

But things don't ever seem to work the way I want them to.

I should add that I'd like to to NOT replace anything I can avoid replacing, for compatibility.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: silentstormpt on September 14, 2013, 06:18:02 PM
Why do ships with 0 crew (As in, unmanned--there shouldn't be any crew) always have 0% combat readiness? Is there a way to override the automatically-assigned 0% CR, or is this a bug?

Seem like CR is connected to the crew XP, 0 crew will return a bonus of 0f, resulting in 0 CR created.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: LazyWizard on September 14, 2013, 06:41:03 PM
Thanks Lazy, that's pretty helpful. Although I'm still confused, I may as well try to describe what I want to do.

All I wanna do is add special dialogue options for Stations controlled by a specific faction.
Also would like to do a special dialogue that only plays when you interact with a planet.

But things don't ever seem to work the way I want them to.

I should add that I'd like to to NOT replace anything I can avoid replacing, for compatibility.

Here's an example of picking an interaction plugin for a specific entity without using generics (this goes in your CampaignPlugin implementation):

Code
    @Override
    public PluginPick pickInteractionDialogPlugin(SectorEntityToken interactionTarget)
    {
        // The Omnifactory uses a special interaction dialog
        if (OmniFac.isFactory(interactionTarget))
        {
            // PluginPick is a wrapper that allows you to assign a priority to a plugin
            // The highest priority plugin returned by all mods' CampaignPlugins will be the one used
            return new PluginPick(new OmniFacInteractionPlugin(),
                    PickPriority.MOD_SPECIFIC);
        }

        // Returning null means this mod doesn't have a specific interaction plugin for this entity
        // If all mods return null, the vanilla interaction behavior for that entity will be used
        return null;
    }

Writing the plugin that handles interaction itself is significantly more complicated. If you open up starfarer.api.zip and look in the com/fs/starfarer/api/impl/campaign/ directory you can find some examples (anything with InteractionDialogPluginImpl in the name). Just note that you might need to change the switch statements to a series of if/else if blocks because Janino can't handle switch on enumerations.


I updated my mod to the new ModPlugin system as per LazyWizard's post and it kept calling the OnEnabled part every time a saved game was loaded -- as if it wasn't reading the "if (!wasEnabledBefore)" or rather I suppose as if wasEnabledBefore never got set. I was under the impression the game's built-in mod handling set it automatically, is there a way I can do it manually in the onNewGame? I'm sure it's really simple but I can't really into java :v

Code
     @Override
     public void onEnabled(boolean wasEnabledBefore)
     {
         if (!wasEnabledBefore)
         {
            // Calling a separate method avoids duplicate code with onNewGame()
            initVayra();
         }
     }

I fixed the problem for now by just commenting that block of code out, but that's obviously nonoptimal as it means I can't add my mod to existing games.

You should write a post in the Bug Reports section. :(
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: Psiyon on September 14, 2013, 09:16:46 PM
I'm getting an error when I go to start a new game in my mod:


Code
32318 [Thread-6] ERROR com.fs.starfarer.combat.D  - java.lang.ClassCastException: com.fs.starfarer.campaign.Hyperspace cannot be cast to com.fs.starfarer.api.campaign.StarSystemAPI
java.lang.ClassCastException: com.fs.starfarer.campaign.Hyperspace cannot be cast to com.fs.starfarer.api.campaign.StarSystemAPI
at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
at com.fs.starfarer.title.B.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.K.dismiss(Unknown Source)
at com.fs.starfarer.ui.impl.oooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.dismiss(Unknown Source)
at com.fs.starfarer.campaign.save.OooO.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.O00o.super(Unknown Source)
at com.fs.starfarer.ui.F.processInput(Unknown Source)
at com.fs.starfarer.ui.newsuper.o00000(Unknown Source)
at com.fs.starfarer.new.????00(Unknown Source)
at com.fs.oOOO.super.new(Unknown Source)
at com.fs.starfarer.combat.D.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)

I'm using a very generic SectorGen script, something that, when put alone in a test mod, loads into the campaign just fine. However, in Obsidian Void, it crashes after hitting "start game" in the character screen.

Any ideas on what might be causing this? I'm at a total loss, as I've removed all of my custom campaign code, meaning none of my mod's files are even be aware of com.fs.starfarer.campaign.Hyperspace's existence.

...And interestingly, upon checking, com.fs.starfarer.campaign.Hyperspace doesn't seem to exist in the API. Weird.
Title: Re: Misc modding questions that are too minor to warrant their own thread
Post by: FlashFrozen on September 15, 2013, 12:51:11 AM
Welp I've tried basically doing a copy of Askonia and renaming it, but it doesn't appear on the hyperspace map as expected, so now I'm digging through how to actually add my system in, what other file do I need to modify in order to add in a system.

I've seen how Mshadowy does it, but replicating that method seems ill advised since i don't actually know how it'll turn out lol.

Do I need to put in;

Code
import data.scripts.world.systems.CoronaAustralis;

in a gen file ? or something cause idk I'm just lost lol.

Temporary file for my system:

Code
package data.scripts.world.systems;

import java.awt.Color;
import java.util.List;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.JumpPointAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.OrbitAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.fleet.FleetMemberType;

public class CoronaAustralis {

public void generate(SectorAPI sector) {
StarSystemAPI system = sector.createStarSystem("Corona Australis");
LocationAPI hyper = Global.getSector().getHyperspace();

system.setBackgroundTextureFilename("graphics/backgrounds/CoronaAustralis.jpg");

// create the star and generate the hyperspace anchor for this system
PlanetAPI CoronaAustralis = system.initStar("neut_star_neutron", // id in planets.json
200f, // radius (in pixels at default zoom)
2500, 3000);   // location in hyperspace

system.setLightColor(new Color(255, 255, 255)); // light color in entire system, affects all entities


/*
* addPlanet() parameters:
* 1. What the planet orbits (orbit is always circular)
* 2. Name
* 3. Planet type id in planets.json
* 4. Starting angle in orbit, i.e. 0 = to the right of the star
* 5. Planet radius, pixels at default zoom
* 6. Orbit radius, pixels at default zoom
* 7. Days it takes to complete an orbit. 1 day = 10 seconds.
*/
PlanetAPI p1 = system.addPlanet(CoronaAustralis, "Deadworld IS7", "neut_rocky_unstable", 0, 150, 2500, 100);
//PlanetAPI a2 = system.addPlanet(star, "Salus", "gas_giant", 230, 350, 7000, 250);

//PlanetAPI a21 = system.addPlanet(a2, "Cruor", "rocky_unstable", 45, 80, 800, 25);
//PlanetAPI a22 = system.addPlanet(a2, "Volturn", "water", 110, 120, 1400, 45);

//PlanetAPI a3 = system.addPlanet(star, "Umbra", "rocky_ice", 280, 150, 12000, 650);

p1.setCustomDescriptionId("neut_planet_IS7");
//a2.setCustomDescriptionId("planet_salus");
//a21.setCustomDescriptionId("planet_cruor");
//a22.setCustomDescriptionId("planet_volturn");
//a3.setCustomDescriptionId("planet_umbra");

p1.getSpec().setPlanetColor(new Color(255,215,190,255));
p1.getSpec().setAtmosphereColor(new Color(160,110,45,140));
p1.getSpec().setCloudColor(new Color(255,164,96,200));
p1.getSpec().setTilt(10);
p1.applySpecChanges();

/*
* addAsteroidBelt() parameters:
* 1. What the belt orbits
* 2. Number of asteroids
* 3. Orbit radius
* 4. Belt width
* 6/7. Range of days to complete one orbit. Value picked randomly for each asteroid.
*/
system.addAsteroidBelt(p1, 50, 1100, 128, 40, 80);


/*
* addRingBand() parameters:
* 1. What it orbits
* 2. Category under "graphics" in settings.json
* 3. Key in category
* 4. Width of band within the texture
* 5. Index of band
* 6. Color to apply to band
* 7. Width of band (in the game)
* 8. Orbit radius (of the middle of the band)
* 9. Orbital period, in days
*/
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 2, Color.white, 256f, 1400, 40f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 2, Color.white, 256f, 1450, 60f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 2, Color.white, 256f, 1500, 80f);

system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 3, Color.white, 256f, 1750, 70f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 3, Color.white, 256f, 1800, 90f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 3, Color.white, 256f, 1850, 110f);

system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 0, Color.white, 256f, 2100, 50f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 0, Color.white, 256f, 2150, 70f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 0, Color.white, 256f, 2200, 80f);
system.addRingBand(CoronaAustralis, "misc", "rings1", 256f, 1, Color.white, 256f, 2250, 90f);

system.addRingBand(p1, "misc", "rings1", 256f, 2, Color.white, 256f, 1400, 40f);
system.addRingBand(p1, "misc", "rings1", 256f, 2, Color.white, 256f, 1450, 60f);
system.addRingBand(p1, "misc", "rings1", 256f, 2, Color.white, 256f, 1500, 80f);

system.addRingBand(p1, "misc", "rings1", 256f, 3, Color.white, 256f, 1750, 70f);
system.addRingBand(p1, "misc", "rings1", 256f, 3, Color.white, 256f, 1800, 90f);
system.addRingBand(p1, "misc", "rings1", 256f, 3, Color.white, 256f, 1850, 110f);




JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("Jump Point Alpha");
OrbitAPI orbit = Global.getFactory().createCircularOrbit(p1, 0, 400, 40);
jumpPoint.setOrbit(orbit);
jumpPoint.setRelatedPlanet(p1);
jumpPoint.setStandardWormholeToHyperspaceVisual();
system.addEntity(jumpPoint);

/*
* addPlanet() parameters:
* 1. What the planet orbits (orbit is always circular)
* 2. Name
* 3. Planet type id in planets.json
* 4. Starting angle in orbit, i.e. 0 = to the right of the star
* 5. Planet radius, pixels at default zoom
* 6. Orbit radius, pixels at default zoom
* 7. Days it takes to complete an orbit. 1 day = 10 seconds.
*/

SectorEntityToken NCstation1 = system.addOrbitalStation(CoronaAustralis, 200, 700, 90, "Small Extraction Drill", "neutrinocorp");
SectorEntityToken NCstation2 = system.addOrbitalStation(CoronaAustralis, 200, 1600, 90, "Large Processing Dock", "neutrinocorp");
SectorEntityToken NCstation3 = system.addOrbitalStation(p1, 45, 300, 50, "Small Research Station", "neutrinocorp");

initStationCargo(NCstation1);
initStationCargo(NCstation2);
initStationCargo(NCstation3);

// example of using custom visuals below
// a1.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "hull_breach", 800, 800));
// jumpPoint.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "space_wreckage", 1200, 1200));
// station.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "cargo_loading", 1200, 1200));

// generates hyperspace destinations for in-system jump points
system.autogenerateHyperspaceJumpPoints(true, true);

system.addSpawnPoint(new neutrinoConvoySpawnPoint(sector, system, 7, 1, t