An in-depth explanation for someone who's curious about how EUDs actually work:
When StarCraft encounters the Death condition in a trigger, it has to refer to some place in game memory that contains the death values. As you probably know all data is stored in bytes, and each death value happens to be stored in four bytes. To help StarCraft know which four bytes to pick from, all the death values are clumped together in sequential order. The first death value in this clump would be Player 1's deaths of UnitID 0 (Terran Marine), then the next would be Player 2's deaths of UnitID 0 until Player 12. From there it's Player 1's deaths of UnitID 1, etc. Here's how it would look like:
01 02 03 04 | 05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
01 02 03 04 | 05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
01 02 03 04 | 05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
01 02 03 04 |
05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
01 02 03 04 | 05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
01 02 03 04 | 05 06 07 08 | 09 0A 0B 0C | 0D 0E 0F 10
The bolded bytes are Player 2's deaths of UnitID 1 (Terran Ghost).
Each byte has a unique address that is used to identify it. The address of the first byte of the death table is 0x0058A364, and the address of the second byte would be that plus 1 (0x0058A364 + 0x1 = 0x0058A365). In case you didn't know these are numeric values like any other, they're just in hexadecimal notation and the 0x prefix is there to tell us that.
Let's say StarCraft is handling the condition "Player 2 suffered 42 deaths of Terran Ghost". First off you need to know that the player value is 0-based, meaning that "Player 1" is actually a value of 0, "Player 2" is a value of 1, etc. So in this case the player value is 1, and the unit value is 1. Studying the diagram above, we can identify that because the death data is organized so conveniently, if we add 48 (decimal) to the first byte's address (P1 deaths of UnitID 0), we'd have the address of the next UnitID (P1 deaths of UnitID 1). If we add 48 again, we'd have the deaths of UnitID 2, and so on. With that in mind, we can say that in the condition, increasing the UnitID by 1 increases the address that StarCraft checks by 48. If we increase the player value by 1, we'd add the address by 4. So, what StarCraft will do is simply take the player value in the condition and multiply it by 4, and take the UnitID value and multiply it by 48, then add them together. In this case it would solve as 52 (1*4 = 1; 1*48 = 48; 4 + 48 = 52). Then add that value to the first byte of the death table (0x0058A364 + 0x34 = 0x0058A398; remember, 52 in hex is 0x34) and that would return the address of the death value it's looking for, and would check if that value is 42.
So where do EUDs come in the picture? An EUD is simply what its name is: Extended Unit Deaths. There are only so many UnitIDs are used by StarCraft, and therefore the death table only has enough bytes to contain the deaths of those UnitIDs that StarCraft uses. So if you put in a UnitID that's bigger than the maximum UnitID contained in the death table, StarCraft will still utilize the regular formula and come up with an address of a byte that's not in the death table, but a byte that contains some other numeric value. For example, it could return the address for a unit's HP. Of course we can't plug in any old value so we have to find the address of the value you want using a memory searcher (Cheat Engine, TSearch), and with the knowledge of how StarCraft handles the death condition it's possible to figure out what UnitID/Player values to put in. EUD actions follow almost the exact procedure except you're just setting the values, not detecting them.
Post has been edited 2 time(s), last time on Apr 8 2010, 10:20 pm by yoonkwun.
None.