Command & Conquer™ Remastered Collection

Command & Conquer™ Remastered Collection

CFE Patch Redux
Tweaking your mod for personal preference questions
Hi Chthon:

I have managed to compile a version of your mod tweaked for my personal preferences without any compile errors occurring, thanks to following your compiling guide on your GitHub page for the mod, and also following the other guidance you gave me when you answered those questions I asked recently in the mod's comments section.

I'm currently in the process of testing the tweaks I have made, and I've noticed a few things that confuse me, which after noting what you said about C++ and how Westwood coded the game back in the day, still make little sense, all the same.

First up, I wanted to have GDI have access to the Bazooka soldier in scenario/mission 3, not scenario/mission 8 like in the unmodded vanilla game. Problem is that the Bazooka soldier is available to build right from the beginning in GDI scenario/mission 1, even though I have edited the IDATA.cpp file to make it that I only want it available from GDI scenario/mission 3 onwards, so that has confused me. I also edited the HOUSE.cpp file to allow the Bazooka soldier to be available earlier, but I didn't change the minimum mission unlock value, so that might be why it is appearing 2 missions earlier than I wanted.

Also, I wanted the Guard Tower to be available in GDI scenarios/mission 2 and onwards too, yet the Guard Tower is not appearing as available to build in the buildings tab in GDI scenario/mission 2 despite me altering the BDATA.cpp file to make it available from that scenario/mission onwards. I made it that it only requires the Power Plant for its building prerequisite, as well as Tech Level 1, the lowest tech level requirement in the game, yet it still isn't appearing in the buildings menu in that scenario/mission.

Ironically, the sandbag wall is appearing as buildable in GDI scenario/mission 1, as I wanted, and nothing appears to be any different in terms of what I changed between the values for the sandbags and also for the Guard Tower in the BDATA.cpp file, so I have no idea why my change to its scenario availability worked for the sandbags but not the Guard Tower.

I also noted that the building gap change I made in the mod's INI file hasn't taken effect either, as I'm still only having a 1 tile gap between buildings when I want to be able to build them as far as 5 tiles apart.

Re-enabling the mod in the game's options menu after making changes to the DLL doesn't make any difference, the changes I have made are still not applying even after I re-enable the mod, with the exception of the sandbag wall changes. The only thing I can think of is if I delete my mission progress, but I doubt that it would make any difference given I didn't have to do that for changes I made in the NCO mod's Rules INI file.

There are quite a few other tweaks I have done that I haven't yet tested properly, so I will post about anything else that doesn't seem right that I find, once I have tested these other tweaks.

Any insight into how I can resolve these issues? I will keep experimenting in the meantime, hopefully finding the solution myself, and if/when I do I will make a note on what the solution was, for future reference.
Last edited by Cobber [1st M.I.]; 12 Apr, 2022 @ 1:33am
< >
Showing 1-15 of 21 comments
Cobber [1st M.I.] 12 Apr, 2022 @ 2:33am 
In terms of the files I have made changes to, and what those changes are, I have changed only the relevant numerical or true/false values in the files AADATA.CPP, BDATA.CPP, CONST.CPP, HOUSE.CPP, IDATA.CPP, TYPE.H & UDATA.CPP files, for units/structures that I wanted to change values on for my personal preferences. Changes include things like increasing storage capacity of silos and refineries, increasing the value of a full tiberium load that each harvester collects, making the medium tank accessible earlier and also usable by NOD, allowing earlier access to the Guard Tower and allowing NOD to also build it, allowing the building of transport helicopters by both factions, larger amount of power at both types of power plant etc.

So based on fact that it is primarily only values changes I have made, I believe it isn't something that I have done to the lines of code themselves, because I haven't really actually altered them (aside from some minor adding of spaces to make the lines in CONST.CPP easier to read for the changes I made to the weapon ranges of the different weapon systems in the game, like the sniper rifle for example, or making a few things (MTANK, GTWR, SAM) accessible to both factions that previously were only available to one, or the other), nor have I deleted any of them.

