Log in

View Full Version : A question to the fans



-Praetor-
02-13-2010, 16:00
Hi!

Currently, we have some units that are going to undergo a reform process. That reform process is going to be implemented via the blacksmith armour and weapon upgrades.

The question is, does anyone know how to implement such reforms, which files does one have to alter and such? I have been looking for a guide on TWC but haven't found anything useful.

Could anyone post a small guide how to do it?

Megas Methuselah
02-13-2010, 18:02
Really? Huh. I thought all the blacksmith upgrades do is give the units a new skin.

-Praetor-
02-13-2010, 18:10
That's a kind of reform. The access to better equipment or the evolution of it.

How do you implement that?

bobbin
02-13-2010, 18:24
I'm not too knowlegable about scripting but if you don't have it already you should get GrnEyedDvl's Ultimate Docudeamons (http://www.twcenter.net/forums/showthread.php?t=118578), it contains loads of information on scripting (triggers, commands etc).

Edit: On a bit of further reading what you could do is have barracks use the faction_capability command and tie this to a event counter. The faction capability command applies a bonus factionwide and so would be useful if you are wanting to make a reform.

for example

You would have an event (lets call it Reform_A) that is triggered by certain conditions. The barracks can then be set to provide the upgrade when that event happens.


barracks requires factions { romans, }
{
capability
{
recruit_pool "Principes" 1 0.7 6 0 requires factions { romans, }
}
faction_capability
{
armour 1 requires factions { romans,} and event_counter Reform_A 1
armour 2 requires factions { romans,} and event_counter Reform_B 1
}
material stone
construction 1
cost 3000
settlement_min huge_city
upgrades

I haven't tested this but it seems logical given the available commands and triggers etc. Also I'm not sure if you would even need a seperate reform counter for each upgrade as it could just go
armour 2 requires factions { romans,} and event_counter Reform_A 2
not entirely confident on that though.

The these are threads I got my info from if it helps.
http://www.twcenter.net/forums/showthread.php?t=101295&highlight=faction_capability
http://www.twcenter.net/forums/showthread.php?t=128342&highlight=faction_capability

Bucefalo
02-13-2010, 18:48
I don´t know if i understand you very well. I guess you already know about the ug models, which are models that are used to represent a graphical change when you upgrade armour, you can easily see it in vanilla. Anyway just in case i will make a short summary.

The entry to modify is in the EDU at the end of the unit, a good example is the pike militia unit.



type Pike Militia
dictionary Pike_Militia ; Pike Militia
category infantry
class spearmen
voice_type Light
banner faction main_spear
banner holy crusade
soldier Pike_Militia, 48, 0, 4
attributes sea_faring, hide_forest, can_withdraw, free_upkeep_unit, pike
formation 1.2, 1.2, 2.4, 2.4, 4, square, phalanx
stat_health 1, 0
stat_pri 6, 4, no, 0, 0, melee, melee_blade, piercing, spear, 25, 1
;stat_pri_ex 0, 0, 0
stat_pri_attr spear, long_pike, spear_bonus_8
stat_sec 3, 1, no, 0, 0, melee, melee_blade, piercing, sword, 25, 1
;stat_sec_ex 0, 0, 0
stat_sec_attr no
stat_pri_armour 0, 4, 0, flesh
;stat_armour_ex 0, 2, 3, 5, 4, 0, 0, flesh
stat_sec_armour 0, 0, flesh
stat_heat 4
stat_ground 1, -2, 0, 4
stat_mental 3, normal, highly_trained
stat_charge_dist 40
stat_fire_delay 0
stat_food 60, 300
stat_cost 1, 200, 100, 45, 105, 200, 4, 60
armour_ug_levels 0, 1, 2, 3
armour_ug_models Pike_Militia, Pike_Militia_ug1, Pike_Militia_ug2, Pike_Militia_ug3
ownership france, hre, spain, portugal, milan, venice, papal_states, sicily
era 1 spain
era 2 spain
;unit_info 6, 0, 4
recruit_priority_offset 5


This unit uses several models, depending whenever their armour is upgraded, and how much:
-No upgrade (no icon): use Pike_Militia model to represent the soldier
-First upgrade (copper shield icon): use Pike_Militia_ug1 model to represent the soldier
-Second upgrade (silver shield icon): use Pike_Militia_ug2 model to represent the soldier
-Third upgrade (golden shield icon): use Pike_Militia_ug3 model to represent the soldier

About scripting unfortunately i don´t know enough to help you. You could ask the Dominion of the sword mod as i think they plan to use something similar, iirc it was that in a certain year it becomes active. I don´t know if it means that all units automatically gets the improved armour (that would be a script command) or that the building that does the upgrade (in vanilla the smithy) becomes available, and the player can build it and upgrade his troops. Those are two different things and would probably require different solutions. I hope i may have been of some help. Cheers

seienchin
02-13-2010, 19:41
I guess the easiest way would be to make the higher blacksmith levels only available after a reform. Like the canonbuilder structure only gets available in Vanilla afte the invention of gun powder. That would be really easy to do.
If you want the units to be altered in a way that they can only upgrade (Even if the structure is already there) after a reform I guess its imposible.

-Praetor-
02-13-2010, 23:39
Thanks for the answers. My question is really centered on how to make a single unit to use 3 different model and skins via the blacksmith upgrades.

bobbin
02-14-2010, 19:53
As I'm not entirely sure what your asking for I'm just going to go over eveything as well as i can.

First the export_descr_unit.txt file
In M2TW the unit entries look like this

type Byzantine Lancers
dictionary Byzantine_Lancers ; Byzantine Lancers
category cavalry
class heavy
voice_type Heavy
banner faction main_cavalry
banner holy crusade_cavalry
soldier Byzantine_Lancers, 32, 0, 1
mount heavy horse
mount_effect elephant -4, camel -4
attributes sea_faring, hide_forest, hardy, can_withdraw, can_formed_charge
formation 2, 4.4, 3, 6, 3, square, wedge
stat_health 1, 0
stat_pri 8, 5, no, 0, 0, melee, melee_blade, piercing, spear, 25, 1
;stat_pri_ex 0, 0, 0
stat_pri_attr no
stat_sec 9, 3, no, 0, 0, melee, melee_blade, piercing, sword, 25, 1
;stat_sec_ex 0, 0, 0
stat_sec_attr no
stat_pri_armour 5, 4, 4, metal
;stat_armour_ex 5, 7, 8, 9, 4, 4, 4, metal
stat_sec_armour 0, 0, flesh
stat_heat 2
stat_ground 0, 0, -4, 0
stat_mental 5, disciplined, highly_trained
stat_charge_dist 45
stat_fire_delay 0
stat_food 60, 300
stat_cost 1, 500, 210, 100, 75, 500, 4, 120
armour_ug_levels 2, 3, 4, 5
armour_ug_models Byzantine_Lancers, Byzantine_Lancers_ug1, Byzantine_Lancers_ug2, Byzantine_Lancers_ug3
ownership byzantium, slave
era 0 byzantium
era 1 byzantium
era 2 byzantium
;unit_info 8, 0, 13
The underlined part is the section that relates to armour upgrades.


armour_ug_levels 2, 3, 4, 5
This shows the blacksmith levels required for each upgrade to occur. Note that the first level is for the non-upgraded unit and that the first armour upgrade becomes available when a level 3 blacksmith is built.


armour_ug_models Byzantine_Lancers, Byzantine_Lancers_ug1, Byzantine_Lancers_ug2, Byzantine_Lancers_ug3
This shows the models used for each upgrade level, note that the first model listed is the non-upgraded unit.

The models are listed in the battle_models.modeldb file which you can find in the unit_models folder, it is essentailly like the descr_model_battle.txt file in RTW but it is more annoying to edit. This excellent tutorial gives a good description of the file and how to edit it: Tutorial - Adding a unit to the game (https://forums.totalwar.org/vb/showthread.php?75706-Tutorial-Adding-a-unit-to-the-game)


17 byzantine_lancers
1 4
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod0.mesh 121
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod1.mesh 900
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod2.mesh 2500
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod3.mesh 6400
2
9 byzantium
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
51 unit_sprites/byzantium_Byzantine_Lancers_sprite.spr
5 slave
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
47 unit_sprites/slave_Byzantine_Lancers_sprite.spr
2
9 byzantium
60 unit_models/AttachmentSets/Final Kite_byzantium_diff.texture
60 unit_models/AttachmentSets/Final Kite_byzantium_norm.texture 0
5 slave
56 unit_models/AttachmentSets/Final Kite_slave_diff.texture
56 unit_models/AttachmentSets/Final Kite_slave_norm.texture 0
1
5 Horse
13 MTW2_HR_Lance
13 MTW2_HR_Sword 2
21 MTW2_HR_Lance_Primary
14 fs_test_shield 2
18 MTW2_Sword_Primary
14 fs_test_shield
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
21 byzantine_lancers_ug1
1 3
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug1_lod0.mesh 121
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug1_lod1.mesh 1225
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug1_lod2.mesh 6400
2
9 byzantium
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
55 unit_sprites/byzantium_Byzantine_Lancers_ug1_sprite.spr
5 slave
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
51 unit_sprites/slave_Byzantine_Lancers_ug1_sprite.spr
2
9 byzantium
60 unit_models/AttachmentSets/Final Kite_byzantium_diff.texture
60 unit_models/AttachmentSets/Final Kite_byzantium_norm.texture 0
5 slave
56 unit_models/AttachmentSets/Final Kite_slave_diff.texture
56 unit_models/AttachmentSets/Final Kite_slave_norm.texture 0
1
5 Horse
13 MTW2_HR_Lance
13 MTW2_HR_Sword 2
21 MTW2_HR_Lance_Primary
14 fs_test_shield 2
18 MTW2_Sword_Primary
14 fs_test_shield
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
21 byzantine_lancers_ug2
1 3
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug2_lod0.mesh 121
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug2_lod1.mesh 1225
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug2_lod2.mesh 6400
2
9 byzantium
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
55 unit_sprites/byzantium_Byzantine_Lancers_ug2_sprite.spr
5 slave
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
51 unit_sprites/slave_Byzantine_Lancers_ug2_sprite.spr
2
9 byzantium
60 unit_models/AttachmentSets/Final Kite_byzantium_diff.texture
60 unit_models/AttachmentSets/Final Kite_byzantium_norm.texture 0
5 slave
56 unit_models/AttachmentSets/Final Kite_slave_diff.texture
56 unit_models/AttachmentSets/Final Kite_slave_norm.texture 0
1
5 Horse
13 MTW2_HR_Lance
13 MTW2_HR_Sword 2
21 MTW2_HR_Lance_Primary
14 fs_test_shield 2
18 MTW2_Sword_Primary
14 fs_test_shield
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
21 byzantine_lancers_ug3
1 3
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug3_lod0.mesh 121
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug3_lod1.mesh 1225
71 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_ug3_lod2.mesh 6400
2
9 byzantium
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
55 unit_sprites/byzantium_Byzantine_Lancers_ug3_sprite.spr
5 slave
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
51 unit_sprites/slave_Byzantine_Lancers_ug3_sprite.spr
2
9 byzantium
60 unit_models/AttachmentSets/Final Kite_byzantium_diff.texture
60 unit_models/AttachmentSets/Final Kite_byzantium_norm.texture 0
5 slave
56 unit_models/AttachmentSets/Final Kite_slave_diff.texture
56 unit_models/AttachmentSets/Final Kite_slave_norm.texture 0
1
5 Horse
13 MTW2_HR_Lance
13 MTW2_HR_Sword 2
21 MTW2_HR_Lance_Primary
14 fs_test_shield 2
18 MTW2_Sword_Primary
14 fs_test_shield
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
Basically each model entry breaks down into a few parts.


1 4
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod0.mesh 121
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod1.mesh 900
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod2.mesh 2500
67 unit_models/_Units/ES_Greek_Greek_Heavy/byzantine_lancers_lod3.mesh 6400
This defines what mesh file is used at various distances.


2
9 byzantium
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
51 unit_sprites/byzantium_Byzantine_Lancers_sprite.spr
5 slave
80 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_byzantium.texture
77 unit_models/_Units/ES_Greek_Greek_Heavy/textures/mtw2_es_greek_normal.texture
47 unit_sprites/slave_Byzantine_Lancers_sprite.spr
This defines which textures and sprites used by which factions.


2
9 byzantium
60 unit_models/AttachmentSets/Final Kite_byzantium_diff.texture
60 unit_models/AttachmentSets/Final Kite_byzantium_norm.texture 0
5 slave
56 unit_models/AttachmentSets/Final Kite_slave_diff.texture
56 unit_models/AttachmentSets/Final Kite_slave_norm.texture 0
1
5 Horse
13 MTW2_HR_Lance
13 MTW2_HR_Sword 2
21 MTW2_HR_Lance_Primary
14 fs_test_shield 2
18 MTW2_Sword_Primary
14 fs_test_shield
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
Defines things such as the textures used for the various attachments for a unit (weapons etc).

All this is then repeated for each armour upgrade level model.

To enable a building to give an armour upgrade use the building trait "armour", for example giving a building the trait "armour 5" will allow it to upgrade the unit I used in my earlier example to the top armour level.
You can then use a method like the one I outlined in my earlier post to link this to a reform event.

Earlier post with some minor edits.
I'm not too knowlegable about scripting but if you don't have it already you should get GrnEyedDvl's Ultimate Docudeamons (http://www.twcenter.net/forums/showthread.php?t=118578), it contains loads of information on scripting (triggers, commands etc).

Edit: On a bit of further reading what you could do is have barracks use the faction_capability command and tie this to a event counter. The faction capability command applies a bonus factionwide and so would be useful if you are wanting to make a reform.

for example

You would have an event (lets call it Reform_A) that is triggered by certain conditions. The barracks can then be set to provide the upgrade when that event happens.


barracks requires factions { romans, }
{
capability
{
recruit_pool "Principes" 1 0.7 6 0 requires factions { romans, }
}
faction_capability
{
armour 1 requires factions { romans,} and event_counter Reform_A 1 and not event_counter Reform_B 1
armour 2 requires factions { romans,} and event_counter Reform_B 1
}
material stone
construction 1
cost 3000
settlement_min huge_city
upgrades

I haven't tested this but it seems logical given the available commands and triggers etc.

The these are threads I got my info from if it helps.
http://www.twcenter.net/forums/showthread.php?t=101295&highlight=faction_capability
http://www.twcenter.net/forums/showthread.php?t=128342&highlight=faction_capability

-Praetor-
02-15-2010, 01:30
Thank you Bobbin and Bucefalo. I'm going to try it to see if it works.

Darius
02-17-2010, 00:06
If I'm understanding Praetor correctly, this will possibly mean being able to preserve your experienced soldiers when they become "outdated" by "re-training and re-equipping" them in the new way. For example, I'm guessing this would likely mean being able to take your Camillan Era Principes and turn them into Polybian Era Principes. Of course that's only if they manage to get this to work with the blacksmith building. If they have to use the barracks, it'll be the same as before. Also, should the blacksmith method work, that will result in freeing up a rather large number of unit slots, and not just for the Romans. Any faction that had it's units undergo a reform could technically have this done, which would mean a rather massive number of unit slots would be free to be used to include units that might otherwise have been left on the cutting room floor.

Foot
02-17-2010, 00:29
If I'm understanding Praetor correctly, this will possibly mean being able to preserve your experienced soldiers when they become "outdated" by "re-training and re-equipping" them in the new way. For example, I'm guessing this would likely mean being able to take your Camillan Era Principes and turn them into Polybian Era Principes. Of course that's only if they manage to get this to work with the blacksmith building. If they have to use the barracks, it'll be the same as before. Also, should the blacksmith method work, that will result in freeing up a rather large number of unit slots, and not just for the Romans. Any faction that had it's units undergo a reform could technically have this done, which would mean a rather massive number of unit slots would be free to be used to include units that might otherwise have been left on the cutting room floor.

Unfortunately its a lot more limited than that, and will most likely not be used for units associated with reforms in the past. Instead it will be used to bring a greater historical accuracy to units throughout the time period, as armour styles changed.

Foot

antisocialmunky
02-17-2010, 03:32
Why did the opinion change from "the +2/5/x/y/z bonii from the various levels or armor make it too hard to balance the game?"

-Praetor-
02-17-2010, 19:08
The coincidence between some units' historic evolution in terms of armour and the hardcoded bonus of the blacksmith upgrades.

That means that the blacksmith upgrades won't be an extended feature of our mod, but will be used whenever historical accuracy and our own manpower resources permits.

antisocialmunky
02-18-2010, 23:14
Cool, good to see this cool function get some use :)