Page 1 of 1

[Tutorial] Weapon Boost Effect

Posted: Sun Jul 24, 2016 7:41 am
by gentasaurus
As you may know, some weapons in FTL (the chain weapons) have what is known as a boost effect.
I couldn't find any good documentation on how to use this effect in your own modded weapons.
Here's a tutorial on how to use this effect, from everything in your code to your graphics.

Step 1: The Weapon Code (blueprints file)
There are two types of boost that FTL uses: cooldown and damage.

Cooldown

Code: Select all

<boost>
	<type>cooldown</type>
	<amount>(x)</amount>
	<count>(y)</count>
</boost>
The <boost> tag goes within your weaponBlueprint tag and has three entries: type, amount, and count.
In this case, the weapon cooldown will be reduced by (x) every time the weapon fires, until the weapon fires (y) times. This is the boost cap.
Negative amounts don't have any effect.

Damage

Code: Select all

<boost>
	<type>damage</type>
	<amount>(z)</amount>
	<count>(w)</count>
</boost>
In case the boost type is damage, the weapon will gain (z) damage (this seems to apply to ion damage as well) every time it fires.
Once it fires (w) times, the boost cap will be reached and the boost will no longer be applied.

As you can see, both scenarios are identical aside from the effect.

Step 2: The Animation Code (animations file)
Let's take a look at the chain laser weapon animation:

Code: Select all

<animSheet name="chainlaser" w="275" h="49" fw="25" fh="49">weapons/chainlaser_1_strip11.png</animSheet>
<weaponAnim name="chainlaser">
	<sheet>chainlaser</sheet>
	<desc length="11" x="0" y="0"/>
	<chargedFrame>4</chargedFrame>
	<fireFrame>6</fireFrame>
	<firePoint  x="16" y="16"/>
	<mountPoint x="4" y="37"/>
	<boost>chainlaser_1_charge</boost>
</weaponAnim>
Looks like a normal weapon animation, right? WRONG.
Notice the <boost> tag. It is referring to a second animation sheet. It looks like this:

Code: Select all

<animSheet name="chainlaser_1_charge" w="75" h="49" fw="25" fh="49">weapons/chainlaser_1_chargeglow_strip3.png</animSheet>
<anim name="chainlaser_1_charge">
	<sheet>chainlaser_1_charge</sheet>
	<desc length="3" x="0" y="0"/>
	<time>1.0</time>
</anim>
IT MUST GO ABOVE YOUR WEAPON ART CODE. The game won't load it if it comes after.
This is the boost animation code for the chain laser. Notice how h (height), fw (frame width) and fh (frame height) match the original animation. As you will see later, it would be silly if this wasn't the case. The only thing that differs is the width.
Since the chain laser has 3 boost stages, the boost animation is 3 frames long. Make sure the <time> is 1.0 for all boost animations.

Step 3: The Graphics
Building off of the chain laser example, here are its specified graphics:

chainlaser_1_strip11.png
Image
Just a normal weapon animation here.



chainlaser_1_chargeglow_strip3.png
Image
As you can see, there are three overlay frames for each boost stage.
In case your boost animation is slightly misplaced in-game, you can fiddle with the image to move it around.

Now you know how easy it is to make a custom weapon with a boost effect!

Re: [Tutorial] Weapon Boost Effect

Posted: Sun Jul 24, 2016 6:28 pm
by elijahdb
I have a problem. My weapon's chain effect works perfectly fine, but my weapon looks really weird in-game. It doesn't recognize the glow of the weapon (I forget if the chainglow is showing or not) and when it fires it acts... weird. I don't know how to describe it.

Could you check out my blueprint (again) please? You'll need to rename the .zip to .ftl to play it in the game so you can see how it acts.

http://www.dreniarb.com/elijah/Molok%20Beam.zip

Re: [Tutorial] Weapon Boost Effect

Posted: Sun Jul 24, 2016 7:13 pm
by gentasaurus
elijahdb wrote: Could you check out my blueprint (again) please? You'll need to rename the .zip to .ftl to play it in the game so you can see how it acts.
Hey elijah; yeah, I'd be happy to take a look, but I won't have access to a computer until tomorrow. In the meantime, can you check a few things?

1. Does your weapon look and fire normal without the boost effect?

2. Are you sure your w/h/fw/fh match the dimensions of your graphics?

Re: [Tutorial] Weapon Boost Effect

Posted: Sun Jul 24, 2016 8:46 pm
by elijahdb
Yup, my graphics match up as far as I can tell. You may want to still look at them. (I found that the reason it wasn't glowing was because I forgot to put the <chargeImage> tag in... it's off-center now, but I'll fix it when I get this problem out of the way)

As for the weapon working without the boost effect, it still has the same firing problem. When it fires, the image slides up for about two sections of the firing sequence and then goes back to normal. You can look at this yourself if I didn't describe it well enough.

Re: [Tutorial] Weapon Boost Effect

Posted: Mon Jul 25, 2016 10:04 am
by gentasaurus
elijahdb wrote:Yup, my graphics match up as far as I can tell. You may want to still look at them. (I found that the reason it wasn't glowing was because I forgot to put the <chargeImage> tag in... it's off-center now, but I'll fix it when I get this problem out of the way)

As for the weapon working without the boost effect, it still has the same firing problem. When it fires, the image slides up for about two sections of the firing sequence and then goes back to normal. You can look at this yourself if I didn't describe it well enough.
Elijah; please read the PM I sent you regarding your issues.

Re: [Tutorial] Weapon Boost Effect

Posted: Tue Oct 04, 2016 7:54 am
by Auron1
A quick question: when using the "cooldown" boost, you don't define anywhere the final firing rate, you just says to FTL how many times the ROF changes. Am I right?

BTW, why isn't this thread a sticky? :?:

Re: [Tutorial] Weapon Boost Effect

Posted: Tue Oct 04, 2016 10:33 am
by Sleeper Service
Because there is a sticky thread that has all the tutorials in it. ;)