I will continue to look at the code, and INI, to see if I can resolve the issues I am having with the building gap and veterancy functions, but any input or suggestions you may have Chthon will be welcomed, cause this is something that you are far more familiar and knowledgeable with than I am.


Update (12 April 2022):

With further thinking, and testing, I've resolved the issues with the Bazooka soldier and the Guard Tower that I mentioned above, but the building gap change is still not working.


Update (13 April 2022):

I'm still only getting a 1 tile gap, and I can't build off of the sandbag wall either despite having the INI settings correctly changed as per the GitHub webpage's instructions, plus changing the false values to true in the EXTERNS.H file to reflect those settings as configured in the INI file hasn't made any difference to those functions working as desired, or even at all. Subsequently realised I shouldn't have altered anything in the EXTERNS.H file so I have returned that file to its default state and updated my tweaked DLL accordingly, but even after correcting that mistake I am still finding that the Veterancy system is refusing to work with my tweaked DLL file when it's replacing the mod's default DLL.


Update again (14 April 2022):

No progress on getting the building gap INI changes working for me. It's still only allowing a 1 tile gap regardless of what values changes I make to the INI file, even before I make the personal preference tweaks that I want to make. And I'm also noticing that the Veterancy system doesn't appear to like me making the personal preference tweaks I've been making either, as it is also not working once I compile the changes. Thing is, I haven't altered the actual source code or other DLL code lines at all, as outlined above.

Update again (15 April 2022):

Setting the INI's entry for BUILDING_GAP= to 1, and VETERANCY= to 0 made no difference either. I was still able to build with a gap of 1 tile, which was not meant to be possible with that setting, and the Veterancy being turned off in the INI didn't seem to make any difference compared to if I have it turned on in the INI for the issue I reported above.

I know setting it to 0 meant Veterancy was technically turned off, but I was kinda hoping it would somehow have had the opposite effect and mysteriously caused it to in fact be turned on, but clearly that idea didn't work, which logically makes sense anyway.

Update yet again (late 15 April 2022):

Discovered I had been editing the wrong INI file the whole time, and once I edited the correct 1 the building gap issue outlined in the above entries has been resolved, but I am still finding that the Veterancy system is not working, so clearly something I have edited in the DLL has caused that issue, but I touched nothing that was obviously linked with the Veterancy system when making my preference tweaks so for the life of me I cannot think of or find what the cause of the Veterancy issue is.
Last edited by Cobber [1st M.I.]; 15 Apr, 2022 @ 4:41am
Cobber [1st M.I.] 12 Apr, 2022 @ 2:53am 
Also, something I forgot to ask earlier, how can I change the total amount of Tiberium a harvester can hold, as well as the value per bail/scoop of Tiberium it collects? Just in case I decide I want to change those values in future.

Update (14 April 2022):

You can disregard that harvester capacity question, I've found the relevant file and the relevant part within it to make that desired change. The code is located in the Type.H file beginning at line 869.

I only increased the value per bail from 25 to 30, causing the harvester to collect a total value of 840 credits worth of tiberium per load, up 140 from the default 700 credits worth of tiberium.
Last edited by Cobber [1st M.I.]; 14 Apr, 2022 @ 9:09pm
Chthon  [developer] 18 Apr, 2022 @ 6:05am 
I've got a guess what's going on. In the master branch on github, a few of the ini entries have been moved from "features" to "settings" to make them 3-way toggles. Veterancy is one of these. (See the draft patch notes for the latest test build.) Try deleting C:\Users\<YOU>\Documents\CnCRemastered\Mods\Tiberian_Dawn\CFEPatchRedux\CCDATA\DEFAULT.CFEPATCHREDUX.INI and replacing it with the version on github.
Cobber [1st M.I.] 18 Apr, 2022 @ 1:34pm 
Awesome, thanks for the response and info, I will give it a try when I get the chance to and I will let you know how it goes.
Cobber [1st M.I.] 19 Apr, 2022 @ 4:25pm 
Something else I'd like to do with this mod is be able to add 1 or even 2 passenger slots to Light & Medium tanks for 'gunners'. How do I go about making that work in the DLL? I know from looking at the files that it's more than just UDATA.CPP that will need to be edited, but I'm not 100% sure how to edit the code in that file to work specifically for just those 2 tanks, separate from the APC & Chinook helicopter.

