Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: EUD Selected unit
EUD Selected unit
Jan 21 2010, 9:43 am
By: Dabbu  

Jan 21 2010, 9:43 am Dabbu Post #1



I did a search, couldn't find this topic. I'm just not savvy enough with EUDs so hopefully someone knows this already.

Does anyone know the condition for the first currently selected unit (like when units have a red/yellow/green circle around them)?
So for example, the map has a pre-placed unit who's Unit ID is known, and a trigger checks if it is currently selected by the user.

Theory:
Obviously Starcraft has 12 (at least) places in memory reserved for selected units.
So a single selected unit `should` be the first in this list.
It's value could be :
- the Unit ID of the selected unit (2 bytes?).
- a pointer value to the unit id array (4 bytes?).
either way it should still be possible.

The end goal for example could be that you have a "Hero Selection" area, and when the player selects a hero to see the stats you get an extra text message showing more details (spells, etc..).
Combine that with key sensing, press the space bar and you confirm the unit to play with.

Post has been edited 1 time(s), last time on Jan 21 2010, 9:52 am by Dabbu.



None.

Jan 21 2010, 9:53 am rockz Post #2

ᴄʜᴇᴇsᴇ ɪᴛ!

Run a search on "currently selected unit". You'll find plenty. Any specific questions, just ask, and I'll be significantly less vague.

Quote from bwapi
006284D0 Player 1 Selection Group (4 * 12)
00628500 Player 2 Selection Group (4 * 12)
00628530 Player 3 Selection Group (4 * 12)
00628560 Player 4 Selection Group (4 * 12)
00628590 Player 5 Selection Group (4 * 12)
006285C0 Player 6 Selection Group (4 * 12)
006285F0 Player 7 Selection Group (4 * 12)
00628620 Player 8 Selection Group (4 * 12)
http://code.google.com/p/bwapi/wiki/changes116

It's a pointer value to the unitID array. The shared selection groups are slow, though, so I suggest you use the single player versions (since you're already using single player with keypress anyway).

Quote from bwapi
005971F0 ? Selection Group (4 * 12)

Note that these addresses are no longer accurate, but it should give you a good idea of where to look. The non-shared version is instant. The shared version has a slight delay. I made a map a while ago, but I don't know where it is, and googlepages crapped out on me. I can re-upload it if you really want, but it's not all that difficult to do. It's the one with shared HP and selected unit detection (try using those in the search terms).



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

Jan 21 2010, 10:19 am Dabbu Post #3



Thanks, I found the custom portraits post by "O)FaRTy1billion" here.

So you say the addresses have changed eh?
I only care about the single one, not the shared.
Thanks for the quick reply.

[edit]
according to that google link the address I want is:
0068C134 Currently selected unit ID

EDIT:
Ok this is very confusing!
Unit ID can mean a few different things depending on the context.

Judging by the custom unit portrait map, the "selected unit" address contains information about the "Unit ID" as in Unit Type (marine, hydra, nexus, etc..).
This is awesome, but I'm also trying to find the "Unit ID" as in that 0-1699 value, which is unique to any active unit currently on the map.
The selected unit address must have both pieces of information, so that Starcraft can know which units to draw selection circles around and what portrait to display.

Any good articles describing the math behind going from an address to a SCMDraft memory condition?

Post has been edited 1 time(s), last time on Jan 21 2010, 3:18 pm by NudeRaider. Reason: merged posts



None.

Jan 21 2010, 4:12 pm samsizzle Post #4



Ok so if you're using the Memory condition in scmdraft use these.

P1 - memory(161889,X) To get the next players address add 12.

Then for the X unit 1 is 5885096, unit 2 is 6455960 and its also where the pattern starts. To get the next unit subtract 336 from the last units number. and so on.

So to detect the first unit on the map in P1's selection would be Memory(161889, exactly 5885096)



None.

Jan 21 2010, 5:47 pm Dabbu Post #5



Thanks, I kind of get it...
Someone needs to make a youtube video, with lots of rich alpha blended visual examples and nice background music.

So this is my vague understanding so far (please help)...
  • The death condition has a default starting point in the SC address space. (0x0058A364 as of v1.16.1)
    Each address number represents 1 byte of data.
  • We use that DC address as an offset that is subtracted from the address we actually want to read.
  • The resulting difference then needs to be presented as a combination of the parameters 'Player #' and 'unit type'.
    • Player # provides a bigger boost of these, because it is multiplied by some constant value (which is 256??)
    • Unit id provides a single byte increment, and it would seem it can be over 256. (how many bytes can this value be? 2 or 4)
  • The death condition then reads 4? bytes of data for the comparison??
  • So it would appear that some memory locations could be accessed 2 different ways, depending on the combination of player and unit id.. is that so?

... I found a post which looked like it had the raw formula, but now I can't find it.

