Page 2 of 5
Re: General Mod
Posted: Tue Dec 03, 2019 8:08 am
by Athos1660
Cronos09 wrote: ↑Tue Dec 03, 2019 7:49 am
one must think about indirect ones.
Here are maybe some ways to implement it, not knowing if it is moddable :
When an enemy artillery is defeated :
1) can a friendly artillery be spawned (wherever on the battlefield) ?
2) can the stat of an existing friendly artillery be improved ?
3) can an automatic reinforcement of one new friendly artillery unit be generated ?
4) can a friendly artillery that had been destroyed resurrect ?
5) can the stat of the nearest enemy unit (e.g. the number of men) be decreased once, as if the taken enemy artillery had fired once ?
rbodleyscott wrote: ↑Tue Dec 03, 2019 8:02 am
It can certainly be done, as I have written code to allow units to change sides in some user scenarios in FOG2. See the LocalUnitChangeSides() function in stockwellpete's Assandun scenario.
Interesting!
In terms of gameplay, what do you think of the idea of taken artillery switching side ?
You didn't implement it in P&S and FoG2, so I guess you don't like it.
Re: General Mod
Posted: Tue Dec 03, 2019 9:41 am
by Cronos09
Athos1660 wrote: ↑Tue Dec 03, 2019 8:08 am
Here are maybe some ways to implement it, not knowing if it is moddable :
When an enemy artillery is defeated :
1) can a friendly artillery be spawned (wherever on the battlefield) ?
2) can the stat of an existing friendly artillery be improved ?
3) can an automatic reinforcement of one new friendly artillery unit be generated ?
4) can a friendly artillery that had been destroyed resurrect ?
5) can the stat of the nearest enemy unit (e.g. the number of men) be decreased once, as if the taken enemy artillery had fired once ?
Too many 'can' to which I have no specific answer

