Jump to content

Transform all of 1 kind of block at once


Tirello

Recommended Posts

I have not tried this, but maybe it's possible. Try hiding all blocks that are not one shape of armor,  then select them all (by using a selection tool) and try to transform them into anything by using the 'transform' tool or the 'upgrade ship' tool. Those might not be the correct names for the tools but I hope I got the idea across.

Link to comment
Share on other sites

I have not tried this, but maybe it's possible. Try hiding all blocks that are not one shape of armor,  then select them all (by using a selection tool) and try to transform them into anything by using the 'transform' tool or the 'upgrade ship' tool. Those might not be the correct names for the tools but I hope I got the idea across.

 

Afaik, it does not work that way, at least not the last time I tried. But it would be a nice idea to implement it just as you said, it would be userfriendly and probably easy to implement.

 

However, there is currently a possible solution which is quite convenient imho (I mean, as far as it can get in this case ;)), but still only worth it, if you believe manual editing takes you more time than reading and applying my following textblob :D

 

[*]You need a text editor which supports posix regular expressions for find&replace operations.

I usually use Sublime Text for such things, but any supporting should do.

 

 

[*]Navigate to %APPDATA%/Roaming/Avorion/ships (or Linux ~/.avorion/ships) and open the xml ship design you wish to edit in your editor of choice - even better, make a backup copy of it beforehands, in case something goes wrong or save under a different filename.

 

 

[*]As you see in the file, the format is neat and structured, every item containing a block is one element you possibly want to replace if it meets your specfic conditions. In your example those are all blocks which are made of iron (material="0") and of type armor (index="1|8|104|105|106") and they all should change material to 1 for titanium. The simple apprach would be now to press Strg+H and replace 5 times 'material="0" index="type"' with 'material="1" index="type"', once for each block, but this would neglect the color, meaning, your ship would be made out of the new materials but still look like before which might not always be desired. Also, nobody likes repeating dull tasks  ;)

 

That is where regular expressions are saving the day:

Start Find&Replace (Ctrl+H), ensure Regex-Support is enabled (in Sublime a small button left to the find operation field) and copy&paste the following 2 lines:

Find:

index="(1|8|104|105|106)" material="0"\s+look="(\d)"\s+up="(\d)"\s+color="[0-9a-fA-F]+"

Replace:

index="\1" material="1" look="\2" up="\3" color="bfbfbfbf"

 

That's it.

 

Don't be confused if the design to apply does not directly show the new color in the preview, because the preview was seperatly saved as a png file and only updates when saving the ship, not by just changing the xml file like you just did.

 

These were the instructions to replace all iron armor on a ship template with titanium armor, but more generally speaking:

- material ranges from 0 to 6 from iron to avorion

- index as the block type is easilly to obtain if you make a new 'dummy ship' out of the blocks which interest you, save it and look into the xml file

- color="[0-9a-fA-F]+" means any color - you can also replace blocks only from a specific color; here the current basic material ones for reference:

  • iron ffbfaea3
  • titanium bfbfbfbf
  • naonite ffa3bfa3
  • trinium ffa3afbf
  • xanion ffbfbfa3
  • ogonite ffbfada3
  • avorion ffbc9f9f

This is of course extensible, but I will not go into regexes any further unless necassary, as this is not really the scope of my post anymore (and waaay too much for me).

Hope this may save a few player's time editing rather complex ship designs, for simpler cases or if you are totally not into editing loose files, this was probably overkill...  ;D

Link to comment
Share on other sites

I would copy the entire ship to your 'saved blocks' section and after that place it on your new ship. You only have to check the material button in the top right corner of the materials-screen. Choose the material that you like and fin!

An easier way to do something like that would be to use the 'modify entire ship' tool in the lower left corner. What either of our methods lack, though, is the ability to adjust certain things and not everything.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...