Modding P&S to halve missile ranges & move distances
Moderators: rbodleyscott, Slitherine Core, Gothic Labs
-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Modding P&S to halve missile ranges & move distances
I would like to make a mod which halves missile ranges and movement distances. In the halcyon days of my youth, I did computer programming. I doubt my old Fortran, Cobol & Basic skills will help me much here {nostalgic smile}, but I'm hoping I'll be able to puzzle out the scripting language.
Can anyone give me a comprehensive list of the scripts/files I would need to modify in order to accomplish my "halved ranges & moves" goal? I've read through the forum to get ideas, and I saw, in a previous thread where someone had asked "How do I edit the weapon effects and ranges of the different units, eg to make artillery more effective at shorter range?", that RBS had replied "To do this you will have to edit scripts. Mostly in CombatTools.BSF. The main functions you would need to edit are GetShootingWeaponModifier(), GetImpactPOA(), GetMeleePOA()."
Are these the only scripts I'd need to modify to cut shooting ranges in half? And what scripts might I need to modify to cut move distances in half?
Any advice would be appreciated. I've downloaded & installed Notepad++, and have read through the Scenario Design pdf.
Can anyone give me a comprehensive list of the scripts/files I would need to modify in order to accomplish my "halved ranges & moves" goal? I've read through the forum to get ideas, and I saw, in a previous thread where someone had asked "How do I edit the weapon effects and ranges of the different units, eg to make artillery more effective at shorter range?", that RBS had replied "To do this you will have to edit scripts. Mostly in CombatTools.BSF. The main functions you would need to edit are GetShootingWeaponModifier(), GetImpactPOA(), GetMeleePOA()."
Are these the only scripts I'd need to modify to cut shooting ranges in half? And what scripts might I need to modify to cut move distances in half?
Any advice would be appreciated. I've downloaded & installed Notepad++, and have read through the Scenario Design pdf.
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
The scripting language is a tiny subset of the C programming language. You will find details in http://www.slitherinebravo.net/GameWiki ... tub_engineInterlocutor wrote:I would like to make a mod which halves missile ranges and movement distances. In the halcyon days of my youth, I did computer programming. I doubt my old Fortran, Cobol & Basic skills will help me much here {nostalgic smile}, but I'm hoping I'll be able to puzzle out the scripting language.
Can anyone give me a comprehensive list of the scripts/files I would need to modify in order to accomplish my "halved ranges & moves" goal? I've read through the forum to get ideas, and I saw, in a previous thread where someone had asked "How do I edit the weapon effects and ranges of the different units, eg to make artillery more effective at shorter range?", that RBS had replied "To do this you will have to edit scripts. Mostly in CombatTools.BSF. The main functions you would need to edit are GetShootingWeaponModifier(), GetImpactPOA(), GetMeleePOA()."
Are these the only scripts I'd need to modify to cut shooting ranges in half? And what scripts might I need to modify to cut move distances in half?
You won't need to mod GetImpactPOA() or GetMeleePOA() to alter shooting ranges - these functions are only used for close combat.
I think the only functions you will need to mod to alter the shooting ranges are:
GetShootingWeaponModifier(), MaximumRange(), OptimumRange() and IsLongRange().
I cannot absolutely promise that nothing else needs altering without writing and testing the mod myself!
You don't need to mod any scripts to alter movement distances. The movement points (AP) for all units are in the Squads file in the AP column. (Note that the Speed column has nothing to do with distance moved but only the speed of the animation). The program uses Squads.csv, but it is easier to edit Squads.xlsx (because it is formatted) and then save as Squads.csv. The basic cost to move into an open terrain square orthogonally is 4 AP, and diagonally is 6AP. So you must not reduce the AP of any unit below 6AP, which will allow it to move 1 square orthogonally or diagonally in open terrain, but depending on the troop type may only let it go orthogonally in non-open terrain. You may or may not need to mod Terrain.txt, which governs the cost to enter different types of terrain for different troop types, otherwise infantry may not be able to enter certain terrain types at all.
You should not alter any files in the main game installation. You should put modded files in a custom campaign directory - using the file structure shown in http://www.slitherinebravo.net/GameWiki ... tub_engine (near the end). It is critical that you do put the files in the correct place as per the diagram. Then the game will automatically use them instead of the vanilla versions.
If you get stuck, feel free to ask for further help.
Richard Bodley Scott