Most likely the first option.
Re: General Mod
Posted: Tue Dec 03, 2019 10:03 am
by Athos1660
Cronos09 wrote: ↑Tue Dec 03, 2019 9:41 am
Too many 'can' to which I have no specific answer
I can imagine how complicated/impossible it is!
Cronos09 wrote: ↑Tue Dec 03, 2019 9:41 am
Most likely the first option.
Also the best one IMHO
PS : One last crazy/impossible idea : When an enemy artillery is defeated, can't a General be generated or activated, a General who'd be attached to an existing friendly artillery unit and would give it better Exp/Elan/'Point of fire' (I don't recall the exact wording) and/or another Stat ?
Re: General Mod
Posted: Tue Dec 03, 2019 1:35 pm
by rbodleyscott
Here is the FOG2 code:
Not sure if there is anything in it that fundamentally won't work in STUB.
Code: Select all
FUNCTION UnitChangeSides(me, newTeam)
{
int side;
int enemy_side;
int id;
int x;
int y;
int men;
int baseMen;
int unitSize;
int baseUnitSize;
int experience;
int baseExperience;
int elan;
int baseElan;
int moraleState;
int team;
int originalTeam;
int general;
int generalNomen;
int generalType;
int generalQuality;
int unitIndex;
int facing;
int i;
int total;
int textureIndex;
int EditorData[4];
side = GetUnitSide(me);
enemy_side = side + 1;
enemy_side = enemy_side % 2;
x = GetUnitX(me);
y = GetUnitY(me);
facing = GetUnitFacing(me);
// Record unit data
men = GetAttrib(me, "TotalMen");
baseMen = GetBaseAttrib(me, "TotalMen");
unitSize = GetAttrib(me, "UnitSize");
baseUnitSize = GetBaseAttrib(me, "UnitSize");
experience = GetAttrib(me, "Experience");
baseExperience = GetBaseAttrib(me, "Experience");
elan = GetAttrib(me, "Elan");
baseElan = GetBaseAttrib(me, "Elan");
moraleState = GetAttrib(me, "MoraleState");
for (i = 0; i < 4; i++)
{
EditorData[i] = GetEditorData(me, i);
}
general = GetAttrib(me, "General");
generalNomen = GetAttrib(me, "GeneralNomen");
generalType = GetAttrib(me, "GeneralType");
generalQuality = GetAttrib(me, "GeneralQuality");
if (gCampGame == 2)
{
unitIndex = GetAttrib(me, "CampaignUnitIndex");
}
textureIndex = GetAttrib(me, "TextureIndex");
GetUnitTypeString(GetUnitTypeIndex(me));
Log("me, men", me, men);
// Remove from Close Combat if any.
if (IsInCloseCombat(me) == 1)
{
RemoveAllCloseCombats(me);
}
// Delete the original version of the unit
// Remove the original version of the unit. (Don't delete it or that will mess up references for other units already in close combat).
// Note that this means that these units subsequently count as part of the original strength of both armies for % routed purposes.
RemoveUnit(me, 1);
// Add the new version
id = AddUnit(x, y, enemy_side, GetWorkString(), 1);
if (id != -1)
{
SetUnitFacing(id, facing);
AddVizUnitFormationNoWait(id); // Works in both primary directions without any jostling if unit is full strength. If other directions or below full strength, some milling about occurs.
men *= GetBaseAttrib(id, "TotalMen");
men /= baseMen;
SetAttrib(id, "TotalMen", men);
SetAttrib(id, "DisplayTotalMen", men);
unitSize *= GetBaseAttrib(id, "UnitSize");
unitSize /= baseUnitSize;
SetAttrib(id, "UnitSize", unitSize);
experience *= GetBaseAttrib(id, "Experience");
experience /= baseExperience;
SetAttrib(id, "Experience", experience); // Needs to be modified so that average English knights can become Superior when dismounted.
elan *= GetBaseAttrib(id, "Experience");
elan /= baseElan;
SetAttrib(id, "Elan", elan); // Needs to be modified so that average English knights can become Superior when dismounted.
SetAttrib(id, "MoraleState", moraleState);
SetAttrib(id, "DisplayMoraleState", moraleState);
SetUnitTeam(id, newTeam);
SetAttrib(id, "OriginalTeam", newTeam);
SetAttrib(id, "General", general);
UpdateDisplayGeneral(id, GetAttrib(id, "General"));
SetAttrib(id, "GeneralNomen", generalNomen);
SetAttrib(id, "GeneralType", generalType);
SetAttrib(id, "GeneralQuality", generalQuality);
for (i = 0; i < 4; i++)
{
SetEditorData(id, i, EditorData[i])
}
if (generalType == 1) // C-in-C will be killed by traitors
{
AddVizFunctionCall("PlayUISFX", 525, 0); // General lost
AddVizUnitText(id, "IDS_GENERAL_FALLEN", "ffffff", 0);
SetAttrib(id, "General", -1);
UpdateDisplayGeneral(id, -1);
}
if (gCampGame == 2)
{
SetAttrib(id, "CampaignUnitIndex", unitIndex);
}
// Restore original texture
ReSkinUnit(id, textureIndex);
CustomiseUnitManCount(id);
}
SetCurrentSelectedUnit(id);
SetUnitStatusFlag(id);
ResetMovedLastFlags(side);
SetCommandRangeFlags(id);
}
Re: General Mod
Posted: Tue Dec 03, 2019 1:37 pm
by rbodleyscott
Athos1660 wrote: ↑Tue Dec 03, 2019 8:08 amIn terms of gameplay, what do you think of the idea of taken artillery switching side ?
It is what happens in the tabletop game if the artillery are captured by "modern" infantry - pike or shot.
Re: General Mod
Posted: Tue Dec 03, 2019 2:30 pm
by Athos1660
rbodleyscott wrote: ↑Tue Dec 03, 2019 1:37 pm
It is what happens in the tabletop game if the artillery are captured by "modern" infantry - pike or shot.
Thank you very much for taking the time to answer and posting the code

Re: General Mod
Posted: Mon Dec 16, 2019 10:40 am
by Cronos09
Athos1660 wrote: ↑Tue Dec 03, 2019 8:08 am
When an enemy artillery is defeated :
1) can a friendly artillery be spawned (wherever on the battlefield) ?
First 'pen samples' (after charges):
rbodleyscott wrote: ↑Tue Dec 03, 2019 1:35 pm
Here is the FOG2 code:
Thanks. It hepled me.
Re: General Mod
Posted: Mon Dec 16, 2019 10:50 am
by Athos1660
Cronos09 wrote: ↑Mon Dec 16, 2019 10:40 am
(...)
Congrats ! I am really impressed by your work !
'Nasty' question : does your script even exclude capture by cavalry ? As :
rbodleyscott wrote: ↑Tue Dec 03, 2019 1:37 pm
It is what happens in the tabletop game if the artillery are captured by "modern"
infantry - pike or shot.
Whatever the answer is, that's really great!!!!!

