Making The YR Singleplayer Campaign Work With Your Mod
This page is really an expansion and enlightenment of CannisRabidus' tutorial on the subject.
See also Campaign Progression
When making a mod for YR (and indeed, for RA2 as the case may be) there will come a time when the playability of singleplayer Campaign mode comes into question. Most mods simply ignore this game mode. However, it can prove to enhance a mod.
Unfortunately, due to the structure of the game, simply adding any new BuildingTypes to the list in the Rules(md).ini file will actually prevent players from being able to accomplish missions in Campaign mode. This is due to the fact that quite a few of the campaign maps (a single mission) define their own BuildingTypes and actually append them to the end of the list in your rules(md).ini file. This list will remain the same throughout Campaign mode even if you save the game and load it later - meaning that the list will never be overwritten by other BuildingTypes; rather, the list will simply grow larger towards the end of the Campaign saved game.
Now, the way missions are completed is through the use of triggers which detect when the player performs a certain task; e.g. has destroyed X unit, or captured all X buildings. These triggers are what lets the player actually complete a mission. Some of these triggers are based on BuildingTypes - the buildings that the map defines. At least that is the intention. Fact is, when a mod adds new BuildingTypes, it effectively means that the newly defined buildigns in Campaign maps are added to the end of the list - and stupidly enough, the triggers that rely on buildings being captured/destoryed etc. are coded to only refer to the end of the (unmodded) BuildingTypes list: entries 402 - 429 (assuming that you are modding YR and you have replaced the default BuildingTypes list with the fixed one, found on that very page). It is important to remember that the numbers next to each of the BuildingTypes are irrelevant - only the order of the list matters. For more information, take a look at How Object Arrays Work.
This means that any new buildings your mod adds on will be read by the Campaign map triggers. And of course, they are not the correct buildings (the correct ones will be appended AFTER your own BuildingTypes). Hence, missions that rely on triggers relating to buildings cannot be completed, since the trigger conditions are never met.
The tutorial above offers solutions that work, but are are arguably limited or impractical, depending on the situation. However, there is a debatably much better way to make Campaigns work with your mod.
One might assume simply adding the campaign BuildingTypes to your Rules(md).ini file should fix this. However, that is only half the solution.
DCoder, with testing by Whiteboy and HopalongTom within a development stage of the "Whiteboy's Rules" mod have made the process of making Campaign mode work with your mod a reality.
[Page still in progress]