-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Thank you, Richard. I appreciate the advice & counsel. I'm going to work on move distances first, see how that turns out, then work on missile ranges.
-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Hi Richard,
I've gotten the "halved move distance" part working, though as you said, I may need to tweak some of the terrain types more than I have already {smile}.
Now I'm working in CombatTools.BSF, and I noticed something I think might be an anomaly. In the script segment beginning at Line #1572, commented as: "Returns the range at which all shooters in unit can shoot at maximum effect" and calling the function "OptimumRange()", the weapon type "Arquebus" has been left out of the coding logic. Was that intentional?
I've gotten the "halved move distance" part working, though as you said, I may need to tweak some of the terrain types more than I have already {smile}.
Now I'm working in CombatTools.BSF, and I noticed something I think might be an anomaly. In the script segment beginning at Line #1572, commented as: "Returns the range at which all shooters in unit can shoot at maximum effect" and calling the function "OptimumRange()", the weapon type "Arquebus" has been left out of the coding logic. Was that intentional?
-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Hi Richard,
Noticed another puzzling thing in CombatTools.BSF. On line 3415 is the following:
// Artillery, train and boats have no close combat rating
if ((IsUnitSquadType(me, "Train") == 1) || (IsUnitSquadType(me, "Boat") == 1))
{
ret = 0;
Though the comment says artillery has no close combat rating, its squad type is not set to zero. Is that correct?
Noticed another puzzling thing in CombatTools.BSF. On line 3415 is the following:
// Artillery, train and boats have no close combat rating
if ((IsUnitSquadType(me, "Train") == 1) || (IsUnitSquadType(me, "Boat") == 1))
{
ret = 0;
Though the comment says artillery has no close combat rating, its squad type is not set to zero. Is that correct?
-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Hi Richard,
I love your comments/documentation in CombatTools.BSF {smile}.
My wife says you're the only person, other than myself, that she has ever known to use the words "orthogonal" or "orthogonally" in a sentence {grin}...
I love your comments/documentation in CombatTools.BSF {smile}.
My wife says you're the only person, other than myself, that she has ever known to use the words "orthogonal" or "orthogonally" in a sentence {grin}...
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
No, that appears to be a bug. Thanks for pointing it out in time for the next update (and Arquebus-laden expansion).Interlocutor wrote:Now I'm working in CombatTools.BSF, and I noticed something I think might be an anomaly. In the script segment beginning at Line #1572, commented as: "Returns the range at which all shooters in unit can shoot at maximum effect" and calling the function "OptimumRange()", the weapon type "Arquebus" has been left out of the coding logic. Was that intentional?
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
Yes. The mention of artillery in the comment is a fossil. Artillery were originally going to have no close combat ability, so would be automatically captured unless supported by an infantry unit, but I decided that was too complicated - and dubiously historical anyway. (The supporting, not the capturing).Interlocutor wrote:Hi Richard,
Noticed another puzzling thing in CombatTools.BSF. On line 3415 is the following:
// Artillery, train and boats have no close combat rating
if ((IsUnitSquadType(me, "Train") == 1) || (IsUnitSquadType(me, "Boat") == 1))
{
ret = 0;
Though the comment says artillery has no close combat rating, its squad type is not set to zero. Is that correct?
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
I call a spade a spade.Interlocutor wrote:My wife says you're the only person, other than myself, that she has ever known to use the words "orthogonal" or "orthogonally" in a sentence {grin}...
Richard Bodley Scott


-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Well, it's up and running, though I had a devil of a time with mismatched brackets after editing CombatTools.BSF .
Basically, I tried to follow your advice, and all I did was:
1) halve the AP values in Squads.CSV (reducing former 10's & 12's to 6, everything else to half of its former value);
2) make a number of changes to the "cost to enter terrain" values in Terrain.TXT (commented all my changes);
3) edited CombatTools.BSF to cut ranges in half, commenting where I made changes, though I've not yet cut ranges for medium or heavy artillery; and
4) changed my custom campaign name in Text1.TXT so that it appears properly in the campaign list.
I'm testing it all now in an ECW skirmish battle.
Question: can I now simply create other custom campaign folders in MY DOCUMENTS/MY GAMES for the Italian Wars & 30YW, clone the stock campaigns, and simply copy Squads.CSV, Terrain.TXT & CombatTools.BSF from my modded ECW campaign? Or do the stock files, particularly CombatTools.BSF, differ from stock campaign to stock campaign?
Basically, I tried to follow your advice, and all I did was:
1) halve the AP values in Squads.CSV (reducing former 10's & 12's to 6, everything else to half of its former value);
2) make a number of changes to the "cost to enter terrain" values in Terrain.TXT (commented all my changes);
3) edited CombatTools.BSF to cut ranges in half, commenting where I made changes, though I've not yet cut ranges for medium or heavy artillery; and
4) changed my custom campaign name in Text1.TXT so that it appears properly in the campaign list.
I'm testing it all now in an ECW skirmish battle.
Question: can I now simply create other custom campaign folders in MY DOCUMENTS/MY GAMES for the Italian Wars & 30YW, clone the stock campaigns, and simply copy Squads.CSV, Terrain.TXT & CombatTools.BSF from my modded ECW campaign? Or do the stock files, particularly CombatTools.BSF, differ from stock campaign to stock campaign?
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
That should work, yes.Interlocutor wrote:Question: can I now simply create other custom campaign folders in MY DOCUMENTS/MY GAMES for the Italian Wars & 30YW, clone the stock campaigns, and simply copy Squads.CSV, Terrain.TXT & CombatTools.BSF from my modded ECW campaign?
They don't differ. (If they did, you would find them in the Stock campaign folders or sub-folders).Or do the stock files, particularly CombatTools.BSF, differ from stock campaign to stock campaign?
Richard Bodley Scott


