As exercice, I tried to set a heavy handicap for Cavalry when cavalry atacks elephants : I want to have a percent=0 in any case (horses are afreid by elephants = so, they can't attack them)
My "exercise" is that : I have included blue lines in a existant function, and it seems work perfect. I don't know if my "exercise" is very "orthodox" (because I have no knoledges in coding), but it's works in game

(perhaps is it not necessary because the game has already that, but I wanted to learn how to work with scripts and to see if this sort of adding makes or do not make bugs)
In CombatTools.BSF (what I added is in blue)
FUNCTION GetShootingWeaponModifier(me, target, distance, volley, test, print)
{
int percent;
int POA;
int POA_adjustment;
int total_modifier;
int any_shooters;
int range;
int any_printed;
int shots;
int capability;
int effective_armour;
any_printed = 0;
total_modifier = 0;
any_shooters = 0;
if (print == 1)
{
PrintStringIndexedX(1, test, "IDS_TT_SHOOTVOLLEY", volley);
}
// Handgun
percent = GetAttrib(me, "Handgun");
if (percent > 0)
{
any_shooters = 1;
if (distance > 1)
{
percent = 0;
}
else
{
percent *= CloseRangeNonLightFootShootingModifier(me);
percent /= 100;
}
if (print == 1)
{
PrintStringLiteralX(1, test, "\n");
PrintStringIndexedX(1, test, "IDS_CAPABILITY", 4);
PrintEffectiveShots(test, me, percent, volley, 0);
any_printed = 1;
}
if (target == -1) // Used for calculating ShootingRating
{
POA = -50; // Average POA vs Mounted and Foot
}
else
{
POA = 0;
}
if (IsUnitSquadType(me, "Cavalry") == 1) // If Cavalry attacks elephants, the capabilities percent for this attack is always 0 => no effect)
{
any_shooters = 1;
if (IsUnitSquadType(target, "Elephants") == 1)
{
percent = 0;
}
}
One thing I have top say :
1/ This is very interessant to work in modding on this game
2/ But you, FOG2/Slitherine staff; should get us a way to rationalize our work efforts : it would be great to have a complete list :
* of usable functions
* of usable terms encountered in scripts (what is me, what is POA, etc
* of usable definition
sample : to found how "declare" elephants as attackant in my script work, I had to search in the script a place where elephants were used, to see how to "declare" my elephants
If I had had a list, it would have been very easy
Sample of list :
Target definitions : if (IsUnitSquadType(target, "elephants")
etc (for each type units)
Squads definitions : if (IsUnitSquadType(me, "Cavalry")
etc (for each type units)
Hubert Cater did that for Strategic command to help modders to realize scripts : complete lists of functions, declarations,definitions, etc and it hels the work. At this time, we work as blinds, we have to ask for each little step : what is what ? what is this ? etc etc : this process is not very logical and rationalized
A complete list of functions, target definitions, int values, squads definitions, etc would be great (as I did in others threads with the complete list of usable files and usable suqads data)
And a question, please : where is in vanilla scripts the lines concerning fighting Cavalry vs elephangts (defense or attack) ?