First EUP Map
Oct 3 2014, 4:48 pm
By: sigsaucy  

Oct 3 2014, 4:48 pm sigsaucy Post #1



I'm trying to set the hp of Unit Index 1465 to 1 using Extended Unit ID 3900


The address for hp for this unit is


address = 6456296-336*index + offset = 6456296 - 336*1465 + 8 = 5964064


solving the equation (from a by placing formula)


5964064 = 48*3900 + 4*x + 5776160


we find x = 176 (this is the player number)




So I go ahead and place a dt for unit index 1465 and 2 UnitID 3900 for Player 176 but nothing is happening, whats up?

Attachments:
EUD TEST.scx
Hits: 2 Size: 61.81kb

Post has been edited 1 time(s), last time on Oct 3 2014, 5:05 pm by sigsaucy.




Oct 3 2014, 4:57 pm sigsaucy Post #2



I think i just realized whats up, the DT starts out with max hp, so by placing the Extended units im just adding HP to a already maxed out HP unit, so I won't see any difference.







I've tried to get around this by setting the HP of the dt to 5% = 4 HP at start, this means that the address for HP for the DT should be value 256*4


by adding the 2 extended units the value should now be 256*4 + 2 so that ceil( (256*4 + 2)/256 ) = 5 but this isn't working





I'm just trying to find some basic things to fool around with, but all the interesting properties seem out of reach sadly

Post has been edited 1 time(s), last time on Oct 3 2014, 7:11 pm by sigsaucy.




Oct 3 2014, 5:08 pm Roy Post #3

An artist's depiction of an Extended Unit Death

I don't have the time at the moment to check your math, but this could be the actual problem: Unit HP starts on the second byte. You'll need 256 of your extended unit to add one HP.

Starting with max HP isn't an issue: the current HP will still go up.




Oct 3 2014, 5:14 pm sigsaucy Post #4



On the offsets page https://code.google.com/p/bwapi/source/browse/trunk/bwapi/BWAPI/Source/BW/CUnit.h

it says

/*0x008*/ s32 hitPoints; // Hit points of unit, note that the displayed value in broodwar is ceil(healthPoints/256)
// Officially called "xLife"


so you're saying that in ceil(healthPoints/256) healthPoints refers to the 2nd byte?




I just tried placing 256 of them and it still didnt work

Attachments:
EUD TEST.scx
Hits: 1 Size: 30.66kb

Post has been edited 2 time(s), last time on Oct 3 2014, 5:33 pm by sigsaucy.




Oct 3 2014, 5:37 pm Roy Post #5

An artist's depiction of an Extended Unit Death

Yes: the reason you divide by 256 is because it starts on the second byte. (The first byte is a fractional value used for Zerg regeneration, I believe.)

If it's still not working, it means the math is off somewhere. Open a memory editor and verify that you're changing the correct value. Alternatively, you can use EUDGen to calculate the EUD, use EUDTrig to convert it to an address, and use EUPCalc to verify the extended unit you're using is in that list. (I'll update EUPCalc to accept a MemoryID so it isn't this huge a pain... Someday...)

If you still can't figure it out, I can verify the math later today.




Oct 3 2014, 7:04 pm sigsaucy Post #6



using a memory editor ive found the address for unit index 1465's hp to be

0x5B03C0 = 5964736

this is off from my calculation of 5964064 calculated from the formula

address = 6456296-336*index + offset

by 672


ive checked my calculation and it seems the only explanation is that the formula is wrong.

The address for unit Index 1466's hp is 336 off from 1465's so the 336*index part of the formula is right.

so it seems the value 6456296 and/or offsets listed at https://code.google.com/p/bwapi/source/browse/trunk/bwapi/BWAPI/Source/BW/CUnit.h are wrong




also when here is a list of the dt's hp and the value at 0x5B03C0 for different values



0x5B03C0 = 3024, hp = 12 with 3024/256 = 11.8125
0x5B03C0 = 4024, hp = 16 with 4024/256 = 15.71875
0x5B03C0 = 5425, hp = 22 with 5425/256 = 21.1914
0x5B03C0 = 9224, hp = 37 with 9224/256 = 36.03125


so it appears that the way HP is stored at the address is [a,b,c,d] where hp = (b + c*256 + d*256^2) + ceil(a), so that the first byte representing fractional hp isn't just used for zerg regen, but for everyone

Post has been edited 7 time(s), last time on Oct 3 2014, 9:30 pm by sigsaucy.




Oct 3 2014, 7:23 pm Roy Post #7

An artist's depiction of an Extended Unit Death

Oh true: units with armor take fractional damage, so it would make sense that the first byte is used for this.

Post has been edited 2 time(s), last time on Oct 3 2014, 9:31 pm by Roy.




Oct 3 2014, 9:01 pm sigsaucy Post #8



I assumed the offset list was correct and have come up with the formula


for index = 0
address = 5885096 + offset


for index > 0
address = 6456968 + offset - 336*index


the only thing different is the large numbers, maybe someone else can check to see if this is correct.




Oct 3 2014, 9:23 pm jjf28 Post #9

Cartography Artisan

Just confirmed that these are correct:

If index > 0    Address = 6456296-336*index + offset
Else            Address = 5885096 + offset


Will look at the rest shortly

Edit: Your start locations are at early indexes, start locations don't use indexes once loaded into starcraft (so your dark templar isn't at 1465), a good rule of thumb is to always have start locations at the last indexes when you use EUDs/EUPs.

Post has been edited 2 time(s), last time on Oct 3 2014, 9:33 pm by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Oct 3 2014, 9:33 pm sigsaucy Post #10



ahhhhhhh i see, so if you have

index 0 start locatoin
index 1 marine

in the map editor in starcraft it loads it ha

index 0 marine,


thanks!




Oct 3 2014, 9:33 pm Roy Post #11

An artist's depiction of an Extended Unit Death

(I guess I should make this its own post, rather than an edit. Also, I use this list for the unit node structure, because I find it easier to read. But that's not the issue here.)

I'm not sure where you got your formula (it's not wrong, just simplified), but from this topic, it is described as follows:
Quote from Cinolt
Unit index pointer:
u = 0: 5885096
u > 0: 6455960 - 336*(u-1)
So for index 1465, it would be:

6455960 - 336*(1465-1)
6455960 - 336*1464
6455960 - 491904
5964056

Which, in hex, is 0x5B0118. Add 0x8 for the location of health for that unit index, and you have 0x5B0120.

By the way, there's two reasons your map doesn't work. One is (as jjf mentions above) because Start Locations don't use index IDs. Your Dark Templar is actually Unit Index #1463. The other reason is because your extended units are placed before the Dark Templar, which means they'll write to the address where the Dark Templar's HP will be located, but then the Dark Templar gets initialized and sets the HP to its default.




Oct 3 2014, 9:47 pm sigsaucy Post #12



hurrah success!!!!!!!!!!!!!!!!!!!!!!!!! the dt has 5 hp!!!! thanks for all the help dudez

Attachments:
EUD TEST.scx
Hits: 2 Size: 61.96kb

Post has been edited 1 time(s), last time on Oct 3 2014, 10:05 pm by sigsaucy.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-27. : 9:38 pm]
NudeRaider -- Ultraviolet
Ultraviolet shouted: NudeRaider sing it brother
trust me, you don't wanna hear that. I defer that to the pros.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[2024-4-26. : 6:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[2024-4-26. : 6:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[2024-4-26. : 6:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[2024-4-26. : 6:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
Please log in to shout.


Members Online: Roy