ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Making The YR Singleplayer Campaign Work With Your Mod

From ModEnc
Jump to: navigation, search

This page is really an expansion and enlightenment of CannisRabidus' tutorial on the subject. There is a summary at the bottom of this page for those who do not wish to read the whole document.

See also Campaign Progression



The Problem

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 (either detecting positive or negative events) cannot be completed, since the trigger conditions are never met. This means that you cannot complete a mission, or as the case my be, fail it if a certain "protect this at all costs" object is destroyed.




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 this process a reality - this is the easy way of making your mod compatible with Campaign mode.

First, you'll want to add all the buildings that Campaign mode creates to your Rules file. To save you the trouble of looking up all the mission maps that are defined, DCoder has saved us the trouble and done it for us. Now, we'll have to add them into a part of the BuildingTypes array that never changes - simply adding them after your mod's new buildings won't work. We need to re-organise the list. The current structure will most likely be the default list, then your mod's ones. You have a choice here - the default list is actually a little broken. You could stick with the current list and add on the Campaign buildings and your mod's ones, in that order. But I highly suggest you replace the default BuildingTypes list with the fixed one. I will explain this process based on the fixed list, I suggest you do too, otherwise editing some triggers later on will differ slightly.

Simply remove all of the default building entries in the list in the rules file and replace it with this one.

The next stage is to add the Campaign buildings. They will go right after the fixed entries we have just pasted in - this way they always stay in the same place in the array during a Campaign no matter how many new buildings you may create for your mod. Add these entries to the list, keeping the comments or not:

Campaign Buildings

402=CAPOWR01 ;From all01umd (Allied Mission 1)
403=CAPOWR02
404=CAPOWR03
405=CAPOWR04
406=CAPOWR05
407=CAPOWR06
408=CAPOWR07
409=CAPOWR08
410=CAPOWRAA ;From all03umd (Allied Mission 3)
411=CAPOWRAB
412=CAPOWRAC
413=CAPOWRAD
414=CAPOWRTA
415=CAPOWRTB
416=CAPOWRTC
417=CAPOWRTD
418=CAPOWRTE
419=CAPOWRTF
420=CARUS08A ;From all06umd (Allied Mission 6)
421=CARUS09A
422=CARUS10A
423=CARUS11A
424=GAPOWRA ;From sov01umd  (Soviet Mission 1)
425=GAPOWRB
426=GAPOWRC
427=GAPOWRD
428=GAPOWRE
429=GAPOWRF ;End of default/Campaign BuildingTypes


You'll also have to add the sections for each of these, but first, the new BuildingTypes that your mod brings to the game will need to be appended to the end of the list - starting from 430=. After you have done that, it's time for more code - place this anywhere in your rules file and edit at your own risk (with comments or otherwise):


Campaign Building Sections

;******* ALLIED CAMPAIGN *******
; From all01umd

; 402=CAPOWR01 start
[CAPOWR01]
UIName=Name:GAPOWR
Name=Tech01
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 402=CAPOWR01 end

; 403=CAPOWR02 start
[CAPOWR02]
UIName=Name:GAPOWR
Name=Tech02
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 403=CAPOWR02 end

; 404=CAPOWR03 start
[CAPOWR03]
UIName=Name:GAPOWR
Name=Tech03
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 404=CAPOWR03 end

; 405=CAPOWR04 start
[CAPOWR04]
UIName=Name:GAPOWR
Name=Tech04
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 405=CAPOWR04 end

; 406=CAPOWR05 start
[CAPOWR05]
UIName=Name:GAPOWR
Name=Tech05
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 406=CAPOWR05 end

; 407=CAPOWR06 start
[CAPOWR06]
UIName=Name:GAPOWR
Name=Tech06
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 407=CAPOWR06 end

; 408=CAPOWR07 start
[CAPOWR07]
UIName=Name:GAPOWR
Name=Tech07
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 408=CAPOWR07 end

; 409=CAPOWR08 start
[CAPOWR08]
UIName=Name:GAPOWR
Name=Tech08
Image=CAPOWR
TechLevel=-1
Strength=800
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 409=CAPOWR08 end