Finally, I'd be willing to sit down with ArtMoney and try to map out other stuff if someone could show me the ropes and help me narrow down the memory address scope.
I'd like to find out things like if the user is in chat mode, so the triggers can disable hot keys and not accidentally trigger spells for example.



None.

Jan 21 2010, 7:34 pm samsizzle Post #6



All i know is that using EUDs you can read beyond the memory that you're supposed to in sc. Extended Unit Deaths.



None.

Jan 22 2010, 2:58 am NudeRaider Post #7

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from Dabbu
Finally, I'd be willing to sit down with ArtMoney and try to map out other stuff if someone could show me the ropes and help me narrow down the memory address scope.
I'd like to find out things like if the user is in chat mode, so the triggers can disable hot keys and not accidentally trigger spells for example.
Check Fartys EUD DB. It should give you a good idea of possible ranges.

To detect chat mode you could make a simple text detection.
When you press Enter you get a word like "message: " (Can't seem to remember what it actually says, but just go ingame and check) and you can type your message after it. Just make a text detection for "message: ".




Jan 22 2010, 3:29 am O)FaRTy1billion[MM] Post #8

👻 👾 👽 💪

For current player unit selection group I got 0x006284B8. ;o But there were 4 of them. It is 12 4-byte values that point to the unit in memory.



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!

Jan 22 2010, 9:26 am rockz Post #9

ᴄʜᴇᴇsᴇ ɪᴛ!


I hate movie maker.

Please restate any questions you still have, as I think you were quite confused before.



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

Jan 22 2010, 10:20 am Dabbu Post #10



Rockz you ROCK!

I woke up this morning thinking about how player number and unit Ids alter the address, and I fiugured out my previous thoughts were wrong, but 4 and 48?? I would not have guessed those. I was gonna guess 256x4 and 4 or 4 and 256x4.

Either way, thanks for taking the time.
And also, do you know if anyone is doing research like this on Macs??

EDIT:
OHHH!! 12 x 4!!!! = 48!!
I was thinking they still reserved all 256 players... but ofcourse not!

Edit:
I dig the video, I dig it true,
I just think the text should fade out top to bottom, Don't you?
Take it or leave it, you still rock!
In this post you have the biggest ****

Post has been edited 1 time(s), last time on Jan 22 2010, 10:37 am by Dabbu.



None.

Jan 22 2010, 4:45 pm rockz Post #11

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from Dabbu
I woke up this morning thinking about how player number and unit Ids alter the address, and I fiugured out my previous thoughts were wrong, but 4 and 48?? I would not have guessed those. I was gonna guess 256x4 and 4 or 4 and 256x4.[quote]The Death table is 4*12*228, for 4 bytes per address, 12 players, 228 units.

[quote=name:Dabbu]And also, do you know if anyone is doing research like this on Macs??
Same method as the video, except you probably need different programs, and will have to hex edit the map. To hex edit, you only need to extract scenario.chk from the mpq archive in the .scx file and edit the TRIG section in the .chk. The wiki has all the information you need on scenario.chk format. You can make a whole bunch of triggers with the "Player 11 has suffered X deaths of terran marine" then find those triggers in the hex editor, and change the "0A 00 00 00" to whatever number the address should be. Unfortunately, macs don't use the same addresses as other versions, so if you make an EUD map, macs don't work, or vice versa. You'd have to do two different EUDs for each trigger if you wanted both to work.

Quote from Dabbu
OHHH!! 12 x 4!!!! = 48!!
I was thinking they still reserved all 256 players... but ofcourse not!
Just about everything is 4 bytes long (a double word), which makes using EUDs easy to read them. Officially, players 13+ don't exist, in fact they are used for the "Allies", "Current Player", "Non-Ally Victory Players", "Force 1", and etc... that you see when making triggers.

Quote from Dabbu
I dig the video, I dig it true,
I just think the text should fade out top to bottom, Don't you?
Take it or leave it, you still rock!
In this post you have the biggest ****
lol, I figured it was worthwhile doing one for the numerous questions it gets.



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

Jan 22 2010, 8:41 pm Dabbu Post #12



I wouldn't mind coding both in, especially for features that really enhance game play.
The first time I found out about the key press EUDs I removed an entire unit menu, replaced it all with key presses, saved without a backup, and then found out it won't work on Macs.
So now I'm going to still use key press EUDs but also keep the unit menu. That's overall smarter, cause then it's future proofing with new patches.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[2024-5-02. : 1:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
[2024-4-30. : 7:43 am]
NudeRaider -- Vrael
Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
[2024-4-29. : 6:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[2024-4-29. : 4:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[2024-4-29. : 12:52 pm]
Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
[2024-4-29. : 11:17 am]
Zycorax -- :wob:
[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.
Please log in to shout.


Members Online: Roy