How to Force Reskins on New Crewmen

Discuss and distribute tools and methods for modding. Moderator - Grognak
User avatar
CaptainC
Posts: 7
Joined: Mon Aug 19, 2019 2:16 pm

How to Force Reskins on New Crewmen

Postby CaptainC » Sat Sep 21, 2019 1:09 am

I just tested the possibility of forcibly changing the sprites of crewmen mid-game.

I don't know if this is just an obvious idea and everyone knows about it already, but it is possible to change the sprites of newly-generated crewmen without changing those of your own crew. Previously, all that you could really do was create new layers under img/people and modify the blueprints.xml file to re-skin crew. In this thread, I will only refer to mantises, because that was the race I re-skinned.

Most methods could do one of three things:
1) change every mantis in the entire game into your re-skinned ones by changing mantis_base or adding another mantis_layerX and setting "a=1" in blueprints.xml. This works quite well for replacing mantises with something new, but then you can't find the original mantises in-game.
2) randomly either change the mantis to the re-skin or leave it the same. This is done by naming the re-skinned image mantis_layerX and creating a layer for it in blueprints.xml with two <colors> for a="0" and a="1". This would allow both the original mantises and the re-skinned mantises to appear randomly, but you couldn't force an enemy ship to exclusively use original mantises or exclusively re-skinned mantises.
3) define layers for the ghost race, effectively replacing them. This would work quite well, but you could only do it once and the resulting race would be weak

I wanted to try to create a new alien race which could use mantis stats but did not replace them. My solution is far from perfect, but I hope it is a step in the right direction. Below are the steps I took to do so. It probably isn't perfect, but it seemed to work when I tested it.

Create Sprites
1) First, I started by copying mantis_base and replacing all of the mantis sprites with my own. I named my new custom sprite-sheet mantis_layer2
2) After that, I renamed the existing mantis_base image as mantis_layer1 so that it would stay in the game
3) I edited mantis_color to be blank, because color outlines would interfere with the appearance of our custom sprites.
4) The last sprite-sheet I included in the mod is mantis_base. I suggest either making it blank or replace the sprites with dots, or else mantis_base will interfere with our custom sprites.

Create blueprints.xml.append
I created two separate blueprints.xml files:

Code: Select all

<crewBlueprint name="mantis">
   <desc id="crew_mantis_desc"/>
   <title id="crew_mantis_title"/>
   <short id="crew_mantis_short"/>
   <cost>55</cost> <!--was 45-->
   <bp>3</bp>
   <rarity>2</rarity>
   <powerList>
      <power id="crew_mantis_power_1"/>
      <power id="crew_mantis_power_2"/>
      <power id="crew_mantis_power_3"/>
   </powerList>
   <colorList>
      <layer><!-- Layer 1 - Mantis-->
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
      </layer>
      <layer><!-- Layer 2 - Re-Sprite-->
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
      </layer>
   </colorList>
</crewBlueprint>


This is the initial xml used to state a difference between mantises and re-sprites. By doing this, we limit the number of random options the game can choose for the crewmen's appearance. I then created another blueprints.xml file:

Code: Select all

<crewBlueprint name="mantis">
   <desc id="crew_mantis_desc"/>
   <title id="crew_mantis_title"/>
   <short id="crew_mantis_short"/>
   <cost>55</cost> <!--was 45-->
   <bp>3</bp>
   <rarity>2</rarity>
   <powerList>
      <power id="crew_mantis_power_1"/>
      <power id="crew_mantis_power_2"/>
      <power id="crew_mantis_power_3"/>
   </powerList>
   <colorList>
      <layer><!-- Layer 1 - Mantis-->
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
      </layer>
      <layer><!-- Layer 2 - Fly-->
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="0"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
         <color r="255" g="255" b="255" a="1"/>
      </layer>
   </colorList>
</crewBlueprint>


The color slots from the previous block of code are still present, so a change from the previous xml to the new xml will not change any pre-existing mantises. I added the many <color>'s to increase the probability that the game will choose the new dominant color a="1" or a="0" more often than the original. The more lines of <color> included, the better.

Creating the Mods
To test if this would work, I created two nearly identical mods. Both had the same img/people folder and images. Mod1 used that first block of code in blueprints.xml.append, and Mod2 used that second block of code in blueprints.xml.append.

The two boxes of code should not be switched if you want to see re-sprited crew before regular mantises. Instead, every above a="1" should be replaced with "a=0" and vice versa.


How to Use
To apply the mods, run slipstream and include Mod1 in the patch BUT NOT MOD2. Once the game has started, all mantises will look like regular mantises. At any point in the game, whenever you wish, save and exit the game. Open slipstream to patch FTL again, this time including Mod2 BUT NOT MOD1. When the game loads HIT CONTINUE. All pre-existing mantises should look the same. As the game progresses, however, almost every other mantis you encouter will use the custom sprite.

I tested the above code by starting as the Mantis A. When Mod1 was active, my mantis crew were mantises. When I reload the game and continue with Mod2, they were still mantises. After a few jumps, however, I encountered an enemy mantis with my custom sprites. I played a quick test game on Easy, and every new enemy mantis I encountered was re-skinned, while my crew fighting them was not. I think it worked pretty well :D

Here is an example of some mantis crewmen:
Image
In this screenshot, there are three crewmen: One enemy re-skinned mantis, one friendly re-skinned mantis, and one friendly regular mantis. I started the game with the Mantis A and regular Mantis crew under Mod1, and after switching to Mod2 I found a new friendly mantis crewman in an event and used them in my boarding party.

I hope this may be a first step in creating new alien races. I was thinking of creating a mod with a new sector to test this, and I would only have to spend a short time closing and opening the game up again. I haven't considered what I would do to have a mixed mantis-re-sprite crew fight against mantis again. Most likely, I would create a new similar mod titled Mod3 that would add more lines of <color> to allow mantises to return again. I wish I didn't have to restart though. :? I don't have any experience with hard-coded modding, so I can't write anything that would allow me to make these changes mid-game. That would be the end-goal, perhaps.
I am so thankful for the existence of hyperspace :)
If anyone wants crew sprites for a mod, let me know! I'll be happy to look into it for you, if I can.
User avatar
jacobsmash1
Posts: 6
Joined: Sun Sep 08, 2019 3:17 pm

Re: How to Force Reskins on New Crewmen

Postby jacobsmash1 » Sat Sep 28, 2019 6:45 pm

Someone already made something that allows you to make custom crew, it's called FTL: Hyperspace. Not sure if they can change in the middle of the game though.
Image
User avatar
CaptainC
Posts: 7
Joined: Mon Aug 19, 2019 2:16 pm

Re: How to Force Reskins on New Crewmen

Postby CaptainC » Fri Oct 04, 2019 7:48 pm

jacobsmash1 wrote:Someone already made something that allows you to make custom crew, it's called FTL: Hyperspace. Not sure if they can change in the middle of the game though.


I hadn't heard that they had finally made this possible until you just told me. Thank you for the reply! I will definitely by using this in the future. I read about something similar a while back, but it was never completed. This will be a lot of fun to test out :)
I am so thankful for the existence of hyperspace :)
If anyone wants crew sprites for a mod, let me know! I'll be happy to look into it for you, if I can.