Page 1 of 1

Custom weapon art

Posted: Fri Apr 17, 2015 5:54 pm
by Biohazard063
Hey everybody,

Been learning a lot of stuff on my own the last few days and been getting help from others in the mean time of course.
This community is frigging awesome.
Anyway, been trying my hand on custom weapons and whilst I can create the weapon and add it to the ship, I can't get a custom image to show up.
I can however change the images of existing weapons and get those to work.
I'm assuming I need to change the weapon art in the weapon blueprint to something specific but that part still eludes me a bit.

This is what I'm trying to get to work.

Code: Select all

<weaponBlueprint name="BEAM_ARC">
	<type>BEAM</type>
	<tip>tip_crew_beam</tip>
	<title>Arc Beam</title>
	<short>Arc Beam</short>
	<desc>A modified Anti-Bio Beam. Less damaging for crew but can deal damage to systems.</desc>
	<tooltip>2 power beam weapon that damages enemy crew and systems.</tooltip>
	<!--<desc>Power Req: 2    A beam weapon that does 1 damage and starts fires in a line if the enemy has no shields.</desc>-->
	<damage>0</damage>
	<persDamage>2</persDamage>
	<sp>0</sp>
	<fireChance>0</fireChance>
	<breachChance>0</breachChance>
	<sysDamage>1</sysDamage>
	<cooldown>14</cooldown>
	<color>
		<!-- Color only works for beams -->
		<r>235</r>
		<g>52</g>
		<b>239</b>
	</color>
	<speed>13</speed>
	<power>2</power>
	<cost>50</cost>
	<bp>6</bp>
	<rarity>0</rarity>
	<length>140</length>
	<image>beam_contact</image>
	<launchSounds>
		<sound>beam2</sound>
	</launchSounds>
	<weaponArt>beam_bio</weaponArt>
	<iconImage>beam</iconImage>
</weaponBlueprint>
For now, I'm using the following images to change the appearance which are recolors of the original bio beam:
Image
The weapon images
Image
The glow

I tried changing <weaponArt>beam_bio</weaponArt> to <weaponArt>beam_arc</weaponArt> whilst changing the name of the images from beam_bio_strip8 to beam_arc_strip8. Same with glow.
But I get an invisible weapon. Changing the names back from arc to bio makes it work again.
The images are in /img/weapons of the resource folders of the ship.
Anyway, I'm kind of confused on what I could do since that's the only line of code where it still refers to the biobeam.
For this weapon in particular it's not that important since the Bio-beam is a pretty rare weapon and the ship it's going on will replace Slug A anyway. Still, I'm trying to do the same with a type of bomb so...

Any help will be well appreciated and credit will be given when the ship finally gets released.

Re: Custom weapon art

Posted: Fri Apr 17, 2015 6:27 pm
by Sleeper Service
If you want to add a new weapon it needs its own animSheet and Anim. Those are bits of code stored in animations.xml. Together with the weapon blueprint, they compose the three parts of data an FTL weapon is essentially made of. Lets look at the afford mentioned Bio Beam as an example:

The Bio Beams animation sheet, stored in animations.xml

Code: Select all

<animSheet name="beam_bio" w="240" h="46" fw="30" fh="46">weapons/beam_bio_strip8.png</animSheet>
This tells the game how the weapon sprite is structured. It details how the sprite is named, how large it is and how large a single frame is. The animSheet is used by:

The Bio Beams animation data, also stored in animations.xml

Code: Select all

<weaponAnim name="beam_bio">
	<sheet>beam_bio</sheet>
	<desc length="8" x="0" y="0"/>
	<chargedFrame>1</chargedFrame>
	<fireFrame>2</fireFrame>
	<firePoint  x="18" y="19"/>
	<mountPoint x="3" y="37"/>
	<chargeImage>weapons/beam_bio_glow.png</chargeImage>
</weaponAnim>
This tells the game how many frames the weapon animation will have and which frames to use for indicating certain weapon status like when the weapon is charged or firing. It also tells the game where on the frame to spawn the projectile (fireFrame) where to mount the weapon (mountPoint) and which graphic to use as a glow image (for charging). Look at the bio beam sprite and compare it to the data to get an better idea of what that all means. The animSheet is then used by:

The Bio Beams weapon blueprint, stored in blueprints.xml

Code: Select all

