Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Unit hitpoint values less than 1 / not an integer multiple of 25
Unit hitpoint values less than 1 / not an integer multiple of 25
May 24 2024, 3:43 am
By: sethmachine  

May 24 2024, 3:43 am sethmachine Post #1



According to the spec for the CHK UNIS/UNIX sections, each unit hitpoint is turned into its human readable value by dividing by 256. I've verified this with my own tools.

However I've come across something weird where SCMDraft will give units like Goliath Turrets/Tank Turrets/Sweeper Scanners (units that can never be placed) with 1 hitpoint in UNIS/UNIX section. This would translate to 1/256 HP in the game.

Is this a mistake? Should I treat any non-multiple of 256 or less than 256 as an error? Any hitpoint less than 256 can be safely rounded/fixed to 0 HP?



None.

May 29 2024, 9:25 pm Ultraviolet Post #2

We do a little trolling

Sorry no one has responded to this. Personally, I'm not sure what you're trying to accomplish here. In my experience, goliath turrets and tank turrets and scanner's hp doesn't matter because they are all not targetable units. From my understanding of the way unit HP works, I believe that values less than 256 will display as 0, but the true value is still stored in SC's memory. The fractional portion of HP is used for things like zerg HP regeneration. In any case, it shouldn't matter too much either way with the units you described since they are invincible.



My Projects:

Impossible Ultraviolet | Impossible UV 2 | Impossible UV 3
Mercenaries 2020 | Mercenaries III
Squad Defense

Legacy Projects (No guarantee of functionality in modern SC):

Pixel Adventure 2 | Space Snipers | Control the Ball

______________________________________________

Join me in Torn City

Jun 1 2024, 3:05 am sethmachine Post #3



Thanks for clarifying!

I noticed that SCMDraft would save units with 0 hitpoint to 1 hitpoint, but my code that turns hitpoints into readable values would render this a fraction, then it would be saved as 0 once written back to the UNIS/UNIX CHK section.

What's the problem? Well if you have a program that reads a SCX/CHK file into memory and make no changes, you should get the same exact SCX/CHK file back. In this case I wasn't, because of the weird 1 hitpoint being stored on units like Scanner Sweeper, etc.

How have I dealt with this...in the human readable portion, I decided to store it as a float and not integer. That way the original CHK data is preserved, even if a 1 HP value is ultimately to a 0 HP value.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:32 pm]
Zoan -- I got $2000 bonus. I would like 2000 minerals, please
[2026-4-16. : 4:15 am]
DarkenedFantasies -- you eat lots of beans
[2026-4-16. : 3:46 am]
IskatuMesk -- how do i get gas
[2026-4-15. : 11:43 pm]
Moose -- you don't
[2026-4-15. : 10:06 pm]
Zoan -- how do i get minerals
[2026-4-14. : 11:45 pm]
ClansAreForGays -- Anyone wanna played Skewed StarCraft?
[2026-4-14. : 12:07 am]
Vrael -- NudeRaider
NudeRaider shouted: Vrael ranting still is though
you're a gentleman and a scholar, thank you
[2026-4-13. : 10:07 pm]
NudeRaider -- ya why phone people when you can just write letters
[2026-4-13. : 9:37 pm]
IskatuMesk -- I have never and will never own a phone
[2026-4-13. : 9:15 pm]
NudeRaider -- Vrael ranting still is though
Please log in to shout.


Members Online: anoeth47, Roy, O)FaRTy1billion[MM]