Staredit Network > Forums > SC1 Mapping Tools > Topic: [SOLVED] Accessing unit data
[SOLVED] Accessing unit data
This topic is locked. You can no longer write replies here.
Jul 28 2010, 1:59 am
By: jhuni  

Jul 28 2010, 1:59 am jhuni Post #1



I need some way to access the data on all the units on the map and dump it into a text file, that way I can recreate those units with triggers. For example, the text file might be like:

Quote
(50, 94, "Player 1", "Zerg Zergling")
(170, 1110, "Player 2", "Terran Civilian")
(219, 1081, "Player 2", "Terran Civilian")
(689, 1084, "Player 7", "Terran Supply Depot")
(1025, 1687, "Player 7", "Terran Supply Depot")
(1792, 1856, "Player 8", "Terran Marine")

Then I could use that data to generate triggers to create those units...

Is there some sort of editor/tool that does this?

Post has been edited 1 time(s), last time on Jul 29 2010, 3:57 am by jhuni.



None.

Jul 28 2010, 2:13 am Cinolt Post #2



Are these units preplaced or ones currently in the game? I doubt a program exists for either that exports into a text file, but for the former you can see a similar list by selecting any unit and pressing enter in SCMDraft 2.



None.

Jul 28 2010, 2:45 am rockz Post #3

ᴄʜᴇᴇsᴇ ɪᴛ!

Open map in winMPQ.
Extract scenario.chk.
Open Scenario.chk in a hex editor (like HxD)
Search for string "UNIT".
Quote from oldwiki
"UNIT" Section
Required for all game types (vanilla, hybrid, broodwar)
This section contains all the pre-placed units on the map and their properties. Each unit on the map gets the following structure:

* 4 byte long: The unit's class instance (sort of a "serial number")
* 2 byte integer: X coordinate of unit
* 2 byte integer: Y coordinate of unit
* 2 byte integer: Unit ID
* 2 byte integer: Type of relation to another building (i.e. add-on, nydus link, etc.)
* 2 bytes: Flags of special properties which can be applied to the unit and are valid:
o Bit 0 - Cloak is valid
o Bit 1 - Burrow is valid
o Bit 2 - In transit is valid
o Bit 3 - Hallucinated is valid
o Bit 4 - Invincible is valid
o Bit 5-15 - Unused

* 2 bytes: Out of the elements of the unit data, the properties which can be changed by the map maker:
o Bit 0 - Owner player is valid (the unit is not a critter, start location, etc.; not a neutral unit)
o Bit 1 - HP is valid
o Bit 2 - SP is valid
o Bit 3 - Energy is valid (unit is a wraith, etc.)
o Bit 4 - Resource amount is valid (unit is a mineral patch, vespene geyser, etc.)
o Bit 5 - Amount in hangar is valid (unit is a reaver, carrier, etc.)
o Bit 6-15 - Unused

* 1 byte: Player number of owner (0-based)
* 1 byte: Hit points % (1-100)
* 1 byte: Shield points % (1-100)
* 1 byte: Energy points % (1-100)
* 4 byte long: Resource amount
* 2 byte integer: Number of units in hangar
* 2 bytes: Unit state flags
o Bit 0 - Unit is cloaked
o Bit 1 - Unit is burrowed
o Bit 2 - Building is in transit
o Bit 3 - Unit is hallucinated
o Bit 4 - Unit is invincible
o Bit 5-15 - Unused

* 4 bytes: Unused
* 4 byte long: Class instance of the unit to which this unit is related to (i.e. via an add-on, nydus link, etc.). It is "0" if the unit is not linked to any other unit.
As you can see, each unit is 36 bytes long, so set the lenth to 36, then copy/paste into excel or something. Delete the insignificant bytes (only ones you need are X, Y, UnitID, Player ID, possibly unit properties).

If that's too much, and difficult to translate UnitIDs into units, then I suggest you use SCMDraft and make a long image of all the units on the map, as yoonkwun suggested.

You'll still have to place locations at each of these areas, which makes it kind of difficult. Why do you want to create them with triggers?



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jul 29 2010, 4:07 am jhuni Post #4



Quote
If that's too much, and difficult to translate UnitIDs into units

Thank you, that will save me a lot of work because manually copying the unit data would be a pain. I will write a function to convert the Unit IDs into Unit Names so that shouldn't be a problem.

Quote
You'll still have to place locations at each of these areas, which makes it kind of difficult. Why do you want to create them with triggers?

I have an 8px resolution hybrid location grid so I can place the units relatively easily/accurately. However, since these type of grids can't extend very far I don't have very much room to pre-place units in the map editor so I will create them with triggers when they are needed.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[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
[2026-4-13. : 9:14 pm]
ClansAreForGays -- anticapitalism isnt edgy anymore
[2026-4-13. : 3:31 pm]
Vrael -- it only costs 50% of my post-tax salary for life and in return I get to also become a drone whose sole purpose is CAPITALISM
[2026-4-13. : 3:30 pm]
Vrael -- pssht, you're still using a phone? I just record 100% of my life using my ElonBrainChip
[2026-4-13. : 2:13 pm]
NudeRaider -- bro I don't go anywhere without my phone to record anything significant
[2026-4-13. : 1:28 pm]
Vrael -- Zoan
Zoan shouted: not if u wer there
id say even if you were there its tricky, human memory can be very faulty
Please log in to shout.


Members Online: Roy