Jump to content

Modding ai units


Abulafia

Recommended Posts

Hi all,

 

more questions I'm afraid. This time I'm trying to change enemies stats, skills and equipment.

 

As I currently understand how this works:

 

share/configs/units/unit_phase.txt lists which unit uses which skills and equipment file

 

share/configs/ai_units contains folders for each enemy type which in turn contain .txt files for their loadouts for each phase

 

The individual files list the loadout for a specific enemy - so share/configs/ai_units/borg/cultist-borg_assault.txt

lists the stats for an enemy cyborg, of the "assault" class for when the game is in the "cultist" phase (assuming unit_phase.txt hasn't been changed).

 

Each unit has scores for each training, each stat and each skill, where training levels are 0-3 and stat and skill levels are 0-11, with 0 being Awful and 11 being SuperHeroic +4

 

First of all, am I right on this lot, so far?

 

Secondly, there's some stuff I don't understand about the actual loadout files:

 

1. Dexterity and agility seem the wrong way round. From comparing save game files with actual ingame stats, the second CUnitAttribute RECORD entry appears to determine agility and the third dexterity.

 

2. Stats are listed in the format:

 

CUnitAttribute RECORD

level INT 2

distLevel INT 2

bonus INT 0

levelString STR "RwBvAG8AZAA="

 

Where level INT is the actual score for the stat, bonus is any stat bonuses (from cyborg limbs, say) but bonus is already added into level INT, and I have no idea what distLevel INT and levelString STR do. Is it safe to just set distLevel INT = level INT and leave levelString STR unchanged to make everything work ok? also if you have an enemy cyborg with implants, do you have to set bonus INT correctly for the implants you've given him?

 

3. Skills are listed in the format:

 

skills ARRAY 14

CUnitSkill RECORD

value FLT 3.5

level INT 4

bonus INT 0

levelString STR "VgBlAHIAeQAgAEcAbwBvAGQA"

 

Where value FLT is the calculated value of the skill from the stats, level INT is the actual rating of the skill (so value FLT rounded nearest) and bonus INT is any skill bonuses, again these are already added into the level INT value.

 

Do you have to correctly calculate value FLT for each skill to avoid an error? if not, because hp and skills have their own values, can you ignore enemy stats, and just give them whatever hp and skill scores you want, and leave their stat scores unchanged?

 

4. Each file contains a squad array of, usually 6 or 7, variations to the unit type. Does the variant type get picked at random, or are they cycled through in order? So if 4 borg_assault enemies spawn, will they automatically be types 1,2,3 and 4 or will they each be a random type from 1-6?

 

5. share/configs/units/squad.txt determines the maximum number enemies (and allies I'm guessing) for each mission type. What determines the makeup of the individual squads? A cultist assault squad contains between 7 and 10 members (unmodded game) but what determines how many of those are borg_assault types rather than, say, seer_sniper?

 

6. Enemy armaments contain the information

 

em Item RECORD

itemTemplateStringId STR "M60E3"

loadSaveMimeName STR "TQA2ADAAIABNAGEAYwBoAGkAbgBlAGcAdQBuACAAMAAxAA=="

storeItemId INT 80

tagId INT 11822

 

is all of this apart from itemTemplateStringId STR just used to store savegame info? I notice that the actual item IDs from the equipment.txt file aren't found in the enemy loadout files, so does just changing the name, height, width and loaded ammo of a weapon change the enemy's armament?

 

Many thanks to anyone who can help with any of these.

 

Abulafia.

Link to comment
Share on other sites

Well, I never tried to change the units' stats, so I don't know how are they works.

 

4. The game mostly adds the units by pairs, so 2 from unit 1, then 2 from unit 2, etc. Sometimes in circle, sometimes not.

 

5. You can define them with the squad_unit.txt

 

6. The AI unit files using almost all lines, except these:

 

loadSaveMimeName STR

storeItemId INT

toolTipString ERROR_SIMPLE_TYPE

 

But yes, if you change the items in equipment.txt, the AI units' equipment change too.

Link to comment
Share on other sites

I have no idea how to help, but I wanted to chime in to say you've done some pretty cool stuff with those acc charts. A+!~ :laugh:

 

Thanks Sunflash, more to come I hope.

 

Well, I never tried to change the units' stats, so I don't know how are they works.

 

4. The game mostly adds the units by pairs, so 2 from unit 1, then 2 from unit 2, etc. Sometimes in circle, sometimes not.

 

5. You can define them with the squad_unit.txt

 

6. The AI unit files using almost all lines, except these:

 

loadSaveMimeName STR

storeItemId INT

toolTipString ERROR_SIMPLE_TYPE

 

But yes, if you change the items in equipment.txt, the AI units' equipment change too.

 

Thanks DerelictableX!

 

4. Any idea how random it is? Knowing that it adds in pairs is useful.

5. Exactly what I needed! I'm guessing prob INT is the probability of picking that type as a squad member (out of the sum of all the prob INTs for possible squad members) while min INT is the minimum number found in the squad?

Link to comment
Share on other sites

It doesn`t choose in pairs. It randomly chooses per unit type and its probability/min value for the curret phase and mission. Then it randomly goes for another unit type. I think that it first starts with unit types with set minimals.

 

The game will create the squad when the mission appears on geo-map. This goes for numbers of unit types. When the mission is loaded the game will randomly choose between different soldiers in unit type files.

 

To change equipment you`ll have to create it in your own squad. Say you wish to give someone your new added gun. Hire a soldier, give him that gun and ammo. Save the game, extract, find that guy. Copy/paste whole inventory tag into the corresponded unit type. I usually leave original inventory tags for helmets and armor.

 

There are several moments here. First are race and subrace. The game will use the exact model for the race/subrace used by this unit, so pay attention when copying files.

Second is attributes and skills. Skills are locked to attributes and will change taking into account the real attributes values when this soldier is first loaded (you can experiment with recruits to see the exact results).

Third is trainings. It is not required to set all of the trainings for snipers, troopers and gunmen. All AI units will be able to use weapons even if they don`t have requirements for them. The exception is rangers. You`ll have to write their trainings in order to make the use two weapons. The same goes for medics revival ability.

Fourth is equipment. The AI in game is quite well-thought. For example AI does know how and when to use grenades, sidearms and medikits. For example a sniper that was caught in close combat will gladly switch to a pistol or smg if he has any. The problem with this is that AI will only use items that are in backpack. It wont even switch to a medkit/grenade in other hand.

Link to comment
Share on other sites

It doesn`t choose in pairs. It randomly chooses per unit type and its probability/min value for the curret phase and mission. Then it randomly goes for another unit type. I think that it first starts with unit types with set minimals.

 

The game will create the squad when the mission appears on geo-map. This goes for numbers of unit types. When the mission is loaded the game will randomly choose between different soldiers in unit type files.

 

To change equipment you`ll have to create it in your own squad. Say you wish to give someone your new added gun. Hire a soldier, give him that gun and ammo. Save the game, extract, find that guy. Copy/paste whole inventory tag into the corresponded unit type. I usually leave original inventory tags for helmets and armor.

 

There are several moments here. First are race and subrace. The game will use the exact model for the race/subrace used by this unit, so pay attention when copying files.

Second is attributes and skills. Skills are locked to attributes and will change taking into account the real attributes values when this soldier is first loaded (you can experiment with recruits to see the exact results).

Third is trainings. It is not required to set all of the trainings for snipers, troopers and gunmen. All AI units will be able to use weapons even if they don`t have requirements for them. The exception is rangers. You`ll have to write their trainings in order to make the use two weapons. The same goes for medics revival ability.

Fourth is equipment. The AI in game is quite well-thought. For example AI does know how and when to use grenades, sidearms and medikits. For example a sniper that was caught in close combat will gladly switch to a pistol or smg if he has any. The problem with this is that AI will only use items that are in backpack. It wont even switch to a medkit/grenade in other hand.

 

Okim you are a star, as always! Masses of useful information here, thank you very much.

 

Just to clarify a couple of your points -

 

When you say "Skills are locked to attributes and will change taking into account the real attributes values when this soldier is first loaded" do you mean that the skill scores in the .txt file don't matter at all? or that you change the recruit's attributes to be what you want, then use the values from the edited savegame?

 

Will the skill effects from trainings get added in automatically, if you do set the trainings manually (like extra hitpoints from gunman or leader)?

 

Is there anything special you needed to do to mod in armour add-ons for the cultist armours? I notice cultist light armour has only one add on slot, so I presume copy/paste from a light armoured laputa recruit won't work if they have two add-ons?

 

Did you get drones to work by building the drone of choice in the squad screen then copy/pasting the WHOLE text including subrace into borg-guard2.txt?

 

Does the race of the recruit you use to generate the inventory code have to be the same as the subrace entry equip_name STR? so use cyborgs for borgs, psionics for priestesses and humans for muckstars?

 

Many, many thanks again. I've loved how much you've been able to change the enemies in ACM, and it's really helpful of you to share your knowledge.

 

Abulafia.

Link to comment
Share on other sites

When you say "Skills are locked to attributes and will change taking into account the real attributes values when this soldier is first loaded" do you mean that the skill scores in the .txt file don't matter at all? or that you change the recruit's attributes to be what you want, then use the values from the edited savegame?

 

I mean that regardless of what you have set in that file all skills will be readjusted depending on unit attributes. You can`t make a soldier with awful intelligence and give him superheroic enemy skill. That skill will be adjusted according to unit`s awful INT attribute. Bonus value might be used to make such superhero dumbies possible, but i`m unsure.

Btw, the second string means the exact progress of that skill. You may recall some of the skills going yellow when increasing one of the skills? It means that the current skill increased by +0.25-0.75 points towards the next level. There is a skill file somewhere in strategic folder - it contains all data on skill-attributes links.

 

Will the skill effects from trainings get added in automatically, if you do set the trainings manually (like extra hitpoints from gunman or leader)?

 

No. All these files are not designed for manual editing in notepad. Yoou can always make a soldier from scratch in the game using console commands add_experience, add_training and then save/extract/edit the soldiers in notepad.

 

Is there anything special you needed to do to mod in armour add-ons for the cultist armours? I notice cultist light armour has only one add on slot, so I presume copy/paste from a light armoured laputa recruit won't work if they have two add-ons?

 

Each model has a set of pointers/helpers. Slots are just among them. Try to convert human and cultist armors (using mesconverter for ufoas rather than ufoal!). You`ll se the difference that can be easily edited by copy/pasting.

 

Did you get drones to work by building the drone of choice in the squad screen then copy/pasting the WHOLE text including subrace into borg-guard2.txt?

 

Yes. There are also entries in armors_st, equipment and subrace files as well as modified models for drones (lost animations, new textures).

 

Does the race of the recruit you use to generate the inventory code have to be the same as the subrace entry equip_name STR? so use cyborgs for borgs, psionics for priestesses and humans for muckstars?

 

I reccomend using original entries for race/subrace and just copying inventory/skills. BTW, there is a random head generator present in the game that giver all ai units random heads in game. Cyborg and psionic recruits sometimes use randomized heads instead of predetemined manually. Not sure why. Also i suggest you to look closely to cyborgs arms/legs. There are almost 10 diffirent variations of both.

Link to comment
Share on other sites

Okim, you're full of useful information as ever.

 

I've not been able to get the start_AI_unit_equip console command to work, as yet, but I'm probably using the wrong name, or wrong screen. I'll probably have a play with it over the weekend.

 

Thanks again,

 

Abulafia

Link to comment
Share on other sites

Okim, you're full of useful information as ever.

 

I've not been able to get the start_AI_unit_equip console command to work, as yet, but I'm probably using the wrong name, or wrong screen. I'll probably have a play with it over the weekend.

 

Thanks again,

 

Abulafia

 

If you`ll find the way to easily mod equipments - it will be invaluable!

 

But AFAIK those commands are either used in combination with some unknown `shortcut` options or aren`t usable at all. At least i was unable to get it working and still as years before i`m using hire/set-equipment/save/extract/copy/paste scheme :laugh:

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...