Currently the diplomacy2.slc that I've made is as below. Consider it a gratuitous Christmas gift
diplomacy2.slc (include this in script.slc):
int_t messarmysize;
HandleEvent(NextDiplomaticState) 'Distance_NextDiplomaticState_F' pre {
int_t mnctyapart;
int_t clsecity;
int_t dist_measure;
mnctyapart = 300;
clsecity = 100;
int_t i;
int_t j;
int_t play0;
int_t play1;
int_t db_index;
int_t ss_priority;
city_t capcity0;
city_t capcity1;
int_t flagthreat;
flagthreat = 0;
// capcity0 = player[0].capital; // Broken !!
// if (CityIsValid(capcity0)) {
// }
// else {
// capcity0 = player[0].largestcity; //Broken!!
// }
for (i=0; i
for (j=0; j
GetCityByIndex(player[0], i , capcity0);
GetCityByIndex(player[1], j , capcity1);
dist_measure = SquaredDistance(capcity0.location, capcity1.location);
if (dist_measure < mnctyapart){
if (dist_measure < clsecity) {
// hey, this guy is too close!
flagthreat = 2;
}
elseif (flagthreat == 0) {
// close, but not that close
flagthreat = 1;
}
}
}
}
if (flagthreat == 0) {
// Be nice to the guy! He's too far
ss_priority = 5000;
db_index = DiplomacyDB(DIPLOMACY_MAKE_FRIEND);
ConsiderDiplomaticState(player[0], player[1], ss_priority,db_index);
}
elseif (flagthreat == 2) {
// this guy is real close. he'll be a pain!
if (player[0].militaryunits > 2*player[1].militaryunits) {
//Go get him!! he's very weak!
ss_priority = 5000;
db_index = DiplomacyDB(DIPLOMACY_PROVOKE_WAR);
ConsiderDiplomaticState(player[0], player[1], ss_priority,db_index);
}
elseif (player[1].militaryunits > 2*player[0].militaryunits) {
//Don't provoke!! he's very strong!
ss_priority = 10000;
db_index = DiplomacyDB(DIPLOMACY_DEFAULT);
ConsiderDiplomaticState(player[0], player[1], ss_priority,db_index);
}
}
}
[This message has been edited by colorme (edited December 24, 2000).]