Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: EUD detect keypress
EUD detect keypress
Nov 20 2022, 11:10 am
By: sraw531  

Nov 20 2022, 11:10 am sraw531 Post #1



Without me using an EUD tool, could I have "Display Text Message" (local only action if I understand correctly) on a keypress (say, F1-12. Not sure offhand which ones are normally unbound in sc1 besides that f10 definitely is bound).
Preferably I would like this action to be done without requiring the map to be emulated on 1.16.

Intention: I am trying to make a single player map where there might be some changes to units (such as baseline stats) as well as choices you could have made (in a previous map, branching maps) and the hotkeys would be used to inform or remind about these changes. (EG, I plan scarabs to cost less, build faster, deal less damage). None of these changes will be dynamic (applied in the middle of a mission).

Thanks in advance.

Post has been edited 1 time(s), last time on Nov 20 2022, 11:16 am by sraw531.



None.

Nov 20 2022, 2:33 pm Roy Post #2

An artist's depiction of an Extended Unit Death

You can most certainly write key press EUDs by hand. However, when it comes to key press detection, knowing where to read isn't very straightforward, as each key is assigned its own byte (it stores a value of 0 if the key is not pressed, and a value of 1 if it is pressed). The entry for the (0) key is located at 0x596A88, and you can look at a character map to figure out any character from there. Non-character keys like function keys don't show up there, so you would need some other method of figuring out where they are in memory. To save you some time, here are the values:

F1-F12
F1: 0x596A88
F2: 0x596A89
F3: 0x596A8A
F4: 0x596A8B
F5: 0x596A8C
F6: 0x596A8D
F7: 0x596A8E
F8: 0x596A8F
F9: 0x596A90
F10: 0x596A91
F11: 0x596A92
F12: 0x596A93

Converting these by hand would be a pain, so to comply with your tool-less requirement, I will refer you to Morphling's Detecting Keys Pressed (EUDs) topic, which has a map containing just about every keyboard key press detection possible. You can look through the map and take the appropriate keys from there.

When you say "Without me using an EUD tool", I am making an assumption that you just mean without using something like EUD Editor, which saves off the map in a format that makes it incompatible with further editing. There are still many tools available that would make your life easier:

  • EUDTrig will convert the memory addresses above to their EUD equivalent, so you know what to enter into your editor.
  • EUDGen2 has trigger generation for key press detection, and you could generate the EUDs you would otherwise write by hand.

This is what EUDGen generates if you tell it to detect a key press between F1 and F12:
F1-F12
Trigger("Player 1"){
Conditions:
    Memory(12745, Exactly, 1);

Actions:
    Comment("IF (Local) Player is holding down the 'F1' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12745, Exactly, 256);

Actions:
    Comment("IF (Local) Player is holding down the 'F2' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12745, Exactly, 65536);

Actions:
    Comment("IF (Local) Player is holding down the 'F3' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12745, Exactly, 16777216);

Actions:
    Comment("IF (Local) Player is holding down the 'F4' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12746, Exactly, 1);

Actions:
    Comment("IF (Local) Player is holding down the 'F5' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12746, Exactly, 256);

Actions:
    Comment("IF (Local) Player is holding down the 'F6' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12746, Exactly, 65536);

Actions:
    Comment("IF (Local) Player is holding down the 'F7' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12746, Exactly, 16777216);

Actions:
    Comment("IF (Local) Player is holding down the 'F8' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12747, Exactly, 1);

Actions:
    Comment("IF (Local) Player is holding down the 'F9' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12747, Exactly, 256);

Actions:
    Comment("IF (Local) Player is holding down the 'F10' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12747, Exactly, 65536);

Actions:
    Comment("IF (Local) Player is holding down the 'F11' key");
}

//-----------------------------EUDGen-----------------------------//

Trigger("Player 1"){
Conditions:
    Memory(12747, Exactly, 16777216);

Actions:
    Comment("IF (Local) Player is holding down the 'F12' key");
}

//-----------------------------EUDGen-----------------------------//


(As a disclaimer to any future readers: this form of key press detection will only work locally, and is not intended for multiplayer.)




Nov 21 2022, 1:34 am sraw531 Post #3



Thanks, this looks like more than enough for me to chew on. A cursory glance into the trigger section of this map looks extremely useful.
My requirement was so that I could have a map that I can edit afterward in SCMdraft2, preferably with the built in tools that SCMdraft2 has. I also didn't want to download the tools for injecting and whatnot, just one or two memory addresses. I did expect that it was going to involve either the deaths or memory conditions.
If I were to make a trigger using these, using only local effects (display text), would that make the map emulated in 1.16? Would that happen if the map were to do a non-local effect (teleporting a dark templar to a hostile unit within range) would that make it require emulation?
I assume the former is no and the latter is yes.
I guess I forgot that display text was allowed in multiplayer, I am unaccustomed to EUD in general and thought it might be worth it to not have tips pop up at the begin of the level that are cumbersome to read
Thanks a bunch!



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