Loner, have you looked at this guide? - Guide on adding new units by Setakat. It's in the modding guides section.
I have read that guide thanks Ftoomsh, most of my units are new, but as far as I'm aware it doesn't show how to get the A.I to produce anything new.
My suggestion would be this. Find a unit that vanilla A.I. produces all the time or in most A.I. games. A common 17th C pikeman for a standard 18th C nation would be a good target. Search the whole vanilla data file for the name of that unit. Find every occurrence of that unit name in every file where it occurs. This search should reveal every file and line of code where the unit has to be specified to make it work in every respect including the AI. You may or may not want to exclude maps and campaigns from this search to speed it up but then you might not find what is needed to make a unit work correctly in a campaign for example. Also, look specifically at the progresseconimicai.inc and maybe progresswarai.inc files and ensure the unit is specified for AI production and fighting, either all the time or sometimes according to a random function. Look at how existing stuff is specified for production. Bear in mind this file is very basic. The AI is basic and scripted, it is not intelligent AI. It would be possible to do a lot of work to make the AI smarter. The Cossacks Annihilation mod by Wralth added new units and put them in the AI if I recall correctly. He also made the AI smarter IIRC. The CA mod doesn't work any more but the code is still available. You can look at his code. His AI makes the new units. The code to look at is for AI extension 1.3. I apologize in advance if this advice is too simplistic or if you have already tried these avenues.
In Steam go to the Steam Community - Workshop. Search for Cossacks 3. When Cossacks 3 Mods are up, click to browse by tag Gameplay. You should find about 10 entries. Scroll down to Cossacks Annihilation with AI Extension 1.3 by Izy_hh. Download this mod. It probably won't run anymore, not updated. That doesn't matter. You want to look in the Workshop of OCMOD3 to find the files. Then you can open them and check out what he has done. I will try to keep answering any questions (not that I am any kind of expert) but my region will likely be facing a bush-fire crisis for the next two days. I might be very busy... saving my house... or running away. Let's hope it doesn't come to that.
Yes, things are still safe for us so far. No bush-fires in my general area. No high, hot winds either which is good. But my place is dry as tinder and there is no rain in sight. This weekend is predicted to be very hot too. We won't be able to fully relax until we get some good summer rains, if we get them at all. It could be days, weeks or months before rain. In Australia, the authorities have had to add another level to the bush-fire danger scale. The scale used to end at "Extreme". Now, beyond "Extreme" there is "Catastrophic". The new category is necessary too. Imagine, if you will, a day with 40 C temperatures, humidity at 3% and winds of 80 kph gusting to 100 kph. In those conditions, embers are driven kilometers ahead of the fire front and "spot" new fire outbreaks at those points. Even if all the undergrowth is cleared, the fire simply leaps from tree-top to tree-top. The fire can become a fire-storm, the technical definition of which includes the fact that it creates its own winds and weather. Such fires are deadly and un-fightable.
With the help of Awar I finally got this sorted, I'm not very good at understanding which each piece of code actually means.
Finally managed to get the A.I to produce Grenadiers; [*] = ; if (pikemanCount>=36*4) or (cid=cid_alg) or (cid=cid_ukr) or (cid=cid_aus) or (cid=cid_tur) or (cid=cid_eng) or (cid=cid_fra) or (cid=cid_bav) or (cid=cid_den) or (cid=cid_hun) or (cid=cid_net) or (cid=cid_pie) or (cid=cid_pol) or (cid=cid_por) or (cid=cid_pru) or (cid=cid_rus) or (cid=cid_sco) or (cid=cid_sax) or (cid=cid_spa) or (cid=cid_swe) or (cid=cid_swi) or (cid=cid_ven) then [*] = ; begin [*] = ; if (cid=cid_alg) then [*] = ; begin [*] = ; _ai_TryUnit(plind, cid, pikemanUnit, bar_count, False); [*] = ; if (not bIsWaterMap) then [*] = ; begin [*] = ; if (_ai_GetUnitCount(plind, cid, gc_ai_unit_uniq_inf17)<gPlayer[plInd].counter.farmused div 3) then [*] = ; _ai_TryUnit(plind, cid, gc_ai_unit_uniq_inf17, bar_count, False); [*] = ; end [*] = ; else [*] = ; begin [*] = ; if (_ai_GetUnitCount(plind, cid, gc_ai_unit_uniq_inf17)<gPlayer[plInd].counter.farmused div 5) then [*] = ; _ai_TryUnit(plind, cid, gc_ai_unit_uniq_inf17, bar_count, False); [*] = ; end; [*] = ; end [*] = ; else [*] = ; begin [*] = ; if (pikemanCount<=(36*7+gc_ai_max_guards)) then [*] = ; begin [*] = ; if (cid=cid_ukr) or (cid=cid_alg) or (cid=cid_aus) or (cid=cid_tur) or (cid=cid_eng) or (cid=cid_fra) or (cid=cid_bav) or (cid=cid_den) or (cid=cid_hun) or (cid=cid_net) or (cid=cid_pie) or (cid=cid_pol) or (cid=cid_por) or (cid=cid_pru) or (cid=cid_rus) or (cid=cid_sco) or (cid=cid_sax) or (cid=cid_spa) or (cid=cid_swe) or (cid=cid_swi) or (cid=cid_ven) then //for cid_ukr [*] = ; begin [*] = ; _ai_TryUnit(plind, cid, gc_ai_unit_musk17, bar_count, False); [*] = ; _ai_TryUpgrade(plind, cid, gc_ai_upg_quickshot1); [*] = ; end else [*] = ; _ai_TryUnit(plind, cid, gc_ai_unit_musk17, 1, False); [*] = ; _ai_TryUnit(plind, cid, pikemanUnit, bar_count, False); [*] = ; end [*] = ; else [*] = ; _ai_TryUnit(plind, cid, gc_ai_unit_musk17, bar_count, False); [*] = ; end; [*] = ; end [*] = ; else [*] = ; _ai_TryUnit(plind, cid, pikemanUnit, bar_count, False); Just copied and repeated this section of code from progresseconomicai replacing pikemanUnit with infantry17 then changed grenadier to infantry17 in country.script. Probably not the conventional way to do it, but it works.
Is there any way to stop the Officer and Drummer from charging into the enemy, when attacking, and getting instantly killed.
You need to add weapons for the officer and the drummer. The type of weapon is a "gc_obj_weapon_kind_bullet". Set the value of the shot is zero. for example unit.script for drummer18 SetObjBaseWeapon(objprop, objbase, 1, 0, 0, 400, 1000, 400, 50000, gc_obj_weapon_kind_bullet, False); SetObjBaseMaterialCanKill(objprop, gc_obj_material_body, gc_obj_material_body, 0, 0, 0, 0); SetObjBaseSearchBuildVisionScore(objprop, objbase, 1000, 192, 6, 10); for officer18 SetObjBaseSearchBuildVisionScore(objprop, objbase, 1000, 192{150}, 4, 10); objprop.consume[gc_resource_type_gold] := 80; SetObjBaseWeapon(objprop, objbase, 1, 0, 0, 400, 950, 400, 50000, gc_obj_weapon_kind_bullet, False); Edit the animation file. officer18.aaf AAF 12 "idle",115,164,morph "walk",1,24,morph "death",49,102,morph "attack0",29,46,morph "attack1",166,215,morph "prepare0",104,113,morph "unprepare0",216,226,morph "prepare1",104,113,morph "unprepare1",216,226,morph "idle0",166,215,morph "trans01",163,164,morph "trans10",163,164,morph drummer18.aaf AAF 8 "idle",81,131,morph "idle0",81,131,morph "walk",1,24,morph "walk0",1,24,morph "death",26,80,morph "attack1",81,131,morph "trans10",130,131,morph "trans10",130,131,morph officer and the drummer will simulate shooting However, each imaginary shot will reduce the life of the enemy by one. This can be corrected another time, the file miscext2.script 381 if (damage<1) then damage := 1; // Change 1 to 0
misflagman? \data\animations\aaf\misflagman.aaf AAF 9 "idle",104,153,morph "idle0",155,254,morph "walk",1,24,morph "walk0",1,24,morph "death",49,102,morph "attack1",104,153,morph "attack0",26,48,morph "trans01",152,153,morph "trans10",152,153,morph Okay, I'll check the work on the original version