Rescripting the AI for a modification to the Balance Mod... |

Hi!
I've written a mod, based off of Captain Kwok's Balance Mod, and it has become apparent that in order for the AI to play effectively, it must be made so that the only way it will ever propose or agree to a treaty with a non-agression clause is if that clause is set to mutual colonization. That is, the AI should not be able to make a treaty by which it cannot colonize a system.
My problem is this: I have no idea what I'm doing. The rest of the mod is complete, there's just this one hang... Can anyone tell me how I might go about this possibly minor AI adjustment?
Thanks!
Re: Rescripting the AI for a modification to the Balance Mod...
maybe it's a little offtopic here, but i've a little issue with BM. it concerns empires' relations and treaties.
now i'm playing BM 1.09 and every empire which i met first time agreed with my proposal of non-agression pact. the thing is that my proposals were too impudent for the first contact i think: they must share techs, mine codes, maps, sensors and 5-10% of there resources each turn. i give 'em nothing except trade rights. and colonization allowed only in neutral systems. my score(techs,resources,pop) was not the best at that time.
and than, when i attack their planets they remain absolutly calm and quiet... and there is no any warnings when attacking allied empire.

Re: Rescripting the AI for a modification to the Balance Mod...
Thanks again for your help.
~ Kingside_Bishop
[/communication]
There are actually more files involved than just that file, to get your change into the game you will have to compile your Empire_Main_script using all the data files in the utility folder (or Captain Kwok's balance mod base script files) because the function call will be located in one data file requested by the empire_main_script file when compiling it.
I can't remember how many data files make up a complete package required for compiling but if you browsed the utility folder, look for all the ones that don't have an empire name associated with it and thats one. I co-located all the files into a working directory so I could modify the ones I needed and compile with in that directory.

Re: Rescripting the AI for a modification to the Balance Mod...
Open Script_AI_Politics.txt. The function "Get_Specific_Treaty_Element" starts around line 3400. In that function, you'll find the code I quoted above. Make the change and save.
Next, follow the compiling instructions here:
http://wiki.spaceempires.net/index.php/AI_and_Script_Editing_%28SEV%29#Compiling_Scripts
You'll want to use the "Make File" option (2nd method described in wiki) to compile all the AI's at one time. You'll then have to put each race's .csf files in their respective Empire folders. These are found in the Balance Mod \ Empires folder.




Re: Rescripting the AI for a modification to the Balance Mod...
TREATY_ELEMENT_TYPE_NON_AGGRESSION: set elem_value := 2 for elem_index := 1 to 3 do if (anger_towards_plr <= lng_Politics_Treaty_Elements_Allowed_Max_Anger.get(elem_index)) then set elem_value := elem_index endif endfortoTREATY_ELEMENT_TYPE_NON_AGGRESSION: set elem_value := 2