In the Veterancy mod it's easy to do in that mod's main rules ini file, but obviously this mod's ini file functions very differently to the Veterancy mod one and is not designed to work the same way.
Chthon  [developer] 19 Apr, 2022 @ 6:50pm 
I don't know how exactly the Veterancy & More mod does this, since its author is an scofflaw who flouts the GPL and refuses to release his code despite being legally obligated to do so. But here's the general idea:

First, set IsTransporter to true in UDATA.CPP. And tweak Max_Passengers() in TECHNO.CPP to give a different answer for tanks. You might have to do something to deal with the door open/close logic in UNIT.CPP and maybe some other scattered stuff that just expects APCs are the only ground transport type. (This might require a lot of debugging and searching, or maybe none.)

Now, the hard part is making the passengers shoot. I can think of 3 ways to do this. The first is likely the best.
Option A: Clone the tank unit type to a new unit type for the tank+gunner. Give it the machine gun as a secondary weapon. Then hot-swap the tank's unit type during the passenger load and unload operations. If you want to do the RA2 thing with different infantry resulting in different weapons, you'll need multiple clones. See the Nuke Tank tutorial for how to do this.
Option B: Add some logic to the tank's AI loop to check for when the gunner should fire. When that happens, create an invisible unit with a machine gun at the tank's location to do the actual firing, then destroy it once it fires. (This is how the vortex in RA works.)
Option C: Same as B, but unlimbo the actual infantry unit at the tank's location in an invisible state, then relimbo it after it fires.

Aside: If you're going to do serious digging around to find "everything that touches X," you need a search tool for that. On Linux, grep is ideal. Assuming you're using Windows, you should find yourself a grep alternative.
Cobber [1st M.I.] 19 Apr, 2022 @ 10:14pm 
Thanks for the response, clearly it's not going to be easy to do regardless of which option I explore. I'm guessing it would be just as difficult to create the code to get a 2nd (free) harvester spawned whenever myself or the AI build a new refinery too.

And I'm well aware of the Veterancy mod's author being noncompliant with the license requirement to upload his sourcecode, something that is deplorable to me too. That non-compliance is just one reason why I'm wanting to learn how to do these personal preference changes for my personal use using your mod's structure and architecture, because A) you're helping me by willingly answering my questions, which I truly do appreciate, B) your mod is well balanced as a result of the work you and your predecessors have put into developing it, and C) that Veterancy mod could be shut down at any moment for that non-compliance which would therefore eliminate it as a viable alternative to use instead of the NCO mod, which doesn't seem to be being developed any more.
Chthon  [developer] 19 Apr, 2022 @ 11:59pm 
A second free harvester is dead easy. Look at BuildingClass::Grand_Opening() in BUILDING.CPP. You'll want to use Scan_Place_Object() for the second one to make sure it finds a valid cell to spawn in. See MapClass::ProcessTiberiumDeath() in MAP.CPP for an example of that.
Cobber [1st M.I.] 20 Apr, 2022 @ 12:37am 
Mate, you're awesome, thanks again for the help!!! I will let you know how things go with these different changes I want to make for my own personal preference; so far your instructions about using the test version of the mod's INI to see if that would help in resolving the Veterancy issue I was having seems to have worked a charm, though I will do some more testing to be sure.
Cobber [1st M.I.] 20 Apr, 2022 @ 2:29am 
For getting a 2nd harvester to spawn at a new refinery, should I copy & paste the code from MAP.CPP for MapClass::ProcessTiberiumDeath(), and then change the references in there to harvester from viceroid?

