An artist's depiction of an Extended Unit Death
As for the reaver, the easiest way is to detect when the player spends the minerals and/or gas to create a scarab. The downside to this method is that one resource must be in a perfect monitoring state (i.e. they can't spend it on anything else).
Are you saying that, if I make a scarab cost 15 minerals, I must make sure that nothing else costs 15 minerals? I don't think this is gonna work for me because there can be multiple reavers (several normal reavers and several hero reavers). I'm gonna hafta know which one made the scarab, and then take an action.
Well, it's more like nothing else costing minerals in general. This won't retrieve the specific Reaver, so it's not the solution you want.
Also, that offset stuff went over my head. Does it only matter for unit data? because right now I'm just trying to read the screen coordinates, so i think i'll ignore all that.
No, you need it for any memory address. I believe X positioning doesn't have an offset, but Y does. So, to check a specific (X, Y) point, you would need to check values (X, Y*65536). To check the point (
12,
15), for example, the conditions would look like:
Memory at 192342 is exactly
12.
Memory at 192343 is exactly
983040. (15*65536)
Or:
Player 9 has suffered exactly
12 deaths of UnitID:2184
Player 10 has suffered exactly
983040 deaths of UnitID:2184
*The address values aren't actually for X and Y positioning in these examples, so ignore the address values such as the UnitID; I made them up.
6. How do detect when a reaver builds a scarab? Must allow for multiple reavers per player.
What Apos suggested is one option, if attacking is not a problem.
Again, EUDs are a viable option. There is a memory address for each unit's hangar count. Problems with this method:
1. Reavers must be pre-placed or otherwise have a predetermined unit index.
2. The condition will fire, but you'll have no actual point of reference to the actual Reaver that built the scarab. This is not a problem if you have them in confined areas, as you can tell based on ID which one built a scarab.
7. How do you toggle cloak for any unit? I wanna create a carrier and then cloak it.
Disable doodad state (More specifically, D-E-E, or Disable-Enable-Enable), like Apos said, is your best option; it doesn't work for all units, and I don't remember if the Carrier is one of the successful ones. Once the unit is cloaked, it is impossible to uncloak, so you'll need to replace the unit entirely if you want it to become visible again.
You could also use invincible Arbiters that do nothing but follow the unit, but that's not a very good option.