Content:
I The base Code
-creating a mod using GGM
-creating Weapon
-Overview on stats.
-testing
II The visuals
-explanation
-picture
-code
III Sound
adding sound
I The base Code
What I tell you here is how you create a mod which will be a .ftl file in the end that you can use with GMM (http://www.ftlgame.com/forum/viewtopic.php?f=4&t=2464) like all mods currently available. You can just simply mod the existing XMLs in the game, but that would mean you had to reinstall to get rid of the modded stuff.
First of all you need to create the directory for the mod:
Create a folder named: "my_weapon" anywhere you want (you can ctrl+v the final .ftl later into the mod folder). Within this folder "my_weapon" you create some subfolders:
my_weapon/data/
my_weapon/img/
my_weapon/img/weapons
my_weapon/audio/waves (only if you intend to add a custom sound)
my_weapon is the name of your mod and can be anything. The subfolders need to be called like that and be in that order or else it will not load in GMM.
Then you open a Text editor of your choice (I am using Notepad++) and you create 2 files there. The two will be called
blueprints.xml.append
animations.xml.append
within the my_weapon/data/ directory.
Make sure you save them with "all files" so that way you dont accidentally save them as .txt.
Now for the actual coding:
You will only be using XML language to change values within some predetermined tags. I hope you are familiar with xml and html, if not you might wanna take a short look at a teaching side to learn it. It will be difficult without xml knowledge.
Every weapon you make must be within a weaponBlueprint tag. This tag contains the name of the weapon which is its unique id. If you create 2 weapons with the same name the game will pick the weapon located the furthest down the xml file. You can use this to overwrite existing weapons in the game.
In the following I will use the burst_laser_1 (which is the basic laser in game) as an example. I am gonna write a #essential comment behind every important line which must be in every blueprint of a weapon or it will not work (I am not gonna do it behind closing tags since it should be obvious that everthing needs to be closed). All not essential tags have generally default values (i.e. 0) which they default to.
Code: Select all
<weaponBlueprint name="LASER_BURST_1"> <!-- #essential -->
<type>LASER</type> <!-- #essential -->
<title>Defense Laser Mark I</title> <!-- #essential -->
<short>Basic Laser</short> <!-- #essential -->
<desc>Very weak laser.</desc> <!-- #essential -->
<tooltip>Only one shot, one damage per shot.</tooltip> <!-- #essential -->
<damage>1</damage>
<shots>1</shots> <!-- #essential if its a Laser weapon-->
<sp>0</sp>
<fireChance>1</fireChance>
<breachChance>0</breachChance>
<cooldown>10</cooldown> <!-- #essential -->
<power>1</power> <!-- #essential -->
<cost>20</cost> <!-- #essential -->
<bp>2</bp>
<rarity>0</rarity> <!-- #essential -->
<image>laser_light1</image> <!-- #essential -->
<launchSounds> <!-- #essential -->
<sound>lightLaser1</sound>
<sound>lightLaser2</sound>
<sound>lightLaser3</sound>
</launchSounds>
<hitShipSounds> <!-- #essential -->
<sound>hitHull2</sound>
<sound>hitHull3</sound>
</hitShipSounds>
<hitShieldSounds> <!-- #essential -->
<sound>hitShield1</sound>
<sound>hitShield2</sound>
<sound>hitShield3</sound>
</hitShieldSounds>
<missSounds> <!-- #essential -->
<sound>miss</sound>
</missSounds>
<weaponArt>laser_burst_1</weaponArt> <!-- #essential -->
</weaponBlueprint>
Code: Select all
<weaponBlueprint name="LASER_BURST_1">
Declares the name of the weapon itself. All values of the weapon must stand within this and the closing tag.
<type>LASER</type>
Declares what weapon type it is. There are 4 types: Laser, Beam, Bomb, Missile.
<title>
<short>
title is the name you see in game if you look at the weapon in a store. short is the short form which will be displayed at your weapons bar (short form should be like this "mini Beam" Every word should not go over 5 letters or it will look ugly. But it will work with higher lengths too).
<desc>
<tooltip>
Desc is the description of the weapon you read in stores. tooltip is the shorter version you see in your HUD.
<shots>
only used for lasers and bombs (bombs always 1... can be higher but looks stupid then). Tells how many shots a weapon is firing. For Example a Burst MK II fires 3 shots: <shots>3</shots>
<damage>
<fireChance>
<breachChance>
determine the damage , fire chance and breach chance for every single shot of the weapon (per room if its a beam)
<sp>
SP means shield piercing. Every point lets the weapon pierce another layer of shields. (against popular believe the missiles dont pierce on their own. They need that <sp> tag to be set to 4+ (normal 5) in order to avoid shields.
<bp>
has no actual use in game. You can Ignore that one.
<power>
<cost>
<cooldown>
power is the power the weapon needs to function. Cost its cost in a store. Cooldown is how long it takes to recharge the weapon after firing.
<rarity>
Sets how rare it is in game.
0 means the weapon will not drop randomly or appear in stores.
1 lowest rarity, meaning that it is very likely to appear in a store or drop.
5 highest rarity. barely ever shows up.
Make sure only to enter values between 0-5 or it might crash.
<image>
the projectile image (see part II)
<weaponArt>
the Gun's image (see part II)
<launchSounds>
<hitShipSounds>
<hitShieldSounds>
<missSounds>
Lists of <sound> that plays on launch/hit/miss (miss is always the same but you can add new ones if you like see Part III)
Code: Select all
<weaponBlueprint name="LASER_BURST_1">
<type>LASER</type>
<title>Defense Laser Mark I</title>
<short>Basic Laser</short>
<desc>Very weak laser.</desc>
<tooltip>Only one shot, one damage per shot.</tooltip>
<damage>1</damage>
<shots>1</shots>
<sp>0</sp>
<fireChance>1</fireChance>
<breachChance>0</breachChance>
<cooldown>10</cooldown>
<power>1</power>
<cost>20</cost>
<bp>2</bp>
<rarity>0</rarity>
<image>laser_light1</image>
<launchSounds>
<sound>lightLaser1</sound>
<sound>lightLaser2</sound>
<sound>lightLaser3</sound>
</launchSounds>
<hitShipSounds>
<sound>hitHull2</sound>
<sound>hitHull3</sound>
</hitShipSounds>
<hitShieldSounds>
<sound>hitShield1</sound>
<sound>hitShield2</sound>
<sound>hitShield3</sound>
</hitShieldSounds>
<missSounds>
<sound>miss</sound>
</missSounds>
<weaponArt>laser_burst_1</weaponArt>
</weaponBlueprint>
If you want your new weapon to be OP as hell you could change damage to 5 and the shots to 10 or give it 5 shield pierce. Here is your creativity needed.
You can also add another feature of the list below to certain weapon types.
Overview value tags:
Code: Select all
<type> //declares type of weapon (possible: LASER, MISSILE,BOMB,BEAM) (all)
Only difference between missile and Laser is that Missile projectiles are not animated
<damage> //how much Hull damage a shot does (all)
<ion> // how much ion damage a weapon does (all, buggy on the beam ie will deplete any shields regardeless of rooms hit
<sysDamage> //how much damage it will do to a system (all)
<persDamage> // how much damage it will do to crew (all) minus values heal but apparently only on bombs
<shots> // how many shots it fires (only Missile, Laser, Bomb)
<sp> // How many shields it pierces (all,but useless on bombs)
<fireChance> //how high the chance of fire is (between 0-10) (all)
<breachChance> //how high the chance of a breach is (between 0-10) (all)
<cooldown>// the cooldown of the weapon (all)
<power> //the amount of power needed to power the weapon (all)
<cost> //how much a weapon costs to purchase (all)
<missiles> // how many missiles a weapon needs to fire (all)
<speed> //how fast a weapon shot flies (by a beam it's the speed it goes over hull) (all)
<length> //how long a beam is (beam only)
<hullBust> //determines whether the weapon does 2x times damage on systemless rooms.(0-1 only) (all)
<lockdown> //the crystal lock-down thingy... I shouldnt work on beams, but never tried it myself (all but beams)
<rarity> //how rare it is (0-5) (all)
<explosion> //adds a explosion animation to the weapon when hitting (laser missile bomb)
<image> //projectile image/animation for the weapon (Beam contact image on beams) (all)
<weaponArt> // the weaponart for the gun attached to your ship itself (all)
Once you are done changing the values and images around (See Part II for that) you can actually already test your weapon!
There are 2 ways to test it: patch it and hope you come randomly across your weapon (haha) or you add it to a ship and look how it goes.
For that you will need to copy a existing ships blueprint into your blueprint.xml.append. Take this for example:
Code: Select all
<!-- THE KESTREL -->
<!-- LAYOUT = DEFAULT -->
<!-- SHIP ID = 0 -->
<shipBlueprint name="PLAYER_SHIP_HARD" layout="kestral" img="kestral">
<class>Kestrel Cruiser</class>
<name>The Kestrel</name>
<desc>This class of ship was decommissioned from Federation service years ago. After a number of refits and updating this classic ship is ready for battle.</desc>
<systemList>
<pilot power="1" room="0" start="true" img="room_pilot">
<slot>
<direction>right</direction>
<number>0</number>
</slot>
</pilot>
<doors power="1" room="2" start="true" img="room_doors"/>
<sensors power="1" room="3" start="true" img="room_sensors"/>
<medbay power="1" room="4" start="true" img="room_medbay">
<slot>
<number>1</number>
</slot>
</medbay>
<oxygen power="1" room="13" start="true" img="room_oxygen"/>
<shields power="2" room="5" start="true" img="room_shields"/>
<engines power="2" room="14" start="true" img="room_engines"/>
<weapons power="3" room="10" start="true" img="room_weapons"/>
<drones power="2" room="1" start="false"/>
<teleporter power="1" room="15" start="false"/>
<cloaking power="1" room="8" start="false"/>
</systemList>
<weaponSlots>4</weaponSlots>
<droneSlots>2</droneSlots>
<weaponList count="2" missiles="8">
<weapon name="MISSILES_2_PLAYER"/>
<weapon name="LASER_BURST_3"/>
</weaponList>
<health amount="30"/>
<maxPower amount ="8"/>
<crewCount amount = "3" class="human"/>
</shipBlueprint>
So the only thing that needs to concern you is this line here:
Code: Select all
<weaponList count="2" missiles="8">
<weapon name="MISSILES_2_PLAYER"/>
<weapon name="LASER_BURST_3"/>
</weaponList>
As said before: since you simply adding the kestrel bluprint again, FTL will pick your newly written one over the old default one. So that way the new in game kestrell will have your new weapon.
Now you can save your blueprint.xml.append file and close the editor.
Only thing left is the creation of a .ftl file which the GMM can use.
.ftl files are only renamed zip files.
So that means that you add the two folders data and img within your my_weapon folder to a package using winzip or winrar or similar program. Dont simply pack your my_weapon folder directly or else you have the worng structure within the package. GMM needs to have the files in the right directory and a my_weapon directory he will ignore rendering your entire work useless.
Once packed rename the my_weapon.zip to my_weapon.ftl . If you cant see the file extensions you need to enable them some where under windows (Google).
Now simply copy-paste the my_weapon.ftl to GMM's Mod directory.
Run GMM and select your mod.
Run FTL.
Look at the awesome weapon you made and play!
II The Visuals
If you dont want your new weapon to look as dull as the standard stuff you want to add a new image and animation.
For that to work you first need to know how FTL will treat the image you give it:

Here you see the basic laser animation strip.
The gray arrow points onto the base or depowered image. If your weapon is not powered, it will show this one.
The white arrow shows the start of the charging animation. Until your weapon is fully powered FTL will go through the remaining images of the powerup animation to the Charged Image until the weapon is powered.
The Green arrow is the Charged Image. Here the weapon is off cd and ready to fire. (this image also shows in stores)
The Red Arrow is the firing image. All images between the Charged Image and firing image are the shooting animation. All images behind the firing image are the recoil animation. (just as a note: Beam weapons only use the recoil animation as the animation they shoot).
So now you know how the weapons animations are split up within the image. But where do you determine how many images every single phase has?
Well You got this animations.xml.append file right? There you need to add the animation. it consists always out of 2 things:
The sheet
Code: Select all
<animSheet name="laser_burst_1" w="192" h="60" fw="16" fh="60">weapons/laser1_strip12.png</animSheet>
The name is unimportant as long as you use it in the sheet section of the actual anim.
In FTL vanilla all sheets and their anims are called the same. I suggest doing that too.
And the Animation itself.
Code: Select all
<weaponAnim name="laser_burst_1">
<sheet>laser_burst_1</sheet>
<desc length="12" x="0" y="0"/>
<chargedFrame>5</chargedFrame>
<fireFrame>8</fireFrame>
<firePoint x="10" y="16"/>
<mountPoint x="2" y="44"/>
</weaponAnim>
-with sheet you are loading the right sheet you declared previously.
-desc length is the total length of the animation (12 images in this example) x/y are used if you have empty images at the start or just dont want to use all images on the animation. Normally you will always have them set to 0.
-chargedFrame is the image within the animation which is fully powered. FTL will use all image before this one as power up animation.
-Fireframe is the actual shooting image. All image before this are the shooting animation and all behind it are the recoil animation.
With those tags you have declared your image and animation. If your image looks good the animation should work as intended.
firePoint and mountPoint are used to make an offset on your Gun (where it shoots from and where it is connected with the ship). Keep in mind that y= 0 is the highest pixel in the image (Ftl counts from the top to bot); x is how you would expect it.
If you want to create a new shot animation too, their are a bit different from a weapon animation:
Code: Select all
<animSheet name="laser_light1" w="200" h="20" fw="50" fh="20">weapons/laser_light_strip4.png</animSheet>
<anim name="laser_light1">
<sheet>laser_light1</sheet>
<desc length="4" x="0" y="0"/>
<time>0.5</time>
</anim>
You can create a new Beam_contact image too (your animation will be glued at the end of the beam).
Note: Missile weapons will not use animations on their projectiles, no matter if you declare one ore not. Instead it always picks the first frame of your animation.
After you done the writing in animation.xml.append Dont forget to change the used Image in your blueprints.xml.append too. Or else you have a fully functional animation and just dont use it on your weapon.
You have to change these two tages within your weaponblueprint
Code: Select all
<image>laser_light1</image>
<weaponArt>laser_burst_1</weaponArt>
Once you are done coding wise and you have placed the image in the my_weapon/img/weapons folder then you can create a zip and rename it like explained above.
And your new weapon is ready to go!
III Sound
Finally if you want to add a new sound you need to add the needed directory and place your sound there:
my_weapon\audio\waves\weapons\ Sound_name.wav
Afterward you create a sounds.xml.append file in your data folder.
And within it you declare your sound:
Code: Select all
<lightLaser1 volume="2">weapons/bp_laser_3.ogg</lightLaser1>
For example you can call the sound:
Code: Select all
<OHMYGODWHATASOUNDOMG volume="2">weapons/bp_laser_3.ogg</OHMYGODWHATASOUNDOMG>
Volume sets how loud the sound get's played. 0 = silent, 1= very quiet, 5= loudest.
You then only have to add your new sound within your weapon and you are good to go:
Code: Select all
<launchSounds>
<sound>OHMYGODWHATASOUNDOMG</sound>
<sound>lightLaser2</sound>
<sound>lightLaser3</sound>
</launchSounds>
That's all I can think off right now.
Have fun making OP weapons!
*Looks at clock* Well that is one afternoon wasted.