A few days ago, I got a really interesting private message from Mr_Killt on the Command & Conquer Communications Center forum, about some special code in the game. I thought the stuff I wrote up about it might be worth sharing with the rest of you.
Mr_Killt wrote:I was playing some original TD missions today and I'm curious about some stuff. Examining scb10ea in particular (the one where you have to kill Dr. Chan) I saw how you blow up the tech center and Chan pops out ready to be sniped. Upon looking at the .ini file, I saw no mention of him under the [Infantry] section, but only in the [Triggers] section:
Also, when you move your cursor it specifically says 'Dr. Chan' instead of the usual 'Scientist.'
So is this something built into the game (like the passive ORCA on scb07ec) or something that can possibly be reproduced in another mission? I know you've enabled the 'passive helis' thing for future use but I was just curious about this and was wondering what other aspects of the game are arranged in this manner?
I'll start with the name changing thing. That was code I added myself. Originally, he was always called "Civilian". Since there is already special code for calling the Technology Center "Prison" on Nod mission 3, I copied that to make the Chan unit show his real name only on Nod mission 10, and be called "Scientist" otherwise. The "Scientist" thing is completely added by me. The string didn't exist in C&C before my patch. Note that enabling the "TrueNames" option to show all civilian names (either in rules.ini or in the mission file) will also make the game show the real name instead of "Scientist".
As for the triggers... when playing a custom campaign one day, I noticed that Chan spawned from a destroyed tech center on a mission replacing Nod mission 10. After testing this some more, it turned out this happens only on Nod mission 10. On further examination inside the exe file, I also found special code to immediately link that spawned "CHAN" unit from the tech center to a trigger called "CHAN", which would allow for a really beautiful chain of events of first destroying the tech center, then killing Dr. Chan, and only then winning the mission. Normally, this kind of mission code is impossible for units spawned from destroyed buildings, just like triggers can't be linked to reinforced units.
The silly part is, none of that code was used. The mission designer just put a Chan unit next to the tech center, and linked a trigger to him that wasn't even called "CHAN", but just "WIN". Even worse, there was a "CHAN" trigger, but it was just the flare to reveal the island. One of the more bizarre side effects of this was that destroying the Tech Center would give you two Dr. Chans; one linked to the winning trigger, the other (uselessly) linked to a flare trigger (which is normally already activated at that point anyway).
On top of that, there was another trigger in the mission that didn't work as it should, namely one that should reinforce a chinook to get your commando onto Chan's island.
I concluded the mission was simply severely broken, and fixed all that. So now the mission works exactly as it was intended, with the special systems they'd built for it :)
I never really considered making this particular behaviour into a special option, though, mostly because it's so very, very specific. Also, technically, they're two completely separate exceptions, namely one to spawn Chan from the destroyed tech center and link him to trigger "CHAN", and the other to change the unit's name in that mission.
Now, let's look deeper into the game. There are indeed a ton more of these oddities in it that are caused by special code made for specific missions, and even some special behaviour code that works in all missions. So let's list all other such systems we can find in the game.
Exceptions on single missions:
- The already-mentioned "Prison" name for the tech center in Nod mission 3.
- The mission-skipping code in GDI mission 6 if you blow up the correct building.
- A special logic to remove the building you destroyed in GDI mission 6 from GDI mission 7, if you didn't target the correct building. Note that this only works for buildings without duplicates, since it works by building type, not by actual building. This code allows you to start mission 7 with an enemy base that doesn't have a construction yard or refinery at the start. Pretty useful to know :)
- The Nod stealth tank mission (11) has special code to add the Tech Center to the prerequisites of the Stealth Tank, so you can't build Stealth tanks unless you capture the Tech Center.
- In GDI mission 9, gunboats can't shoot. They're sitting ducks for an Obelisk that insta-kills them. I tested this once, by getting rid of the Obelisk before the gunboats arrived. They didn't shoot at anything.
There are more, though. Systems that aren't really specific to one mission, but still affect the game in a rather unexpected way:
- The Obelisk laser kills gunboats in one shot, despite not actually doing enough damage for that. I'm not sure if this was specifically incorporated for GDI mission 9, though, since it works in all missions, and helps quite a bit in the Nod missions too. Internally, the function for letting units take damage literally says "if the unit is a gunboat, and the weapon is laser, don't bother calculating damage, jump straight to the Death code." I guess they aim for the waterline ;)
- There are several exceptions that make Nod's tech tree differ from GDI's to compensate for the fact Nod has less missions. Capturing Nod stuff gives you these level advantages. For this reason, building a Hand of Nod in GDI mission 2 gives you engineers, and the same applies to Bazookas in mission 3. Another example is the Advanced Power Plant. Its original build level is 13, which would only give them to Nod on the very last mission.
- The game originally tasked you to collect all steel crates in the Nod campaign. You would only get a nuke if you found them all. Some of them are hidden under buildings, which means you could miss them by capturing these instead of destroying them. They removed this system in patch 1.19 (back in DOS C&C) because it didn't seem to save reliably in savegames or something, and, notably, prevented any player owned Temple of Nod in The Covert Operations from giving nukes.
And then, of course, there are the exceptions I freed from their hardcoding with my patch:
- The Advanced Comm Center was always capturable, but special code on the mouse cursor modifying prevented players from giving that capture command in single play, except on mission 12. This was rather weird, since it not only allowed capturing of GDI's superweapon in multiplay, but also meant that in single play, enemy engineers could capture your ACC, and you wouldn't be able to capture it back. I made it completely uncapturable, and added a system to custom change the capturability of any building in a mission.
- The passive helis for Nod mission 7, which Mr_Killt already mentioned. Normally, the 'Guard' command for AI helicopters gets replaced by 'Area Guard', to make them protect the area around where they are landed. In Nod mission 7, this was disabled to allow the player to capture an ORCA fighter on the helipad. This has now been moved to a "PassiveHelis=True" key that can be added in any mission.
- The secret Funpark mode, which unlocked the dinosaur missions, had a logic that would change the minimap colour of house "Special" from yellow to red, to make them more visible on the minimap. I removed that, and instead replaced it by an entire system to swap colours of houses at will in missions. This new system was also used to change the colour of GDI and Nod in the dinosaur missions to the original player colour, gray.
- The Funpark mode also forced the player's radar logo to the JP one, which, internally, is actually the logo of the "Special" house (which is used for the enemies in the dinosaur missions). I made a "RadarLogo=" option for missions which can be set to force any logo on the player, even custom added ones. A little known fact: I snuck the logos "EA" and "WW" into the game with my patch ;)
That's all I can think of, for now. There's a lot of other special code in the game, of course, that isn't specifically related to missions. The Funpark mode alone was so full of horribly malfunctioning special code that it makes my head hurt to think back to it. But that wasn't the topic for this particular feature, so, I guess we're done here.