Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Quick question about unit indexes
Quick question about unit indexes
Jun 8 2016, 7:45 pm
By: Zoko-TkZ  

Jun 8 2016, 7:45 pm Zoko-TkZ Post #1



Am attempting to use EUDs for a specific (preplaced) unit in the map, came upon a critical question. I have some doodad objects that may be removed via triggers at certain points in the game. Will this change the unit indexes? Currently the unit I want to use EUDs on is index 0 in the editor however as I understand it doodads take precedence in index count in the actual game.
So my question is, if at the start of the game I have 10 doodads and some unit A with an index of 0 + 9 = 10, and at some point 5 doodads are removed, will unit A retain index value 10 or will the value decrease by 5?

Just to clarify by doodads I mean the installation traps/defences.

Also related question: are there any other unit types which take precedence when unit indexes are calculated (such as powerups or dark swarm/web)?

Post has been edited 2 time(s), last time on Jun 8 2016, 7:57 pm by Zoko-TkZ.



None.

Jun 8 2016, 8:21 pm Roy Post #2

An artist's depiction of an Extended Unit Death

Quote from Zoko-TkZ
Am attempting to use EUDs for a specific (preplaced) unit in the map, came upon a critical question. I have some doodad objects that may be removed via triggers at certain points in the game. Will this change the unit indexes? Currently the unit I want to use EUDs on is index 0 in the editor however as I understand it doodads take precedence in index count in the actual game.
So my question is, if at the start of the game I have 10 doodads and some unit A with an index of 0 + 9 = 10, and at some point 5 doodads are removed, will unit A retain index value 10 or will the value decrease by 5?

Just to clarify by doodads I mean the installation traps/defences.
A unit's index never changes once assigned, regardless of the death and creation of other units. So to your question, Unit A will retain index value 10.

Quote from Zoko-TkZ
Also related question: are there any other unit types which take precedence when unit indexes are calculated (such as powerups or dark swarm/web)?
The only general exceptions are doodads (which always take precedence) and Start Locations (which never consume an index). Powerups and the like are treated as regular units, and they occupy the next available index as expected.

From Section 6 of the EUD Guide:
Quote from Roy
However, it's not always this simple. Here's a couple ways the index value can be incorrect in SCMDraft:
  • SCMDraft assigns an index ID to Start Locations, but the actual game does not. This means if a Start Location was at index 0 and a Marine was at index 1, the Marine's actual index in-game would be Index 0.
  • Any doodad units placed on the map (e.g., a floor gun trap) that is placed as a doodad will not show in SCMDraft's list of units, but it will also be assigned an index ID. Doodad units are assigned IDs before preplaced units are, regardless of whether the doodad was placed before or after the unit(s). For example, if you first place a Marine (shown as index 0), a Floor Gun Trap doodad, and then a Firebat (shown as index 1), the Floor Gun Trap will receive index 0, the Marine will receive index 1, and the Firebat will receive index 2.

Another thing to remember is that players that are not in the game will not have their units placed. This again alters the actual indexes of preplaced units.





Jun 8 2016, 8:32 pm Zoko-TkZ Post #3



Thanks Roy! Your guide has been very helpful.

Another new question: do unit indexes or EUDs act differently regarding units with doodad state enabled (using the method for cloaking)?

Post has been edited 1 time(s), last time on Jun 8 2016, 9:39 pm by Zoko-TkZ.



None.

Jun 8 2016, 11:06 pm jjf28 Post #4

Cartography Artisan

Quote from Zoko-TkZ
do unit indexes or EUDs act differently regarding units with doodad state enabled (using the method for cloaking)?

Nope



TheNitesWhoSay - Clan Aura - github

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

Jun 9 2016, 5:30 am O)FaRTy1billion[MM] Post #5

👻 👾 👽 💪

Another thing to keep in mind is that tank and goliath turrets count as separate units too, so tanks and goliaths count as 2 units.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Jun 9 2016, 5:32 am jjf28 Post #6

Cartography Artisan