<weaponBlueprint name="BEAM_BIO">
	<type>BEAM</type>
	<tip>tip_crew_beam</tip>
	<title>Anti-Bio Beam</title> 
	<short>Anti-Bio Beam</short>
	<desc>This terrifying beam does no physical damage but rips through organic material, dealing heavy damage to crewmembers.</desc>
	<tooltip>2 power beam weapon that greatly damages enemy crew.</tooltip>
	<!--<desc>Power Req: 2    A beam weapon that does 1 damage and starts fires in a line if the enemy has no shields.</desc>-->
	<damage>0</damage>
	<persDamage>4</persDamage>
	<sp>0</sp>
	<fireChance>0</fireChance>
	<breachChance>0</breachChance>
	<cooldown>16</cooldown>
	<color> <!-- Color only works for beams -->
		<r>255</r>
		<g>110</g>
		<b>0</b>
	</color>
	<speed>13</speed>
	<power>2</power>
	<cost>50</cost>
	<bp>6</bp>
	<rarity>5</rarity>
	<length>140</length>
	<image>beam_contact</image>
	<launchSounds>
		<sound>beam2</sound>
	</launchSounds>
	<weaponArt>beam_bio</weaponArt> 
	<iconImage>beam</iconImage>
</weaponBlueprint>
Thats the thing you already know hot to edit. As far as I can tell you are simply missing your custom animSheet and weaponsAnim. If you changing <weaponArt>beam_bio</weaponArt> to <weaponArt>beam_arc</weaponArt> then the game does not know what that means, because beam_arc does not exist as a weaponAnim

I find the easiest way to get to understand all this is looking at the original game files. I have a large .txt that contains all the separate files from the /data folder in one file. You might find this helpful for cross-searching bits of connected data. Try to find all the date used by the BLII for example, then reverse engender the pieces for your own weapons. I don't know, thats how just how I learned it. *shrug* Anyway, happy modding.

Re: Custom weapon art

Posted: Fri Apr 17, 2015 6:41 pm
by Biohazard063
Oh, so basically if I create an animations.xml.append file saying :

Code: Select all

<animSheet name="beam_arc" w="240" h="46" fw="30" fh="46">weapons/beam_arc_strip8.png</animSheet>
and

Code: Select all

<weaponAnim name="beam_arc">
   <sheet>beam_arc</sheet>
   <desc length="8" x="0" y="0"/>
   <chargedFrame>1</chargedFrame>
   <fireFrame>2</fireFrame>
   <firePoint  x="18" y="19"/>
   <mountPoint x="3" y="37"/>
   <chargeImage>weapons/beam_arc_glow.png</chargeImage>
</weaponAnim>
It should work, if I rename the 2 images in the OP to
beam_arc_glow.png and weapons/beam_arc_strip8.png

Seeing how it's only a recoloring of the biobeam.
Nice, I'll try it out and let you know.
Once again, you bailed me out of a pinch. Now there's almost nothing I can do assuming the events.xml.append file I created to give the Arc Beam the same blue options as the Bio beam has works.
I have indeed learned a lot by looking at the original game files (like creating the Partisan artillery), you just don't find anything about the animation sheet.

Re: Custom weapon art

Posted: Fri Apr 17, 2015 6:48 pm
by Biohazard063
Sir, I bow my head down to you.

It works.

Re: Custom weapon art

Posted: Sat Apr 18, 2015 11:44 am
by Biohazard063
Turns out bombs are a bit more of a pain to get right.

Still trying though. Strangely enough I got the basic laser animation and weapon art... odd.

EDIT : Got the part on my side of the screen working.
No launch sound yet though.
Bomb is invisible on enemy side. Probably a problem with the <image>bomb_chaos</image> part of the bomb code or the animation of it.

But we're making progress.

Re: Custom weapon art

Posted: Sat Apr 18, 2015 12:00 pm
by Sleeper Service
Check your entries, that happens if you assign a bad weapon ID to a ship if I remember correctly. The game can't find the correct weapon and puts that dummy basic laser in as a placeholder.

Re: Custom weapon art

Posted: Sat Apr 18, 2015 12:20 pm
by Biohazard063
You ninja'd me on that one.

Anyway :
Got the part on my side of the screen working. As in the weapon art is there and the loading and firing animation works. No launch sound yet though.
Bomb is invisible on enemy side. Probably a problem with the <image>bomb_chaos</image> part of the bomb blueprint or the animation part. Probably the last bit.

But we're making progress.

Re: Custom weapon art

Posted: Sun Apr 19, 2015 11:00 am
by Biohazard063
O, my, god...

It was frigging typo in the animation.xml.append that made the bomb not appear ! :oops:
Wow. Anyway, problem resolved.
Thanks for the help !

Re: Custom weapon art

Posted: Sun Apr 19, 2015 11:36 am
by Sleeper Service
Biohazard063 wrote:It was a frigging typo
That is my experience with debugging FTL mods in a nutshell. :D

Re: Custom weapon art

Posted: Sun Apr 19, 2015 5:17 pm
by Biohazard063
Problem is you're experienced enough to think : " This should work, every line of code needed is there." And you'll go over checking for typo's .
My experience now was : "OK, what am I missing, what piece of code did I forget ? " Went through a few tutorials, cross referencing with similar existing weapons and when I gave up and stared blankly at the animation.xml.append I noticed I type "choas" rather then "chaos" and I thought : "Oh, you have got to be kidding me."

Well, lesson learned.