Or do I replicate the code from BuildingClass::Grand_Opening() in BUILDING.CPP but then incorporate the Scan_Place_Object() code in the replicated BuildingClass::Grand_Opening() code to replace the original code?

I've been looking at the code in both files that you directed me to look at, but I'm not sure which approach to take in making this desired change work, or which is the better approach to take, and I'm hesitant to change anything lest it causes all sorts of unforeseeable problems. I always back up files before I edit them, but even then I'm still hesitant to actually add new code or change the code's structure, without having a very clear idea of what to do anyway.
Chthon  [developer] 20 Apr, 2022 @ 6:52am 
Following the closing brace of the else clause on line 3455, try something like this:

unit = new UnitClass(UNIT_HARVESTER, House->Class->House);
if (unit) {
if (!Scan_Place_Object(unit, Coord_Cell(Center_Coord()))){
House->Refund_Money(unit->Class->Cost_Of());
delete unit;
}
}
else {
House->Refund_Money(UnitTypeClass::As_Reference(UNIT_HARVESTER).Cost_Of());
}

Also, be aware that you're creating a situation where AI players can sell back a $2000 investment for $3400 and human players can sell it back for $1700. If that causes balance problems, you might need to change the price on something or alter the resale logic.
Cobber [1st M.I.] 20 Apr, 2022 @ 2:19pm 
Excellent, once again you are awesome, thanks so much for the help you've given me in seeking to do these preference changes, I truly do appreciate it!!!
Cobber [1st M.I.] 21 Apr, 2022 @ 5:08am 
Another question I've just realised I needed to ask, after doing some play testing of the preference tweaks I've made so far:

How can I get the AI to rebuild buildings in missions where otherwise it is coded to not rebuild them?

For example, in GDI mission 7A, Destroy the Airfield, if you destroyed the airfield in the previous commando only mission, the AI won't rebuild it, or anything else for that matter, preventing it from training new vehicles, or rebuilding defensive structures after you have launched an attack but not broken through, when it otherwise has the resources to do so.

I noticed it would train new replacement harvesters and other vehicles if you didn't destroy the airfield in that previous mission, but it would not rebuild structures, like turrets or even the refinery for example, even if you did not destroy the Con Yard in that commando only mission.

Again, thank you for your guidance and willingness to help, it is fantastic and I really appreciate it, especially as I know from reading comments in the comments section that you are doing this mod in your spare time in between your family and work commitments.
Chthon  [developer] 21 Apr, 2022 @ 6:42am 
From start to finish:
1. When the mission is loaded, the [BASE] section of the ini file is read out to make a list of nodes and associated cells and building types. See BASE.CPP
2. Specifically for GDI 7, whatever building was sabotaged is deleted, and then the associated node is also deleted. This is handled in SCENARIO.CPP
3. The AI player's logic in HOUSE.CPP periodically scans the node list for the first node that doesn't have a building on its cell, and then tries to rebuild the associated building. (Side note: It doesn't care about who owns the building. If it's in the list, the AI will rebuild it.)

So, if you want to make the AI rebuild something, you need to add it to the node list somewhere. You could edit the mission file. Or you could add a one-time scan for enemy buildings that don't have nodes and give them one. If you want to change GDI 7, you need to dink with the special code that's deleting the node.
Cobber [1st M.I.] 22 Apr, 2022 @ 3:11am 
Excellent, once again you're simply awesome for helping me!!! I will have a look at those files, in between my currently very busy work commitments, to see what I can learn from applying the directions and the advice you've given me, and I will keep you posted on what I manage to achieve with my tweaks.
< >
Showing 1-15 of 21 comments
Per page: 1530 50