Don't forget interceptors in hanger, which come in the slots after a carrier; not sure how scarabs work; there's probably a few more nuances we haven't mentioned, you're probably best off just checking the indexes in game with Unit Viewer



TheNitesWhoSay - Clan Aura - github

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

Jun 12 2016, 7:07 am rockz Post #7

ᴄʜᴇᴇsᴇ ɪᴛ!

I believe the 1st unit placed on the map is at the beginning of the unit table and the 2nd unit placed on the map is at the end of the unit table, and it goes backwards from there.

This would mean that carriers' interceptors are actually placed before the carrier in memory. Please correct me if I'm wrong.



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

Jun 12 2016, 2:44 pm jjf28 Post #8

Cartography Artisan

For pre-placed units, interceptors are always at unit table indexes (referred to as 'slots' above) after the carrier they're in.

In terms of where units start in memory the unit table goes...

0000 - 0x0059CCA8
0001 - 0x00628298
0002 - 0x00628148
...
1699 - 0x0059CDF8

So in terms of starting address they come before (unless the carrier is at index 0), though I don't recommend memorizing that :), here's a excel formula to turn an index (assumed to be at B2) into the address a unit starts at in memory:
Code
=DEC2HEX(IF(B2=0,5885096,6456296-336*B2))




TheNitesWhoSay - Clan Aura - github

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

Jun 25 2016, 5:08 am Zoko-TkZ Post #9



Is there any way to get a unit's index number other than unit viewer? I'm attempting a simple EUD trigger that checks a unit's energy but even after checking and re-evaluating the formula many times it seems that the trigger is using the wrong unit index. I believe the best way to debug it is to find the actual index of the unit I am attempting to use. The index that I am trying to use I got by setting the index of the unit to 0 in scmdraft and then counting the number of doodads, and then using that value.



None.

Jun 27 2016, 7:23 am Roy Post #10

An artist's depiction of an Extended Unit Death

Quote from Zoko-TkZ
Is there any way to get a unit's index number other than unit viewer? I'm attempting a simple EUD trigger that checks a unit's energy but even after checking and re-evaluating the formula many times it seems that the trigger is using the wrong unit index. I believe the best way to debug it is to find the actual index of the unit I am attempting to use. The index that I am trying to use I got by setting the index of the unit to 0 in scmdraft and then counting the number of doodads, and then using that value.
You should only be counting doodad units; doodads that are just terrain and sprites don't get assigned an index. If you can select the doodad in-game, or if it has HP, it takes up an index.

There are a few ways you can debug to get a unit's index. You could open a memory scanner like Cheat Engine and search for a property on the unit on SC (for example, search the HP of the unit, have the unit take damage, and repeat for the new value until you've found the address) and then figure out the index ID from there. You could also generate triggers for all indexes looking up some fixed value and spitting out a display text message.




Jun 28 2016, 7:42 am Zoko-TkZ Post #11



Quote from Roy
You should only be counting doodad units; doodads that are just terrain and sprites don't get assigned an index. If you can select the doodad in-game, or if it has HP, it takes up an index.

Quote from Zoko-TkZ
Just to clarify by doodads I mean the installation traps/defences.

This still applies haha.

But interestingly enough I found that even though I have those doodads, my target unit still ends up at index 0, which is why I was having trouble with the trigger in the first place.



None.

Jun 28 2016, 12:40 pm Roy Post #12

An artist's depiction of an Extended Unit Death

Quote from Zoko-TkZ
But interestingly enough I found that even though I have those doodads, my target unit still ends up at index 0, which is why I was having trouble with the trigger in the first place.
Did you place the traps as doodads, or did you place them as units?




Jun 28 2016, 9:24 pm Zoko-TkZ Post #13



As units, which I didn't take into account, I guess I assumed that since they were from the doodad section under neutral they would be counted as such.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[05:00 pm]
lil-Inferno -- benis
[10:41 am]
v9bettel -- Nice
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
Please log in to shout.


Members Online: Roy, Ultraviolet