Modding guide: making new units
Posted: Mon Jan 07, 2013 5:23 am
I figured out how to make new units, they don't show up in the production panel but you can deploy them through the scenario file.
This is a guide on how to add a new unit to the game, the Battlecruiser and we will see it deployed in the 1914 scenario.
You'll need to modify these files:
units.lua
1914.lua
english.txt
and add 9 unit icon graphics files and 4 unit graphic files to
Data/Graphics/units
list to follow, you can just copy exiting ones and change name if you want but I am including graphics for you.
To have sounds you need to copy and rename 7 *.wav files at
Data/Sound/
list to follow, I have them pre named for you, below.
1) units.lua
Open up units.lua and copy the text below and paste it after the last unit in the file, take care to make sure you keep the ending parenthesis and don't copy over it.
{
id = 22,
name = "battlecruiser",
type = "naval",
chassis = "water",
class = "naval",
icon = "battlecruiser",
levels =
{
{
hp = 100,
mp = 14,
ap = 1,
LOS = 3,
range = 1,
shock = 2,
attack = 12,
defense = 10,
airattack = 6,
airdefense = 18,
bombard = 4,
assault = 0,
ammunition = 2,
}
},
retreat = 0,
costPP = 70,
costMP = 8,
turns = 20,
upkeepPP = 2,
upkeepMP = 0,
weapon = "heavy",
factions = { 0, 1, 2, 3, 4, 8, 10 },
strengthValue = 25,
stats =
{
groundattack = 1,
airattack = 6,
navalattack = 7,
subattack = 1,
stratattack = 8,
basedefense = 10,
highdefense = 8,
bombard = 3,
shock = 2,
},
firstStrike = 1,
},
2) engilish.txt
Basic text is here, no crash if you leave out, to add text there are several places.
Add lines the line below, look for other unit names with the same layout and add at end of the list like it.
battlecruiser = BATTLECRUISER
battlecruiser_info = Battlecruisers were similar in size and cost to a battleship, and typically carried the same kind of heavy guns, but battlecruisers generally carried less armour and were faster.
advice_battlecruiser_title = Battlecruiser
advice_battlecruiser_text = Battlecruiser are very powerful units, but very expensive too. The Firepower of a Battle ship with the armor and speed of a cruiser, they can out gun anything they can catch and can out run anything they can't.
3) copying graphics files for new unit, copy all the files listed below to, these are the ones that show up on the map.
Data/Graphics/units/
the 4 unit graphics:
battlecruiser_default_1_100.png
battlecruiser_default_1_hud.png
battlecruiser_default_1_info.png
battlecruiser_default_1_queue.png Custom graphics for battlecruiser, photoshoped the battleship graphics.
the 9 unit icon graphics: (Update alert, its 10 unit icon files graphics the missing one is battlecruiser_100.png, you can copy battleship_100.png and rename it or I have updated the zip file to contain it now- 1/7/2013 3:30pm pst)
battlecruiser_0_25.png
battlecruiser_0_50.png
battlecruiser_0_100.png
battlecruiser_1_25.png
battlecruiser_1_50.png
battlecruiser_1_100.png
battlecruiser_2_25.png
battlecruiser_2_50.png
battlecruiser_2_100.png
Copies of exiting icon graphics for battleship re named.
4) Now the new unit is ready to be deployed:
1914.lua
Open up the 1914.lua and add this line to Austria, to see the battle cruiser next to your regular cruiser first thing when you start a new 1914 scenario game. You can also change out any ship for any country with battlecruiser to see it or set you own location.
{type = "battlecruiser", hex = {104, 42}, facing = "left"},
5) It will work with doing all the above but will be silent if you want sound to go along with it, you will need 7 *.wav files, I just copied the battleship sounds and renamed battleship with battlecruiser, there found at
Data/Sound/
rename to;
battlecruiser_attack_1.wav
battlecruiser_attack_2.wav
battlecruiser_attack_2a.wav
battlecruiser_attack_3.wav
battlecruiser_move_1.wav
battlecruiser_move_2.wav
battlecruiser_move_3.wav
This is what they should look like when done.
And that's it, good luck.
This is a guide on how to add a new unit to the game, the Battlecruiser and we will see it deployed in the 1914 scenario.
You'll need to modify these files:
units.lua
1914.lua
english.txt
and add 9 unit icon graphics files and 4 unit graphic files to
Data/Graphics/units
list to follow, you can just copy exiting ones and change name if you want but I am including graphics for you.
To have sounds you need to copy and rename 7 *.wav files at
Data/Sound/
list to follow, I have them pre named for you, below.
1) units.lua
Open up units.lua and copy the text below and paste it after the last unit in the file, take care to make sure you keep the ending parenthesis and don't copy over it.
{
id = 22,
name = "battlecruiser",
type = "naval",
chassis = "water",
class = "naval",
icon = "battlecruiser",
levels =
{
{
hp = 100,
mp = 14,
ap = 1,
LOS = 3,
range = 1,
shock = 2,
attack = 12,
defense = 10,
airattack = 6,
airdefense = 18,
bombard = 4,
assault = 0,
ammunition = 2,
}
},
retreat = 0,
costPP = 70,
costMP = 8,
turns = 20,
upkeepPP = 2,
upkeepMP = 0,
weapon = "heavy",
factions = { 0, 1, 2, 3, 4, 8, 10 },
strengthValue = 25,
stats =
{
groundattack = 1,
airattack = 6,
navalattack = 7,
subattack = 1,
stratattack = 8,
basedefense = 10,
highdefense = 8,
bombard = 3,
shock = 2,
},
firstStrike = 1,
},
2) engilish.txt
Basic text is here, no crash if you leave out, to add text there are several places.
Add lines the line below, look for other unit names with the same layout and add at end of the list like it.
battlecruiser = BATTLECRUISER
battlecruiser_info = Battlecruisers were similar in size and cost to a battleship, and typically carried the same kind of heavy guns, but battlecruisers generally carried less armour and were faster.
advice_battlecruiser_title = Battlecruiser
advice_battlecruiser_text = Battlecruiser are very powerful units, but very expensive too. The Firepower of a Battle ship with the armor and speed of a cruiser, they can out gun anything they can catch and can out run anything they can't.
3) copying graphics files for new unit, copy all the files listed below to, these are the ones that show up on the map.
Data/Graphics/units/
the 4 unit graphics:
battlecruiser_default_1_100.png
battlecruiser_default_1_hud.png
battlecruiser_default_1_info.png
battlecruiser_default_1_queue.png Custom graphics for battlecruiser, photoshoped the battleship graphics.
the 9 unit icon graphics: (Update alert, its 10 unit icon files graphics the missing one is battlecruiser_100.png, you can copy battleship_100.png and rename it or I have updated the zip file to contain it now- 1/7/2013 3:30pm pst)
battlecruiser_0_25.png
battlecruiser_0_50.png
battlecruiser_0_100.png
battlecruiser_1_25.png
battlecruiser_1_50.png
battlecruiser_1_100.png
battlecruiser_2_25.png
battlecruiser_2_50.png
battlecruiser_2_100.png
Copies of exiting icon graphics for battleship re named.
4) Now the new unit is ready to be deployed:
1914.lua
Open up the 1914.lua and add this line to Austria, to see the battle cruiser next to your regular cruiser first thing when you start a new 1914 scenario game. You can also change out any ship for any country with battlecruiser to see it or set you own location.
{type = "battlecruiser", hex = {104, 42}, facing = "left"},
5) It will work with doing all the above but will be silent if you want sound to go along with it, you will need 7 *.wav files, I just copied the battleship sounds and renamed battleship with battlecruiser, there found at
Data/Sound/
rename to;
battlecruiser_attack_1.wav
battlecruiser_attack_2.wav
battlecruiser_attack_2a.wav
battlecruiser_attack_3.wav
battlecruiser_move_1.wav
battlecruiser_move_2.wav
battlecruiser_move_3.wav
This is what they should look like when done.
And that's it, good luck.