AI and Point Defense |
Today I fought again against the Amonkrie. They had Anti Proton Beams and a few torps on their ships. I had Missiles and was faster than they were, so it was really pointless, just missiled them to death, because no ship of them had even one point defense cannon on board.
Where have I to mod the AI files to get point defense on their ships?
I used the scriptparser tool, but I am not able to find the entries, searched the Amonkrie Main script, the Amonkrie Setup script, Script AI design creation, Script AI Construction, and looked into a few other ones, only in the research script I found entries to point defense, increased the levels there a bit, but what does it help, to have the AI researching the point defense Techs further, when the canons are not used. 
Hope you can help me.
Redbull102
Edit: I reduced now the entry
set lng_AI_Design_Tonnage_Ship_Pct_Primary_Weapon := 40
to
set lng_AI_Design_Tonnage_Ship_Pct_Primary_Weapon := 20
Now there should be +20% for the AI to put other mods in.
For Colony ships it works, they have now ~ 4 point defense weapons on board, but there are still no point defense weapons on frigates and destroyers. 
Can I directly say the AI to put 2 point denfense weapons on their ships?

It looks ok...
Lines 630-700ish contain the relevant info you want to change in the Script_AI_GlobalSettings.txt file. You'll want to bump the pct space to see more PD added on designs - particularly on smaller ships.
Otherwise it looks ok, but the primary weapon % should probably be 15ish to make sure the AI will add at least 1 weapon on low level frigates.
Primary weapons are your typical DUCs, APBs, etc., heavy weapons are usually assign to CSMS, Torps, or other 40kT+ weapons.
-----
Re: AI and Point Defense
There are other inherant flaws in the DesignCreation file. For instance:
When calculating the percentage of a ship to fill with components, the AI uses the ship's remaining tonnage, not it's total tonnage. This results in components further down the design list being given less and less room on a ship, until they just don't have any room to add any at all.
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod

Re: AI and Point Defense
I don't think so. The percent to add items always use the vehcile's tonnage, not its space remaining.
Re: AI and Point Defense
From stock Script_Ai_DesignCreation.txt as of v1.63:
//------------------------------------------------------------------------
// Add_Components_To_Design
//------------------------------------------------------------------------
function Add_Components_To_Design returns boolean
params
design_id: long
ai_design_type: string
vars
comp_id: long
comp_enh_id: long
num_to_add: long
size_id: long
vehicle_tonnage: long
comp_tonnage: long
list_count: long
index: long
design_type_str: string
continue_design: boolean
found_type: boolean
pct_of_space: long
comp_name: string
add_comp: boolean
begin
set continue_design := TRUE
set size_id := Sys_Get_Vehicle_Design_Size_ID(design_id)
set vehicle_tonnage := Sys_Get_Vehicle_Design_Remaining_Tonnage_Space(design_id)
set comp_enh_id := 0
...
Should be:
set vehicle_tonnage := Sys_Get_Vehicle_Design_Tonnage_Space(design_id)
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod

Re: AI and Point Defense
That's no good. 
I wonder when it changed. Long ago when the Balance Mod first started, it was based on the vehicle tonnage.
Re: AI and Point Defense
Ahh, I see what you mean, Kwok.
Yes, you are absolutely correct, it doesn't recalculate the tonnage after adding components. My mis-speaking (mis-typing?) there.
However, what I showed above has serious ramifications on the AI design of a ship. That simple change can make all the world of difference.
As to the OP:
I found the same problem. In my mod I ended up removing PD devices from the Misc Components list (since I felt they were sort of a nessesity) and set them up similar to how it adds primary weapons, etc. The Misc Components list is in Script_AI_GlobalSettings.txt.
"Only by being constantly at war with evil in all things, including yourself, can you truely know peace."
Download my mod here: GidMod
Re: AI and Point Defense
That changed way back in 1.25

Re: AI and Point Defense
The base of the Balance Mod scripts actually date back to a v0.80ish version of stock SE:V scripts.




Changing AI scripts for missile and PD use... will it work??
Hey all! I've been trying to get the AI to use PD and missiles as well, so I made some changes to the AI scripts, and I want to know if you think they would work. Capt Kwok can hopefully answer this question.
I made the following changes to the Amonkrie_Main_Script.txt files:
Based on my understanding of this portion of the file:
call lst_Heavy_Weapon_Name.add("Null - Space Projector")
call lst_Heavy_Weapon_Tech_Area.add("Null - Space Weapons")
call lst_Heavy_Weapon_Tech_Level.add(1)
call lst_Heavy_Weapon_Name.add("Anti - Matter Torpedo")
call lst_Heavy_Weapon_Tech_Area.add("Torpedo Weapons")
call lst_Heavy_Weapon_Tech_Level.add(1)
call lst_Heavy_Weapon_Name.add("Capital Ship Missile")
call lst_Heavy_Weapon_Tech_Area.add("Missile Weapons")
call lst_Heavy_Weapon_Tech_Level.add(1)
I believe the heavy weapons are the ranged weapons, so I think it's as simple as having the AI assign more tonnage to heavy weapons. So I changed the tonnage distribution portion of the file to:
set lng_AI_Design_Tonnage_Ship_Pct_Primary_Weapon := 10
set lng_AI_Design_Tonnage_Ship_Pct_Heavy_Weapon := 40
set lng_AI_Design_Tonnage_Ship_Pct_Special_Weapon := 10
set lng_AI_Design_Tonnage_Ship_Pct_Shields := 10
set lng_AI_Design_Tonnage_Ship_Pct_Armor := 10
I also reduced the net assigned percent ship tonnage to 80% thereby opening more space for
"extra_components" which includes PD. I then modified the extra tonnage function in the file:
Script_AI_GlobalSettings.txt to make PD a higher priority. I did this by moving the portion of the file that assigns "Supply_storage" behind the portion of the file that assigns all PD.
Finally, I also wanted every empire to use all PD techs so they would take the first PD tech they get and assign it to the ships. So I changed this portion of the
Amonkrie_Main_Script.txt files:
set bool_Race_Uses_Point_Defense_Cannons := TRUE
set bool_Race_Uses_Point_Defense_Beam := TRUE
set bool_Race_Uses_Point_Defense_Blaster := TRUE
set bool_Race_Uses_Flak_Cannon := TRUE
set bool_Race_Uses_Bomblet_Missile := TRUE
Those were my changes. What do you think? Should they work? Did I do anything wrong?
---
The goggles... they do nothing!