Re: General Mod
Posted: Mon Dec 16, 2019 2:04 pm
by Ubberdorc
WoW great job!
Re: General Mod
Posted: Mon Dec 16, 2019 2:20 pm
by Cronos09
Athos1660, Ubberdorc thanks. It still has to be worked on.
Re: General Mod
Posted: Fri Dec 20, 2019 12:18 pm
by Cronos09
I have introduced a complex system of artillery capturing (on the advice of
Athos1660):
1) only non-light infantry can capture artillery guns as a result of its direct charge (see screenshots above). Morale state of the artillery is equal to the infantry unit;
2) cavalry and light infantry charges make gunners run away (guns remain on the battlefield). An infantry unit arrives and captures the battery with a repeat charge

3) Shooting from the distance makes gunners run away too. If a friendly unit is within 1 square of the battery, it regains control of the artillery guns next turn. Morale state of the artillery is equal to the unit

Re: General Mod
Posted: Fri Dec 20, 2019 2:03 pm
by Athos1660
Congrats! Amazing work!
Cronos09 wrote: ↑Fri Dec 20, 2019 12:18 pm
I have introduced a complex system of artillery capturing (on the advice of
Athos1660):
It seems that I approximately figured out one of the actual rules of the tabletop game about captured artillery (based on RBS' hint : " (...) if the artillery are captured by "modern" infantry - pike or shot")
I've read these tabletop rules since. There's another mechanism called 'Rear support' that would be a nice addition, in the case of a friendly unit protecting the Artillery. But I don't know whether or not RBS and the devs would allow such implementation/modding.
btw captured artillery could be treated as 'Poor' (simulating destruction of some guns during the fight) and shoot at reduced effect.
I don't know whether or not it is moddable. However, that's really great as is. Well done!
Re: General Mod
Posted: Fri Dec 20, 2019 4:34 pm
by Athos1660
Rear Support implemented/modded in game may work in the following manner IMO.
But first I guess that the implementation of such a mechanism from the Tabletop series needs RBS and al's permission :
I guess 'Rear support' would become 'Side support' in P&S (?) :
1) Right now, with the current game mechanics, in the following situation...
... C is able to attack and capture B :
2) 'Side Support' wouldn't allow C to attack B before having defeated A.
The friendly infantry A protects the artillery B from the enemy C.
So the infantry C has to defeat infantry A first before being able to capture arty B.
So 'side support' would appear when an arty unit and a friendly infantry are side by side.
This also means that if A breaks, C doesn't pursuit A but remains to capture B.
Here's the new rabbit in my sleeve
I don't know whether it is moddable and would be allowed.
But I guess that it could be fun.
Like in the case of the Commanded shots that are protected by a friendly cavalry unit during the enemy assault, the artillery crews are assumed to have withdrawn behind their fighting friends.
PS : unless 'Rear support' may remain "Rear' in P&S, ie with an infantry behind an arty ?
Re: General Mod
Posted: Fri Dec 20, 2019 5:13 pm
by rbodleyscott
I certainly have no objection to such a supported artillery mod. IIRC there is already something similar in Sengoku Jidai
Re: General Mod
Posted: Fri Dec 20, 2019 5:30 pm
by Athos1660
rbodleyscott wrote: ↑Fri Dec 20, 2019 5:13 pm
I certainly have no objection to such a supported artillery mod mod. IIRC there is already something similar in Sengoku Jidai
Thank you very much for both the permission and the information.
btw I was also hesitant about suggesting on these forums a couple of modded units for P&S adapted from the tabletop books (even though I know you wrote a post about 'Converting FOGR army lists to Pike and Shot').
Re: General Mod
Posted: Fri Dec 20, 2019 7:01 pm
by Cronos09
Thanks, Athos1660!
'Rear/Side Support' is almost implemented in the mod, when an infantry unit within 1 tile/square from a broken friendly artillery unit regains control of it. It remains to add this to the charge limits. Can only infantry units protect artillery, or cavalry too?
Re: General Mod
Posted: Fri Dec 20, 2019 8:07 pm
by Athos1660
Cronos09 wrote: ↑Fri Dec 20, 2019 7:01 pm
Thanks,
Athos1660!
'Rear/Side Support' is almost implemented in the mod, when an infantry unit within 1 tile/square from a broken friendly artillery unit regains control of it. It remains to add this to the charge limits.
Nice. Well done
Cronos09 wrote: ↑Fri Dec 20, 2019 7:01 pm
Can only infantry units protect artillery, or cavalry too?
It says 'foot battle troops'.
for info, the rules distinguish :
- Limbered artillery that follows the Vanilla rules that are currently implemented in game (automatic and immediate destruction when in contact with an enemy)
- Unlimbered artillery following the mechanisms of your mod
Will captured arty lose quality (once) ?
Re: General Mod
Posted: Fri Dec 20, 2019 9:18 pm
by rbodleyscott
Athos1660 wrote: ↑Fri Dec 20, 2019 5:30 pm
rbodleyscott wrote: ↑Fri Dec 20, 2019 5:13 pm
I certainly have no objection to such a supported artillery mod mod. IIRC there is already something similar in Sengoku Jidai
Thank you very much for both the permission and the information.
btw I was also hesitant about suggesting on these forums a couple of modded units for P&S adapted from the tabletop books (even though I know you wrote a post about 'Converting FOGR army lists to Pike and Shot').
Go ahead
Re: General Mod
Posted: Sat Dec 21, 2019 9:05 am
by Cronos09
Athos1660 wrote: ↑Fri Dec 20, 2019 8:07 pm
for info, the rules distinguish :
- Limbered artillery that follows the Vanilla rules that are currently implemented in game (automatic and immediate destruction when in contact with an enemy)
- Unlimbered artillery following the mechanisms of your mod
I do no see the sense in it. In P&S artillery is almost always unlimbered on the battlefield. It does not need to be transported long distances. The probability of charging it when limbered is negligible.
Athos1660 wrote: ↑Fri Dec 20, 2019 8:07 pm
Will captured arty lose quality (once) ?
Probably not. It is difficult to do this - exactly once.
'Rear/Side Support' is done:

