AI modding... Help me, please!!! |
I want to let AI use the new component I've created in my personal mod, and looking a little bit around the AI files, I've seen how to make... or I think so.
I've created 3 new component (at least in this moment...):
1) Temporal Shield (block anything)
2) Self Repairing Armor (Armor which repair itself like Organic)
3) Self Repairing Emissive Armor (Self Repairing and Emissive...)
If I don't make a mistake, I must add in file "Script_AI_GlobalConstants_Components.txt" the entry, like this:
1) AI_COMPONENT_TEMPORAL_SHIELD_GENERATOR: string := "Temporal Shield Generator"
2) AI_COMPONENT_SELF_REP_ARMOR: string := "Self Repairing Armor"
3) AI_COMPONENT_SELF_REP_EMISSIVE_ARMOR: string := "Self Repairing Emissive Armor"
and then in file "Script_AI_DesignCreation.txt" in the "Get_Best_Component_Of_Type" function I must add this modification:
1) for Temporal Shield in the section "AI_GEN_COMP_TYPE_SHIELD":
set comp_id := Sys_Get_Component_With_Name(sys_long_Player_ID, AI_COMPONENT_TEMPORAL_SHIELD_GENERATOR)
if (Sys_Is_Component_Available(sys_long_Player_ID, comp_id) then set final_comp_id := comp_id
endif
if (final_comp_id = 0) then
set comp_id := Sys_Get_Component_With_Name(sys_long_Player_ID, AI_COMPONENT_PHASED_SHIELD_GENERATOR)
if (Sys_Is_Component_Available(sys_long_Player_ID, comp_id)) then set final_comp_id := comp_id
endif
if (final_comp_id = 0) then
set comp_id := Sys_Get_Component_With_Name(sys_long_Player_ID, AI_COMPONENT_SHIELD_GENERATOR)
if (Sys_Is_Component_Available(sys_long_Player_ID, comp_id)) then
set final_comp_id := comp_id
endif
endif
endif
2 and 3) here come the trouble... the file "Script_AI_DesignCreation.txt" refer to "Get_Wanted_Component_From_List", but I don't undestand this part... where I can manipulate this list?
And one last thing... when I finished mod all this file... how can I compile all this file to let empire use them?

Re: AI modding... Help me, please!!!
these are actually three related lists being filled,
this is the one you want to add your component to:
call lst_Armor_Wanted_Name.add(AI_COMPONENT_EMISSIVE_ARMOR)
This one just keeps track of the tech area that its in:
call lst_Armor_Wanted_Tech_Area.add(AI_TECH_AREA_ARMOR)
And this one associates the level needed to obtain it. If you look in the Script_AI_GlobalResearch.txt you'll see how it keeps research areas populated and the empire on track in the right tech area to obtain certain tech/components.
call lst_Armor_Wanted_Tech_Level.add(20)

Re: AI modding... Help me, please!!!
The AI proceeds through the lists from first to last entry, so the most preferred armor should be listed first.
Re: AI modding... Help me, please!!!
Shameless Plug: http://www.spaceempires5.com/en-US/node/5037
Down in part four there's stuff about getting the AI to use new components in its designs.




Re: AI modding... Help me, please!!!
AI Scrips List.txt data file has the list, however, each Empire_main script has a section where it loads the list with the wanted tech.