Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Forcing Unit Selection
Forcing Unit Selection
This topic is locked. You can no longer write replies here.
Jan 17 2011, 8:41 pm
By: xAngelSpiritx  

Jan 17 2011, 8:41 pm xAngelSpiritx Post #1

eternal lurker

EDIT: Wrong section, sorry. Could a mod move this to Mapmaking assistance please?

Allow me to explain.

Let's say that the player currently has Unit X selected. However, I want to remove unit X, and, at the same location, create Unit Y. Normally, doing this would result in the unit being deselected.

When Unit X is removed, I want Unit Y to be automatically selected, without requiring the player to select it himself. Ideally, it would also be only triggered if the player currently has Unit X selected.

I am using Farty's EUD Action Enabler.

Thanks in advance!



None.

Jan 17 2011, 11:05 pm Ahli Post #2

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

That would only work if the "new" unit is preplaced, I guess.
Because I don't think that replacing the unitID in the unit array would update the graphics.
But atm I'm not that sure how much you would have to write into the RAM. Maybe only some sort of unit array index.




Jan 17 2011, 11:29 pm Roy Post #3

An artist's depiction of an Extended Unit Death

Quote from Ahli
That would only work if the "new" unit is preplaced, I guess.
Yup.


6284E8 161889 P1 FIRST SELECTION ID (SHARED): (Pointer to unit, see below)
6284EC 161890 P1 SECOND SELECTION ID (SHARED): (Pointer to unit, see below)

...

Pointer to Units (x = unit index):
if x = 0: 5885096
if x >= 1: 6455960 - 336(x-1)

Info from http://www.staredit.net/topic/10471/




Jan 18 2011, 2:28 pm rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

this doesn't make sense. I don't think this will work. It's pretty stupid for starcraft to use a shared value to select stuff. It's more likely that the non-shared current select unit value sets the shared current select unit value. I'd do that one, wherever it is (doodle77 made a map demonstrating the non-shared value). The only problem is you'll have to make it a non-shared trigger.

I haven't experimented with it, but can't you change the unit how you want? Why do you need a new unit?



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

Jan 19 2011, 12:17 am xAngelSpiritx Post #5

eternal lurker

It's designed so that when a unit moves to a location, their "weapon" gets switched (by replacing the unit with another).

I could change the existing unit though. It would probably be much smoother actually.

I know it's possible to change the weapon that a unit is using through an EUD action; what, exactly, would I need to do to change the weapon of a unit into a specific weapons.dat ID? Keep in mind that the map I'm using this for is single-player, so there's only P1 involved.



None.

Jan 19 2011, 1:00 am Gigins Post #6



Do you even need EUD action enabler if it's single player. I mean you can't desync being alone. :crazy:



None.

Jan 19 2011, 1:17 am xAngelSpiritx Post #7

eternal lurker

Quote from Gigins
Do you even need EUD action enabler if it's single player. I mean you can't desync being alone. :crazy:

I believe that running EUD actions, singleplayer or not, will simply not do anything, unless the enabler is used. It has nothing to do with desync.



None.

Jan 19 2011, 1:31 am rockz Post #8

ᴄʜᴇᴇsᴇ ɪᴛ!

why do you want to force a weapon change anyway? Isn't it easier to just let the player select the weapon? Having a computer automatically change my weapon for me is somewhat annoying.

I can't exactly tell you what to do, but I was thinking along the lines of changing the unitID. However if you're using a specific unit, you can always change the unit's weapon in units.dat I think.

http://farty1billion.dyndns.org/EUDDB/?pg=entry&addr=6698680
http://farty1billion.dyndns.org/EUDDB/?pg=entry&addr=6690528



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

Jan 19 2011, 2:45 am Heinermann Post #9

SDE, BWAPI owner, hacker.

The unit does not need to be preplaced if you can write ASM and a hook (code detour), which is possible if you have EUD Enabler. I won't assist with it though.




Jan 19 2011, 5:47 pm xAngelSpiritx Post #10

eternal lurker

Quote from rockz
why do you want to force a weapon change anyway? Isn't it easier to just let the player select the weapon?
That's exactly what's supposed to happen. The player selects a weapon, and the weapon on their unit is automatically changed to whichever weapon they selected.

Thanks for the offsets. I didn't take a deep look into the EUDDB, so I must have missed that entry when I skimmed it over.

That solves my problem, thanks!

Post has been edited 1 time(s), last time on Jan 19 2011, 5:59 pm by xAngelSpiritx.



None.

Jan 20 2011, 12:16 am rockz Post #11

ᴄʜᴇᴇsᴇ ɪᴛ!

You may think this is solved, but you're doing it wrong (partially because I didn't understand the situation).

You don't need EUD actions to "switch weapons" as it's been done before with just conditions, and it can be done either via single player or multi player, though multiplayer is slow.
http://www.staredit.net/topic/6865/
this thread has a number of maps in it which demonstrate hopefully exactly what you want to do, and should tell you how to do it (ignore the shared HP thing).

If you want single player, hopefully you have watched the EUD tutorial video on how to use artmoney/cheat engine to find and change data and convert them into EUD or EPD triggers. All you need to do is find your currently selected unit's 4 byte pointer value (the firebat in my map has a pointer value of 6398840) and search for it. I can almost guarantee you that only two things will show up. One is the shared current selected unit, which you need to find anyway to find the number of the unit you've selected, and the other will be the locally currently selected unit (which is polled every frame, rather than every 8+ frames).

I highly doubt you have solved this completely, so until you have a working map and understand it all, I'm going to leave this open. Go ahead and ask any questions about it in this thread, though I encourage you to read through the stickies on EUDs.



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

Jan 20 2011, 4:00 am xAngelSpiritx Post #12

eternal lurker

With respect, rockz, I'm not entirely new to the subject. I am a programmer myself (albeit a beginner). I understand all the basics; what's an address, byte, difference between signed and unsigned, etc, etc.
The problem is solved, of finding a smooth way for a unit to switch weapons through user input.

Originally, I had planned to do what you did in your test map, and switch between different units. Now, however, instead of switching units, a solution was found by directly changing the unit's weapon:




None.

Jan 20 2011, 2:31 pm rockz Post #13

ᴄʜᴇᴇsᴇ ɪᴛ!

then you have working triggers, yay!



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

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[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
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
Please log in to shout.


Members Online: storuswhes, Roy