[Tutorial] New Guide on creating weapons

Discuss and distribute tools and methods for modding. Moderator - Grognak
User avatar
mr_easy_money
Posts: 621
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Tutorial] New Guide on creating weapons

Postby mr_easy_money » Mon May 28, 2018 4:24 am

Kacpo wrote:Ok, that third file: "mod-appendix" is something I see first time.
What is it? What does it contain? What it's for?

mod-appendix contains a single file called metadata.xml. the purpose of this file is to create a description of the mod when viewing it in the Slipstream Mod Manager, so you have more information about the mod than just the title. the mod-appendix will be generated automatically when using Slipstream v1.9.1 to create the template for a mod, using File -> New Mod...
Kacpo wrote:I want to change the image of a weapon itself (the gun) and the projectile (the shell, laser, missile, etc.)

okay, so we will need to make a new anim for the projectile, and a new weaponAnim for the weapon itself.
Kacpo wrote:I also want to make the weapon animation (charging, firing), BUT the projectile is a single picture (a single frame)

How should I go about this, because I found myself confused with which part of a animations.xml is supposed to refer to gun and which to projectile.

The file (this is animations.xml) I have right now looks like:

Code: Select all

<animSheet name="rod" w="50" h="10" fw="50" fh="10">weapons/rod.png</animSheet>

<weaponAnim name="railgun">
   <sheet>railgun</sheet>
   <desc length="11" x="0" y="0"/>
   <chargedFrame>7</chargedFrame>
   <fireFrame>11</fireFrame>
   <firePoint  x="15" y="22"/>
   <mountPoint x="2" y="65"/>
</weaponAnim>


the Railgun is the name of Weapon animation strip
Image
and Rod is the name of the projectile pic.
Image

