[SOLVED] Weapons help

Discuss and distribute tools and methods for modding. Moderator - Grognak
Zaffre
Posts: 144
Joined: Tue Sep 18, 2012 5:09 pm

[SOLVED] Weapons help

Postby Zaffre » Fri May 24, 2013 4:56 am

I've been coding quite a few custom weapons but I've never quite figured out how to do custom art. I've tried for days now and need some help.

The issue I'm having is that my custom weapon art is not showing up at all. It just shows up as a basic laser. The Wildfire Blast is what I'm having trouble with.

The code is below. Note that some parts are excluded, for ease of showing the parts help is needed with.

blueprints.xml.append

Code: Select all

<weaponBlueprint name="WILDFIRE_BLAST">
   <type>LASER</type>
   <title>Wildfire Blast</title>
   <short>W. Blast</short>
   <desc>The ultimate fire weapon. Use with extreme prejudice.</desc>
   <tooltip>The ultimate fire weapon. Don't miss.</tooltip>
   <damage>4</damage>
   <shots>1</shots>
   <sp>5</sp>
   <fireChance>100</fireChance>
   <breachChance>0</breachChance>
   <cooldown>20</cooldown>
   <power>4</power>
   <speed>40</speed>
   <cost>200</cost>
   <bp>4</bp>
   <rarity>0</rarity>
   <image>wildfire_blast_shot</image>
   <launchSounds>
      <sound>bombTeleport</sound>
   </launchSounds>
   <hitShipSounds>
      <sound>smallExplosion</sound>
   </hitShipSounds>
   <hitShieldSounds>
      <sound>hitShield1</sound>
      <sound>hitShield2</sound>
      <sound>hitShield3</sound>
   </hitShieldSounds>
   <missSounds>
      <sound>miss</sound>
   </missSounds>
   <weaponArt>wildfire</weaponArt>
</weaponBlueprint>


autoBlueprints.xml.append

Code: Select all

<blueprintList name="HOT_STUFF"> <!--For the Blazing Cruiser mod-->
   <name>BEAM_INFERNO</name>
   <name>DRONE_LASER_ROCK</name>
   <name>MISSILES_FIRE</name>
   <name>LASER_FIRE</name>
   <name>DEFENSE_ROCK</name>
   <name>WILDFIRE_BLAST</name>
</blueprintList>


animations.xml.append

Code: Select all

<animSheet name="wildfire_blast" w="216" h="52" fw="27" fh="52">weapons/wildfire_strip8.png</animSheet>


The names of the custom weapon art are wildfire_strip8, wildfire_glow, and wildfire_blast_shot8. Still a newbie at modding (that and I just came back from a year-long hiatus), so any help would be appreciated.
Last edited by Zaffre on Fri May 24, 2013 4:36 pm, edited 1 time in total.
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Weapons help

Postby Sleeper Service » Fri May 24, 2013 12:19 pm

The weapon sprite needs an <weaponAnim> as well. It has to be placed in the animations.xml.append and should look like this (just an example, different values for your weapon):

Code: Select all

<weaponAnim name="ba_laser_artillery_1">
   <sheet>ba_laser_artillery_1</sheet>
   <desc length="12" x="0" y="0"/>
   <chargedFrame>5</chargedFrame>
   <fireFrame>8</fireFrame>
   <firePoint  x="17" y="1"/>
   <mountPoint x="3" y="59"/>
   <chargeImage>weapons/ba_laser_artillery_1_glow.png</chargeImage>
</weaponAnim>


That defines which frames are used for the different animation of the weapon. Its ID (in this case ba_laser_auto_1) is what should be inserted into <weaponArt> in the weapons blueprints.

If you check out the animations.xml you will see that every weapon has a <weaponAnim>. You might be able to understand how it works exactly from having a close lock at them.
<sheet> uses the animsheet that you already have created. <desc length> defines how many frames your weapon sprite has. <fireFrame> defines in which frame it fires. <firePoint> defines where the projectile emerges (is set in the first frame of the sprite). <chargeImage> tells the game which charge glow it should use. You have to adjust this stuff according to your weapon.

Experience has shown it is best to make weapons that have similar animation lengths as vanilla weapon as weapon animations get buggy when the sprite has to many frames. But that should be all right with your weapon.

Your costume projectiles need animSheets and Anims as well. They also have to be placed in the correct directory to show up in the game.

Hope you can make it work. Post if you have further problems.
Zaffre
Posts: 144
Joined: Tue Sep 18, 2012 5:09 pm

Re: Weapons help

Postby Zaffre » Fri May 24, 2013 3:21 pm

Okay, well either my game hates me or I'm missing something blatantly obvious, because I cannot get this thing to work. Good news and bad news.

The good news is that the weapon's projectile has its art. The bad news is that the weapon itself doesn't. I changed anything named "wildfire" in the art files to "wildfire_blast", and added the stuff to animations.xml.append. This makes the files wildfire_blast_strip8, wildfire_shot_strip8, and wildfire_blast_glow. Here is my animations.xml,append:

Code: Select all

<animSheet name="wildfire_blast" w="216" h="54" fw="27" fh="54">weapons/wildfire_blast_strip8.png</animSheet>

<weaponAnim name="wildfire_blast">
   <sheet>wildfire_blast</sheet>
   <desc length="8" x="0" y="0"/>
   <chargedFrame>1</chargedFrame>
   <fireFrame>5</fireFrame>
   <firePoint  x="16" y="12"/>
   <mountPoint x="5" y="38"/>
   <chargeImage>weapons/wildfire_blast_glow.png</chargeImage>
</weaponAnim>

<animSheet name="wildfire_shot" w="256" h="32" fw="32" fh="32">weapons/wildfire_shot_strip8.png</animSheet>

<anim name="wildfire_shot">
   <sheet>wildfire_shot</sheet>
   <desc length="8" x="0" y="0"/>
   <time>0.3</time>
</anim>


It looks okay to me, but then again I'm only a novice coder.
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: Weapons help

Postby Sleeper Service » Fri May 24, 2013 3:55 pm

Did you change the <weaponArt> entry in the weapon blueprint to "wildfire_blast" (in blueprints.xml.append)? That might be the problem. The weapon blueprint needs the correct ID of the weaponAnim as reference. Also wildfire_strip8.png has to be in the img/weapons directory to show up in the game.

When graphics don't show up usually something with paths or files or anim IDs is wrong. In contrast to when weapon graphics are replaced by the basic laser graphic, then its its usually a bad/wrong weapon ID I think.

Don't know if that would be helpful but for the beginning it might be advisable to give your assets really clear IDs like "wildfire_blast_sheet", "wildfire_blast_anim" and "wildfire_blast_blueprint" to avoid confusion.
(Unwritten modding rules also suggest you write IDs like wildfire_blast in capital letters. ;) Thats if you like coherency)
Zaffre
Posts: 144
Joined: Tue Sep 18, 2012 5:09 pm

Re: Weapons help

Postby Zaffre » Fri May 24, 2013 4:36 pm

It worked! I had forgotten to add "_blast" onto the end of the <weaponArt> entry. Thanks so much! ^^
User avatar
Sleeper Service
Posts: 2305
Joined: Sun Mar 24, 2013 8:49 pm

Re: [SOLVED] Weapons help

Postby Sleeper Service » Fri May 24, 2013 5:49 pm

Cool, have fun with your creations! May it be the first of many. :D