; From all03umd

; 410=CAPOWRAA start
[CAPOWRAA]
UIName=Name:GAPOWR
Name=TechAA
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 410=CAPOWRAA end

; 411=CAPOWRAB start
[CAPOWRAB]
UIName=Name:GAPOWR
Name=TechAB
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 411=CAPOWRAB end

; 412=CAPOWRAC start
[CAPOWRAC]
UIName=Name:GAPOWR
Name=TechAC
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 412=CAPOWRAC end

; 413=CAPOWRAD start
[CAPOWRAD]
UIName=Name:GAPOWR
Name=TechAD
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 413=CAPOWRAD end

; 414=CAPOWRTA start
[CAPOWRTA]
UIName=Name:GAPOWR
Name=TechTA
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 414=CAPOWRTA end

; 415=CAPOWRTB start
[CAPOWRTB]
UIName=Name:GAPOWR
Name=TechTB
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 415=CAPOWRTB end

; 416=CAPOWRTC start
[CAPOWRTC]
UIName=Name:GAPOWR
Name=TechTC
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 416=CAPOWRTC end

; 417=CAPOWRTD start
[CAPOWRTD]
UIName=Name:GAPOWR
Name=TechTD
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 417=CAPOWRTD end

; 418=CAPOWRTE start
[CAPOWRTE]
UIName=Name:GAPOWR
Name=TechTE
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 418=CAPOWRTE end

; 419=CAPOWRTF start
[CAPOWRTF]
UIName=Name:GAPOWR
Name=TechTF
Image=CAPOWR
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 419=CAPOWRTF end

; From all06umd

; 420=CARUS08A start
[CARUS08A]
Name=Russian Gum CornerA
UIName=Name:Globe
Image=CARUS08
Strength=1000
TechLevel=-1
Insignificant=yes
Nominal=yes
RadarInvisible=yes
Points=5
Armor=steel
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris3sm,Dbris9lg,Dbris2lg,Dbris8sm,Dbris3lg
BaseNormal=no
Sight=6
ClickRepairable=no
CanBeOccupied=yes
MaxNumberOccupants=5
CanOccupyFire=yes
LeaveRubble=Yes
; 420=CARUS08A end

; 421=CARUS09A start
[CARUS09A]
Name=Russian Gum MiddleA
UIName=Name:Globe
Image=CARUS09
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
RadarInvisible=yes
Points=5
Armor=steel
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris3sm,Dbris9lg,Dbris2lg,Dbris8sm,Dbris3lg
BaseNormal=no
Sight=6
ClickRepairable=no
CanBeOccupied=yes
MaxNumberOccupants=5
CanOccupyFire=yes
LeaveRubble=Yes
; 421=CARUS09A end

; 422=CARUS10A start
[CARUS10A]
Name=Russian Gum Wall N_SA
UIName=Name:Globe
Image=CARUS10
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
RadarInvisible=yes
Points=5
Armor=steel
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris3sm,Dbris9lg,Dbris2lg,Dbris8sm,Dbris3lg
BaseNormal=no
Sight=6
ClickRepairable=no
CanBeOccupied=yes
MaxNumberOccupants=5
CanOccupyFire=yes
LeaveRubble=Yes
; 422=CARUS10A end

; 423=CARUS11A start
[CARUS11A]
Name=Russian Gum Wall E_WA
UIName=Name:Globe
Image=CARUS11
TechLevel=-1
Strength=1000
Insignificant=yes
Nominal=yes
RadarInvisible=yes
Points=5
Armor=steel
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=10
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris3sm,Dbris9lg,Dbris2lg,Dbris8sm,Dbris3lg
BaseNormal=no
Sight=6
ClickRepairable=no
CanBeOccupied=yes
MaxNumberOccupants=5
CanOccupyFire=yes
LeaveRubble=Yes
; 423=CARUS11A end


;========== SOVIET CAMPAIGN ============
; From sov01umd

; 424=GAPOWRA start
[GAPOWRA]
UIName=Name:GAPOWR
Name=Tech Power A
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 424=GAPOWRA end

