How to add new units?
-
Now that I have got some practice, I think I can get into proper modding. But can someone give me instructions or a video/other forum post/ document that explains it?
The units I want to add are fairly simple, just Light Armour and Heavy Armour. I will be adding them to Europe 1940
Light Armour costs 5 IPCs, can move 3 spaces, attack of 3, defense of 2. It would be available at the start of the game. It is best for attacking but good enough for defense.
Heavy Armour costs 8 IPCs, can take two hits like a Battleship, and is otherwise the same as normal Armour. It becomes available at turn 4 in a non-tech game or from a technology advancement in tech games. Upgrades would bring up its attacking or defending strength to suit your strategy.
Also, how do I set starting positions for these new units? I want to make it so that Light Armour is used in areas that don’t warrant larger tanks, and I want to make it so that neutrals use them. I plan to buff neutrals a bit so you can’t just go around invading all of them to get free IPCs.
-
@JOSEPH-PRINCE said in How to add new units?:
Now that I have got some practice, I think I can get into proper modding. But can someone give me instructions or a video/other forum post/ document that explains it?
I don't think there is one single guide for every kind of possible "modding". Also, it depends if you want to modify maps or modify only games. In both cases, rather than modifying anything that is not your making in the first place, you should rather make a modified copy of it (which is a good process anyway, so you can go back to the previous state with ease). Just make sure to change the "info name" within the game's file (xml), immediately after having copied the map or the game or both.
Generally, for information on any development matters, look at the Wiki of the project:
https://github.com/triplea-game/triplea/wikiThe units I want to add are fairly simple, just Light Armour and Heavy Armour. I will be adding them to Europe 1940
https://github.com/triplea-game/triplea/wiki/Creating-Custom-Map-XML#sec_5.3.6
Light Armour costs 5 IPCs, can move 3 spaces, attack of 3, defense of 2. It would be available at the start of the game. It is best for attacking but good enough for defense.
If we are talking about the "World War II Europe 1940 2nd Edition" game, I think this unit will reduce almost to 0 the number of regular armours bought by anyone, even after you take the combined arms support into account. Also mech infantry will become a very rare purchase.
Heavy Armour costs 8 IPCs, can take two hits like a Battleship, and is otherwise the same as normal Armour. It becomes available at turn 4 in a non-tech game or from a technology advancement in tech games. Upgrades would bring up its attacking or defending strength to suit your strategy.
Again, once you can buy it, I think this unit will reduce almost to 0 the number of regular armours bought by anyone and virtually to 0 the number of mech infantries, even without taking the ability to repair into account. A premium price of 2 PUs in exchange for an additional repairable (I assume) hitpoint is much better than you might think. However, since this is a tech dependent unit, it makes sense to be otherwise overpowered. Beside tech considerations, I estimate the balanced cost of this unit ranging from 9 to 12 PUs (still very good at 9 PUs), if it can repair with ease and at no cost.
Also, how do I set starting positions for these new units? I want to make it so that Light Armour is used in areas that don’t warrant larger tanks, and I want to make it so that neutrals use them. I plan to buff neutrals a bit so you can’t just go around invading all of them to get free IPCs.
unitInitialize
in the game's file (xml). -
Thanks for your thoughts,
I'm thinking of either reducing Light Armour's attack to 2 or its movement to 2.
Heavy Armour price will be increased to 10 IPCS.
Thanks for the help!
-
I made changes to the unit initialization but they aren't showing up.
And I added all the code for Light Armour but the units aren't showing up in game, like they aren't invisible but just not there.
-
And this is an error I got:
-
@JOSEPH-PRINCE As per the link I posted, be sure to have "lightarmour" (or, rather, "lightArmour", if following usual TripleA conventions) in the
unitList
. -
It is in the unit list, that is what this one is,
-
@JOSEPH-PRINCE As far as I know, as long as you have it in the
unitList
, in aproductionRule
and have aunitAttachment
for it, you should not have any errors. So, I don't know what is your problem. -
@JOSEPH-PRINCE said in How to add new units?:
And this is an error I got:
And, again, your modification should not be called with the same name as the original, unless you want to update it. You should change the
info name
before changing anything else. -
Hmm...you should go through "armour" and see if its the same.
-
@joseph-prince - I'm late to the party... but for anyone searching, the problem was the capitalization (as one replier did mention, but it was never tested)
lightArmour vs lightarmour