Is that correct (and I'm almost certian it is not), or should I create another paragraph within file, or new file altogether?

no, it's not correct. the projectile should have both an anim and an animSheet, and the weapon itself should have both a weaponAnim and an animSheet. the anim/weaponAnim describes the animation, and the animSheet describes the image's properties and location.

here's some example code like you wanted:
(I'll just call the image for the weapon itself, rail_cannon_strip11.png ... for the image of the projectile, rail_projectile.png)

animation code for the projectile:

Code: Select all

<!-- note that the height of the projectile's image is listed as 11 pixels on imgur, not 10 like you have there -->
<animSheet name="rail_projectile" w="50" h="11" fw="50" fh="11">weapons/rail_projectile.png</animSheet>

<anim name="rail_projectile">
   <sheet>rail_projectile</sheet>
   <desc length="1" x="0" y="0"/><!-- only one frame -->
   <time>1.0</time><!-- meaningless since there is only one frame -->
</anim>

animation code for the weapon itself:

Code: Select all

<!-- image width / number of frames yields frame width. 242/11 = 22, the frame width -->
<animSheet name="rail_weapon" w="242" h="71" fw="22" fh="71">weapons/rail_cannon_strip11.png</animSheet>

<weaponAnim name="rail_weapon">
   <sheet>rail_weapon</sheet>
   <desc length="11" x="0" y="0"/>
   <chargedFrame>6</chargedFrame><!-- you listed 7, but here we begin with 0 as the 1st frame -->
   <fireFrame>10</fireFrame><!-- as above, which is why 11 does not work since 10 is the 11th frame -->
   <firePoint  x="15" y="22"/>
   <mountPoint x="2" y="65"/>
</weaponAnim>

be sure to reference the new anim in <image> and the new weaponAnim in <weaponArt> for your weaponBlueprint:

Code: Select all

<weaponBlueprint name="...something...">
   <type>LASER</type>
   ...
   <image>rail_projectile</image>
   ...
   <weaponArt>rail_weapon</weaponArt>
</weaponBlueprint>
Kacpo wrote:And one last thing:
How should I save the files as?

Because the guide mentiones Filename.xml.append, while unpacked game files I found them simply saved as Filename.xml or some even simply as .txt
Is there a significant difference between .xml and .xml.append ?

saving as .xml will replace the ENTIRE file. this includes the vanilla files and any mods that came before mod. for a simple weapon mod, or even a ship pack, this will crash the game. only do this if you are intent on replacing everything in the file. otherwise use .xml.append, which just adds to the existing data of the file.

for example if you're just adding a weapon, you'd use blueprints.xml.append, but if you're making like an overhaul mod (Twinge's balance mod, sMPK, Arsenal+, etc.) it may be a good idea to use blueprints.xml, because you're changing everything anyway.

----
I hope I didn't miss anything. it's pretty late here and my mind is a bit foggy :lol: :oops: I believe this should work though!
TeamEXAngus
Posts: 38
Joined: Thu May 17, 2018 5:38 am
Location: TeamEX Headquarters
Contact:

Re: [Tutorial] New Guide on creating weapons

Postby TeamEXAngus » Mon May 28, 2018 5:50 am

Code: Select all

<weaponBlueprint name="ION_PULSE_GUN">
   <type>BURST</type>
   <flavorType id="weapon_SHOTGUN_flavorType"/>
   <drone_targetable>0</drone_targetable>
   <title>Ion Pulse</title>
   <tip>Pulse weapons fire a wave of energy at the target ship.</tip>
   <short>Ion Pulse</short>
   <desc>This pulse weapon fires an Ion pulse at the target ship.</desc>
   <tooltip>This pulse weapon fires an Ion pulse at the target ship.</tooltip>
   <radius>99</radius>
   <damage>0</damage>
   <sysDamage>0</sysDamage>
   <ion>1</ion>
   <shots>1</shots>
   <sp>0</sp>
   <spin>720</spin>
   <fireChance>0</fireChance>
   <breachChance>0</breachChance>
   <cooldown>20</cooldown>
   <power>3</power>
   <cost>70</cost>
   <bp>10</bp>
   <speed>100</speed>
   <rarity>0</rarity>
   <projectiles>
      <projectile count="2" fake="false">ion_laser</projectile>
      <projectile count="5" fake="false">ion_laser</projectile>
   </projectiles>
   <launchSounds>
      <sound>ionShoot1</sound>
      <sound>ionShoot2</sound>
      <sound>ionShoot3</sound>
   </launchSounds>
   <weaponArt>ion_chaingun</weaponArt>
   <iconImage>ion</iconImage>
</weaponBlueprint>

Any idea why this crashes when I fire it?
User avatar
Kacpo
Posts: 9
Joined: Tue May 22, 2018 10:13 pm
Location: Danzig

Re: [Tutorial] New Guide on creating weapons

Postby Kacpo » Mon May 28, 2018 6:46 pm

Ok, I've tested my weapon and the files validate, no problem for slipstream.

I've used superluminal and added it to the ship that I've created (Ship works fine. I've finished a game in it.) as a starter weapon.

Playtested it. Charge up animation work fine, but When I try to fire it, the game crashes.
I can select a weapon, but when I click to designate the target, game freezes and closes.

Similar situation to what TeamEXAngus appears to be having.
Does anyone have any idea what may be the case here?

Here are the data files:
Blueprint

Code: Select all

<weaponBlueprint name="RAIL_CANNON">  <!-- #essential -->
   <type>LASER</type>        <!-- #essential -->
   <title>Magnetic Mass Driver</title>          <!-- #essential -->
   <short>Railgun</short>                          <!-- #essential -->
   <desc>A magnetic weapon that launches shield piercing projectile that breaches hull</desc>                         <!-- #essential -->
   <tooltip>Ignores shields and guarantees a hull breach</tooltip>          <!-- #essential -->
   <damage>2</damage>
   <sp>5</sp>                           
   <fireChance>0</fireChance>
   <breachChance>10</breachChance>
   <cooldown>20</cooldown>                        <!-- #essential -->
   <power>3</power>                                    <!-- #essential -->
   <cost>100</cost>                                        <!-- #essential -->
   <length>1</length>
   <hullBust>0</hullBust>
   <rarity>0</rarity>                                         <!-- #essential -->
   <image>rod</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>railgun</weaponArt>      <!-- #essential -->
</weaponBlueprint>


Animations

Code: Select all

<animSheet name="rod" w="50" h="11" fw="50" fh="11">weapons/rod.png</animSheet>

<anim name="rod">
   <sheet>rod</sheet>
   <desc length="1" x="0" y="0"/>
   <time>1.0</time>
</anim>



<animSheet name="railgun" w="242" h="71" fw="22" fh="71">weapons/railgun.png</animSheet>

<weaponAnim name="railgun">
   <sheet>railgun</sheet>
   <desc length="11" x="0" y="0"/>
   <chargedFrame>6</chargedFrame>
   <fireFrame>10</fireFrame>
   <firePoint  x="15" y="22"/>
   <mountPoint x="2" y="65"/>
</weaponAnim>



EDIT #1: I've removed a <length> tagline from the blueprint and replaced it with <speed>10</speed>
game still crushes.
User avatar
mr_easy_money
Posts: 621
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Tutorial] New Guide on creating weapons

Postby mr_easy_money » Mon May 28, 2018 7:22 pm

TeamEXAngus wrote:Any idea why this crashes when I fire it?

Here is your problem:
TeamEXAngus wrote:

Code: Select all

<weaponBlueprint name="ION_PULSE_GUN">
   ...
   <projectiles>
      <projectile count="2" fake="false">ion_laser</projectile>
      <projectile count="5" fake="false">ion_laser</projectile>
   </projectiles>
   ...
</weaponBlueprint>

you need to create an anim for "ion_laser". look in the vanilla files to see how MISSILE_CHARGEGUN or the SHOTGUN weapons do it. dlcBlueprints.xml for those blueprints, dlcAnimations.xml for their animations...

also... your <tip> statement is incorrect. the <tip> points to the name of a <text> in text_misc.xml. for example, <tip>tip_beams</tip> is found in most beam weapons. this points to <text name="tip_beams">....</text> with the info there in text_misc.xml. you'll need to create a text_misc.xml.append file with

Code: Select all

<text name="tip_ion_pulse_gun">Pulse weapons fire a wave of energy at the target ship.</text>

then instead of the current <tip> you have, put in

Code: Select all

<tip>tip_ion_pulse_gun</tip>

also, you should add hitShipSounds, hitShieldSounds and missSounds, like I said before.
----
----
Kacpo wrote:Charge up animation work fine, but When I try to fire it, the game crashes.
I can select a weapon, but when I click to designate the target, game freezes and closes.

Similar situation to what TeamEXAngus appears to be having.
Does anyone have any idea what may be the case here?

as with TeamEXAngus before, your weapon has this problem:
mr_easy_money wrote:
TeamEXAngus wrote:Now the game crashes when I fire it. Any ideas why?

oh in my haste, I didn't see something essential -- the weapon is missing a <shots> stat. I've had this 'weapon crashes when trying to fire' problem before and this was exactly the problem. no <shots> specified and the game doesn't know what you mean by firing the weapon -- what is there to fire?

every weapon except BEAM needs a <shots> stat, even BURST.

Kacpo wrote:EDIT #1: I've removed a <length> tagline from the blueprint and replaced it with <speed>10</speed>
game still crushes.

but yeah you're right with this, <length> should not be there, since this is not <type> BEAM.
User avatar
Kacpo
Posts: 9
Joined: Tue May 22, 2018 10:13 pm
Location: Danzig

Re: [Tutorial] New Guide on creating weapons

Postby Kacpo » Mon May 28, 2018 10:05 pm

IT WORKS!
Immense thanks easy_money.
TeamEXAngus
Posts: 38
Joined: Thu May 17, 2018 5:38 am
Location: TeamEX Headquarters
Contact:

Re: [Tutorial] New Guide on creating weapons

Postby TeamEXAngus » Tue May 29, 2018 3:22 am

you need to create an anim for "ion_laser". look in the vanilla files to see how MISSILE_CHARGEGUN or the SHOTGUN weapons do it. dlcBlueprints.xml for those blueprints, dlcAnimations.xml for their animations...

I want the projectiles to be invisible. A non-existent image/animation works for other weapons. (I changed it to ion_laser because that exists in the FTL Dats. It has nothing to do with the image file as far as i know, but i'll try setting it to a working animation.

Who is online

Users browsing this forum: No registered users and 30 guests