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



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.




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.
[11:09 pm]
Ultraviolet -- :wob:
[2024-6-12. : 6:23 am]
Ultraviolet -- got some light recalls behind too
[2024-6-12. : 12:07 am]
O)FaRTy1billion[MM] -- 🦗
[2024-6-11. : 9:53 pm]
Wing Zero -- I wonder how he knew I was in the market for a good cricket bat
[2024-6-11. : 2:27 pm]
lil-Inferno -- ya
[2024-6-11. : 10:49 am]
Oh_Man -- or scarab maybeh
[2024-6-11. : 10:49 am]
Oh_Man -- shielt battery + photon cannon blast?
[2024-6-11. : 10:49 am]
Oh_Man -- check out the animation at 7:56
[2024-6-11. : 9:06 am]
Oh_Man -- https://youtu.be/3mpjxspSUtQ I defeated the hell boss yall, bow to my power
[2024-6-10. : 5:04 pm]
lil-Inferno -- poop
Please log in to shout.


Members Online: TheProgramer, NudeRaider, Roy