Special Attacks: "A rat's nest of unparalleled proportions":
That's a pretty strong statement, I'm sure you'll agree, but is it accurate? Well, let's take a close look at the "Soothsay" attack which is performed by religious units and causes unhappiness in the target city. Looking at just one example, here's the pertinent code for the "Cleric" as listed in units.txt:
Seems pretty straightforward. The "Sound" section points toward the sounds.txt file and sure enough there's a listing for SOUND_ID_CONVERT_CITIES_CL and the associated wave file. That particular file (a thunder clap) is used in a number of places, so for test purposes I subbed in the "elephant" sound, so we can be certain that things are working as indicated.
Next we'll look at the effect (SPECEFFECT_CONVERT_CITIES), which can be found in two files. "SpeceffectID.txt" lists the number of the sprite (similar to the way "newsprite.txt" assigns numbers to unit sprites) while "specattack.txt" assigns both sound and sprites to various special attacks. Which certainly seems superfluous, since that is ALSO being done in units.txt.
Strange, but...whatever. We run a test and have the Cleric "soothsay" in a foreign city. And the sprite we see is NOT the "clouds-with-sunbeam" convert city effect, but rather a puff of blue smoke. And the sound is NOT the elephant but rather....no sound at all! What?
Weird. Well, looking again at the "perhaps-not-superfluous-after-all" specattack.txt file, it does have a listing for the "Soothsay" special attack:
Maybe that's what's controlling this? So I change both settings to match the Cleric listings in units.txt, and NOW we'll certainly hear the elephant and see the clouds-and-sun, right? Wrong. Blue smoke & silence.
Ooooh boy. So, looking once again at the Cleric entries in units.txt, we see there's a rather odd special attack called "CauseUnhappiness". There aren't ANY buttons for ANY units for this particular attack, but it IS the end result of a "Soothsay" attack. And sure enough, there is a listing for this in specattack.txt:
So once again I copy in the Cleric's soothsay settings from units.txt, and FINALLY it works. Clouds-and-sunbeams and the triumphal cry of the elephant. So what does that mean? Well this for one: The special attack links for sound and sprites in units.txt DO ABSOLUTELY NOTHING. And not just for Soothsay...for EVERY special attack. In fact, Special Attack sound and sprite effects (to the extent you can control them at all - and for some you can't) are entirely controlled by the settings in specattacks.txt. Period.
But wait! It gets worse! As you saw, even though "Soothsay" IS a Special Attack and IS listed in specattacks.txt, the effects are actually controlled by CAUSEUNHAPPINESS. Which is also true for the "Advertise" Special Attack. Meaning that you have a Commercial AND a Religious attack, and both will play the identical sprite and sound, and there is literally nothing you can do to separate them. Kill.me.now.
If this were the only oddity in the bunch, well, OK. But it's not. It turns out that all the Special Attack messages are launched from Script.slc, and EVERY ONE OF THEM is hard coded in the executable. Not the text itself, but the fact that a success or failure message even exists. If you add new ones? They don't play. And why do some message texts have code that indicates the location of the attack or the unit which launched it while others are just text? Surely you can stick that same code in other messages, right? Wrong. The ability of some messages to handle code (and only certain kinds of code) is buried somewhere in the executable. What about new special attack cursors? Sorry, the game allows numbers 1 to 89, and that's it. New messageicons? Sorry again, there's 106 entries in that file and no more are allowed, nor can you reference any special attacks other than those which are listed, EVEN IF THEY EXIST.
All that said, it's true that most of the special attacks work as intended. Sprites, Sounds, Cursors, Button Icons, Messagicons & Messages all exist or can be modified. And for those which are problematic (like our good friend "Soothsay") there are workarounds being tested and tested and tested again. And then there's the whole issue of whether the AI will build the special units and perform the special attacks. Which is a whole other animal...
That's a pretty strong statement, I'm sure you'll agree, but is it accurate? Well, let's take a close look at the "Soothsay" attack which is performed by religious units and causes unhappiness in the target city. Looking at just one example, here's the pertinent code for the "Cleric" as listed in units.txt:
Code:
CanSoothsay { Sound SOUND_ID_CONVERT_CITIES_CL Effect SPECEFFECT_CONVERT_CITIES }
Next we'll look at the effect (SPECEFFECT_CONVERT_CITIES), which can be found in two files. "SpeceffectID.txt" lists the number of the sprite (similar to the way "newsprite.txt" assigns numbers to unit sprites) while "specattack.txt" assigns both sound and sprites to various special attacks. Which certainly seems superfluous, since that is ALSO being done in units.txt.
Strange, but...whatever. We run a test and have the Cleric "soothsay" in a foreign city. And the sprite we see is NOT the "clouds-with-sunbeam" convert city effect, but rather a puff of blue smoke. And the sound is NOT the elephant but rather....no sound at all! What?
Weird. Well, looking again at the "perhaps-not-superfluous-after-all" specattack.txt file, it does have a listing for the "Soothsay" special attack:
Code:
SOOTHSAY { SoundID SOUND_ID_CAN_SOOTHSAY SpriteID SPECEFFECT_CAN_SOOTHSAY }
Ooooh boy. So, looking once again at the Cleric entries in units.txt, we see there's a rather odd special attack called "CauseUnhappiness". There aren't ANY buttons for ANY units for this particular attack, but it IS the end result of a "Soothsay" attack. And sure enough, there is a listing for this in specattack.txt:
Code:
CAUSEUNHAPPINESS { SoundID SOUND_ID_CAUSE_UNHAPPINESS SpriteID SPECEFFECT_CAUSE_UNHAPPINESS }
But wait! It gets worse! As you saw, even though "Soothsay" IS a Special Attack and IS listed in specattacks.txt, the effects are actually controlled by CAUSEUNHAPPINESS. Which is also true for the "Advertise" Special Attack. Meaning that you have a Commercial AND a Religious attack, and both will play the identical sprite and sound, and there is literally nothing you can do to separate them. Kill.me.now.
If this were the only oddity in the bunch, well, OK. But it's not. It turns out that all the Special Attack messages are launched from Script.slc, and EVERY ONE OF THEM is hard coded in the executable. Not the text itself, but the fact that a success or failure message even exists. If you add new ones? They don't play. And why do some message texts have code that indicates the location of the attack or the unit which launched it while others are just text? Surely you can stick that same code in other messages, right? Wrong. The ability of some messages to handle code (and only certain kinds of code) is buried somewhere in the executable. What about new special attack cursors? Sorry, the game allows numbers 1 to 89, and that's it. New messageicons? Sorry again, there's 106 entries in that file and no more are allowed, nor can you reference any special attacks other than those which are listed, EVEN IF THEY EXIST.
All that said, it's true that most of the special attacks work as intended. Sprites, Sounds, Cursors, Button Icons, Messagicons & Messages all exist or can be modified. And for those which are problematic (like our good friend "Soothsay") there are workarounds being tested and tested and tested again. And then there's the whole issue of whether the AI will build the special units and perform the special attacks. Which is a whole other animal...
Comment