Uh, its different for each unit, find hp and add 154 to the address. Note it's a 2 byte variable, so you'll read 65536 as 1/256th of energy
Ok, so i find the adress of a defiler and add 154 to it to get its energy...then what?
Typical adresses for a unit (not sure which unit, though, sorry)
623530 Previous
623534 Next
623538 dwHP
62353C Sprite
623540 wMoveToXPos
623542 wMoveToYPos
623544 target_1
623548 wCurrentXPos
62354A wCurrentYPos
62354C wX_?
62354E wY_?
623550 bMovementFlags
623552 bFlingyTurnRadius
623553 Current Direction
623554 wFlingyID
623557 bFlingyMovementType
623558 wCurrentXPos
62355A wCurrentYPos
62355C dwX_Halt
623560 dwY_Halt
623564 dwFlingySpeed
623568 dwOtherspeed
62356C dwOtherspeed
623578 wFlingyAcceleration
62357C bPlayerID
62357D bMainOrderID
62357E bMainOrderState
62357F bOrderSignal
623584 bMainOrderTimer
623585 bGroundWeaponCooldown
623586 bAirWeaponCooldown
623587 bSpellCooldown
623588 wOrderTargetX
62358A wOrderTargetY
62358C Target_Order
623590 dwShield
623594 wUnitID
623598 PlayerPrevious
62359C PlayerNext
6235A0 Subunit
6235A4 OrderQueueHead
6235A8 OrderQueueTail
6235B0 ConnectedUnit
6235B4 bNumOfQueuOrders
6235B5 bUnknowntimer
6235B8 wDisplayedUnitID
6235BE bRankIncrease
6235BF bKillCount
6235C3 bUnknown
6235C4 bCurrentButtonSet
6235C8 wQueue1
6235CA wQueue2
6235CC wQueue3
6235CE wQueue4
6235D0 wQueue5
6235D2 wEnergy
Take a look in the collapse box. You'll note that dwHP is a double word (4 bytes), and has a specific address. To convert an address into a memory condition, use the formula:
4*Player + 48*UnitID + Offset = Address. Memory condition simplifies this by using terran marine as the unitID (which is 0).
Now, since you want energy, add +154 or +0x9A to the dwHP address, then convert that. You'll note that the player number needed will be something something and a half. That means you have to read the 3rd and 4th byte. wEnergy is a word, so is only 2 bytes long. wQueue5 is in bytes 1 and 2, but they are insignificant.
Once you have your address, plug it into the formula to get the player number, or use EUDTrig. The number you need to be looking for is 2^24 * Energy. Note that the 3rd byte is hidden from the GUI, and every frame the game adds 8 to the 3rd byte, until it reaches 256, at which point, it converts into 1 energy in the 4th byte. The GUI will always round up to the nearest whole number, too, so if you have 192 energy, and a 16 in the third byte, the GUI will display 193 energy. That makes it hard to search for, though you can always use hyper triggers and set energy to a certain % to change the number. Once you get over 127 energy, you'll have to put in negative numbers, or they'll change to negative numbers, so be careful with those. SC treats them like they aren't negative though, so you can use at least/at most as if they were the whole number. See attached map for an example trigger of detecting HP, Energy, and Shields. It's the trigger that looks like this:
Conditions:
Deaths("Player 10", "UnitID:1588", At least, 3355443428);
Actions:
Set Deaths("Player 2", "Terran Marine", Set To, 1);
except I did it before the memory condition was available. the player for the memory condition would be (48*UnitID + 4*Player number)/4, so (48*1588+4*9)/4. Note that player number is 0 based, so player 1 is 0, player 2 is 1, player 10 is 9.
Uh, its different for each unit, find hp and add 154 to the address.
What if a unit has over 154 hp points?
You don't worry about it, since the number in the HP address has nothing to do with the address.
[attach=2052]
Attachments:
"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"