; 425=GAPOWRB start
[GAPOWRB]
UIName=Name:GAPOWR
Name=Tech Power B
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 425=GAPOWRB end

; 426=GAPOWRC start
[GAPOWRC]
UIName=Name:GAPOWR
Name=Tech Power C
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 426=GAPOWRC end

; 427=GAPOWRD start
[GAPOWRD]
UIName=Name:GAPOWR
Name=Tech Power D
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 427=GAPOWRD end

; 428=GAPOWRE start
[GAPOWRE]
UIName=Name:GAPOWR
Name=Tech Power E
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 428=GAPOWRE end

; 429=GAPOWRF start
[GAPOWRF]
UIName=Name:GAPOWR
Name=Tech Power F
Image=CAPOWR
TechLevel=-1
Strength=5000
Insignificant=no
Nominal=yes
Sight=6
Points=5
Armor=concrete
Explosion=TWLT070,S_BANG48,S_BRNL58,S_CLSN58,S_TUMU60
MaxDebris=15
MinDebris=5
DebrisAnim=Dbris1sm,Dbris1lg,Dbris4sm,Dbris5sm,Dbris4lg,Dbris7sm,Dbris8sm,Dbris5lg,Dbris4lg
DamageParticleSystems=SmallGreySSys,BigGreySmokeSys
Capturable=yes
NeedsEngineer=yes
Unsellable=yes
Ammo=5
LeaveRubble=yes
Power=200
; 429=GAPOWRF end


Right, now you have added all the Campaign buildings to your rules file, and your new buildings should be on the end of the BuildingTypes list. We are halfway there.

The next and final step is to edit the Campaign maps. This is where this method truly shines: you only have to do a small edit to one map. That map is the first Soviet mission. The partial reason for this is because several mission triggers refer to the same BuildingTypes that were created in earlier missions. The triggers for other maps can be left as they are. Now, I'll cut to the important part: what to edit.

Let's edit the first Soviet Mission. This is the sole mission that needs editing. You'll find it on your Yuri's Revenge disc. Use the XCC Mixer to open mapsmd03.mix and extract sov01umd.map. Open this with Notepad or whatever your favourite text editor is... and use the "Find" function to find the lines:

Default Triggers

0442A5EC=1,32,0,402
0442A4FC=1,32,0,403
0442A40C=1,32,0,404
0442A31C=1,32,0,405
0442A22C=1,32,0,406
0442A13C=1,32,0,407

Those numbers on the end are referring to the physical BuildingTypes array, not the numbers that the buildings = in your list. Indeed, in my own mod my list starts at 1 rather than 0 - yet this will not matter, the same edit is required.

Change that code to:

Edited Triggers

0442A5EC=1,32,0,424
0442A4FC=1,32,0,425
0442A40C=1,32,0,426
0442A31C=1,32,0,427
0442A22C=1,32,0,428
0442A13C=1,32,0,429

And save the map. Place it in your Red Alert 2 folder along with the rest of your mod... or place it in the [Video] section of XCC Mod Creator. You may notice that these six triggers refer to the six Power Plants buildings in the first Soviet Mission in your new BuildingTypes list: from 424=GAPOWRA to 429=GAPOWRF

That is all that needs to be done. Edits to two files. Now you'll find that both campaigns work, albeit very slightly differently. You can add as many new BuildingTypes to your mod as you like - as long as you add them to the end of your list then you will have no problems.



Summary

How to get the campaigns working with your mod - the easy way - open your rules file and replace the default BuildingTypes list with the fixed one on that page. Add the campaign buildings and their sections as in the list and Campaign building sections above. Add all your mod buildings to the end of the list, and keep in mind any new ones you create in the future will also go on the end. use the XCC Mixer to extract sov01umd.map from mapsmd03.mix (found on the YR CD). Open this file with Notepad and search for the code in the above code ("Default Triggers"). Replace that code with the code in "Edited Triggers" above. Save the map and add it to your mod...

Much better than the solutions mentioned on that tutorial page, eh?