Re: General Mod
Posted: Sat Dec 21, 2019 4:44 pm
by Athos1660
Thank you!
Time to choose an Army. French 1623-1634 (with Enfants perdus led by King's Musketeers and the French tactical Infantry doctrine) are very tempting! vs Spanish 1621-1634 (and their 'Kurassiers' and Later Tercios) ?
Cronos09 wrote: ↑Sat Dec 21, 2019 9:05 am
Athos1660 wrote: ↑Fri Dec 20, 2019 8:07 pm
for info, the rules distinguish :
- Limbered artillery that follows the Vanilla rules that are currently implemented in game (automatic and immediate destruction when in contact with an enemy)
- Unlimbered artillery following the mechanisms of your mod
I do no see the sense in it. In P&S artillery is almost always unlimbered on the battlefield. It does not need to be transported long distances. The probability of charging it when limbered is negligible.
Up to you. You are the boss
Cronos09 wrote: ↑Sat Dec 21, 2019 9:05 am
Athos1660 wrote: ↑Fri Dec 20, 2019 8:07 pm
Will captured arty lose quality (once) ?
Probably not. It is difficult to do this - exactly once.
np. That's a minor detail.
Cronos09 wrote: ↑Sat Dec 21, 2019 9:05 am
'Rear/Side Support' is done:
Well done!
Will it be :
- Rear Support ?
- Side Support ?
- both ?
btw in Skirmish mode, the AI of infantry A won't know she has to stay still behind the friendly Arty if she wants to protect it, right ?
But in the Scenario editor, one can tweak the AI behavior to stay still...