-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Thanks for your help, Richard. I've cloned the Italian Wars campaign, moved over the modded files, and it all seems to work! There will be some tweaking needed in Terrain.TXT I think, but so far, so good. Two test ECW skirmishes and one Italian Wars so far, no problems.
I'd have gotten more testing done, but I'm painting Swiss for my 28mm Italian Wars FoGR armies, wanted to progress that today, too {smile}.
I'd have gotten more testing done, but I'm painting Swiss for my 28mm Italian Wars FoGR armies, wanted to progress that today, too {smile}.
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
Interlocutor's Reduced Movement and Shooting Ranges Mod - versions for TYW, ECW and IW, SP & MP - are now available for download in game.
Currently these only support random map games as the vanilla historical scenarios are not designed for these move distances and ranges.
Currently these only support random map games as the vanilla historical scenarios are not designed for these move distances and ranges.
Richard Bodley Scott


Re: Modding P&S to halve missile ranges & move distances
Hi.
I am wondering, do the untis have default costs? I would assume that ranged combat units should now have a lower cost, as theya re arguably less usefull and more at risk.
I am wondering, do the untis have default costs? I would assume that ranged combat units should now have a lower cost, as theya re arguably less usefull and more at risk.
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
Yes - in the squads file.Sabratha wrote:Hi.
I am wondering, do the untis have default costs?
Richard Bodley Scott


-
- Corporal - 5 cm Pak 38
- Posts: 30
- Joined: Fri Oct 19, 2012 12:30 pm
Re: Modding P&S to halve missile ranges & move distances
Hmmm. Interesting point. It might be a good idea to do something about that.Sabratha wrote:Hi.
I am wondering, do the untis have default costs? I would assume that ranged combat units should now have a lower cost, as theya re arguably less usefull and more at risk.
I haven't looked yet, just saw Sabratha's post. But as Richard says, it would be an easy thing to adjust in Squads.csv. It wouldn't matter for the historical scenarios, it seems to me, since they are based on historical OOB's. And until someone revises them, many won't work right with reduced move distances & ranges anyway. But for skirmish battles, or custom scenarios designed to fight battles resulting from map-based or boardgame-based campaigns, (my own preference), it would be a big thing.
Just thinking out loud here, but I wonder if some comparison between the "cost per base" in the FoGR minis rules and the "cost per unit" in P&S would be useful? I'll go off and have a look...
-
- Staff Sergeant - StuG IIIF
- Posts: 250
- Joined: Sat Dec 05, 2009 10:19 pm
Re: Modding P&S to halve missile ranges & move distances
Hi,
I downloaded, but can only see how to set this up for a single person battle. Am I missing something?
JocaRamiro
I downloaded, but can only see how to set this up for a single person battle. Am I missing something?
JocaRamiro
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
Once you have downloaded the MP version it works the same as any other MP Skirmish challenge:JocaRamiro wrote:Hi,
I downloaded, but can only see how to set this up for a single person battle. Am I missing something?
Go to the Multiplayer menu, My Challenges tab. Select New Challenge, then Create Skirmish, then change the campaign to one of the Reduced Move and Ranges versions....
Richard Bodley Scott


-
- Staff Sergeant - StuG IIIF
- Posts: 250
- Joined: Sat Dec 05, 2009 10:19 pm
Re: Modding P&S to halve missile ranges & move distances
Thank you. When I went back, i realized I had been confused by the fact there were no little triangles next to the choice for campaign.
So, I was able to create reduced move/range scenarios, but everyone who signs up to them apparently does not have the compatible content downloaded. On a further look, it seems to me that my created scenario just says 30 Years War ....., that is to say, there is no indication it comes from the reduced move/range family. I then tried to use the comment field to point this out. When I tried this, the game could not be created, and I was told I did not have the proper campaign. This seems like a bug.
Joca Ramiro
So, I was able to create reduced move/range scenarios, but everyone who signs up to them apparently does not have the compatible content downloaded. On a further look, it seems to me that my created scenario just says 30 Years War ....., that is to say, there is no indication it comes from the reduced move/range family. I then tried to use the comment field to point this out. When I tried this, the game could not be created, and I was told I did not have the proper campaign. This seems like a bug.
Joca Ramiro
-
- Field of Glory 2
- Posts: 28284
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Modding P&S to halve missile ranges & move distances
Hi Joca,JocaRamiro wrote:Thank you. When I went back, i realized I had been confused by the fact there were no little triangles next to the choice for campaign.
So, I was able to create reduced move/range scenarios, but everyone who signs up to them apparently does not have the compatible content downloaded. On a further look, it seems to me that my created scenario just says 30 Years War ....., that is to say, there is no indication it comes from the reduced move/range family. I then tried to use the comment field to point this out. When I tried this, the game could not be created, and I was told I did not have the proper campaign. This seems like a bug.
Joca Ramiro
What exactly do you mean by created scenarios? Do you mean in the editor, or do you mean random map games (skirmishes)?
If you create a random map skirmish challenge in one of the reduce range "campaigns" the name of the reduced range campaign will be displayed in the tooltip when you mouse over the challenge in the MP lobby Challenges list. The other player has to also have the reduce range mod loaded to play it.
Could you explain a bit more exactly what is happening?
Richard Bodley Scott

