Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Memory Conditions
Memory Conditions
Sep 19 2009, 7:02 am
By: CecilSunkure  

Sep 19 2009, 7:02 am CecilSunkure Post #1



I'm a bit lost with the memory condition in scmdraft. What I would like to do is detect unit HP.

I have already found my address for my unit, which is 0x00608561. I also have EUDTrig 1.2. I also understand that in order to detect an hp value of 1, I would use the "exact" comparison with a value of 256, but I can not seem to create a working condition. Here is the condition I have at the moment, which I want to use to detect for 1hp or greater, just to see if the trigger condition is even working:

Memory at death table + 10763 is at least 256

Since I want the trigger to run for players 1 and 2, I am assuming I place this trigger under both of them?

Though, this doesn't seem to do anything at all. Any ideas on what I should be doing?



None.

Sep 19 2009, 7:35 am Falkoner Post #2



Did you subtract the value of the Memory Death table start from the value you want to get to and convert it to decimal?



None.

Sep 19 2009, 7:41 am CecilSunkure Post #3



Quote from Falkoner
Did you subtract the value of the Memory Death table start from the value you want to get to and convert it to decimal?
I'm not sure what you mean by "the value of the Memory Death table" and "the value you want to get to", and I certainly didn't convert anything into a decimal.

The address for my unit is 0x00608561. When this is placed into EUD trig I get a unit ID of 10763, with player 2. I want the trigger with this condition to spam a text message, so I can see if I got things set up correctly, so I use "at least 256".. Since the wiki said that a value of 256 would stand for 1 hp, 512 for 2, and so on. That's all I did, so no, I don't think I did what you asked.. Am I supposed to? How do I go about doing so if I need to?



None.

Sep 19 2009, 8:00 am rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

use the new version of eud trig. memory is more correctly worded to "player x deaths of terran marine is quantcompare quantmod". Look up in the sticky for how to use the memory condition, as well as how to write an EUD.

The formula for deaths is something like:
Memory Address = Death table start + 4*player + 48*Unit ID. When you use terran marine, unit id becomes 0.



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

Sep 19 2009, 8:22 am CecilSunkure Post #5



Not sure which sticky you mean. If you mean the final call for scmdraft.. Didn't find anything in there after scanning most pages like 3 times.

"The formula for deaths is something like:
Memory Address = Death table start + 4*player + 48*Unit ID"

00608561 = Death table start + 4x129151 + 48x0

I still don't know what to do from here, if it's being done right..



None.

Sep 19 2009, 9:47 am Ahli Post #6

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

How I am doing that:
If you already know the old EUD and want to convert that to a memory condition, directly start at [ 3 ].

[ 1 ]
Get the adress out of artmoney or something else

[ 2 ]
Write the adress into EUDTrig1.2 to get an old EUD trigger with the help of this:
Offset:
scbw 1.16.1 first entry of death table (marine):
0058A364 = 5808996

[ 3 ]
Use this Formula:
old EUD to Memory Condition:
( (player# - 1)*4 + 48 * UnitID ) /4
or in another form:
( player# - 1 ) + 12 * UnitID

[ 4 ]
copy your new knowledge into a txt file and save it somewhere whithin your starcraft folder




Sep 19 2009, 2:49 pm rockz Post #7

ᴄʜᴇᴇsᴇ ɪᴛ!

Useful EUD links, the only one with EUD in the title.
The formula is:
0x608561 = 0x58A364 + 4*Player number + 48*0
Solve for player number. Death table start is given, since it is just deaths of player 1 marine, and is also in the EUDDB.



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

Sep 19 2009, 3:49 pm CecilSunkure Post #8



6325601 = 5808996 + 4xP + 0

P = (6325601 - 5808996) / 4

P = 129151.25

Great, I got my condition to work! Thanks for all the help!

In another topic I was told that the decimal tells you which byte to read, though I'm unsure what relevance that has to do with creating a condition, and I don't know which bytes will be read with a remainder of .25. I just added the entire number including the .25 and scmdraft just deleted the .25 part. Will this always be the case, even if I end up with a player number with a decimal of .5 or larger? I just paste it into the memory condition and have it remove my remainder? Or is there something more I need to know..?

[Edit]Cool, I got this to work with keypress detection as well ^.^

[Edit]When this address, 0x608561, is placed into EUDTrig I get a byte offset of 00 00 00 00 00 00 00 00, since I have my object ID/Length set to 4.. Is it supposed to be set to 4? How do I use this information to calculate the value equal to 1 hp?

[Edit]Well I went and tested the triggers, the hp is represented in increments of 256, but I don't understand why :C

Post has been edited 4 time(s), last time on Sep 19 2009, 5:24 pm by CecilSunkure.



None.

Sep 20 2009, 3:34 am rockz Post #9

ᴄʜᴇᴇsᴇ ɪᴛ!

Deaths read every 4 bytes. That means they actually read 4 bytes, no matter what is there. In the case of HP, HP is split up into 4 bytes (lucky us!).

The first byte is what I call extra precision. Zerg HP regeneration is basically adding 4 to this number every frame. Once this byte reaches 256, it loops back to 00 and adds 1 hp that you can actually see in game.
The second byte through the fourth byte are all the HP that you see in game. If a marine has 100 hp, it's actually got a 100 in the 2nd byte, and 00 in the first byte.

In the case of a decimal, an even number means it's divisible by 4, and you want to just simply detect the number (easiest by far). a .25 means you're looking for byte 2, so you have to multiply by 256 (256=1 hp, 25600=100 hp). .5 means you're looking for byte 3, so multiply by 256^2. .75 you will probably never encounter, and you just multiply by 256^3. If you want to detect something, it's actually best for it to be on byte 4, since you can ALWAYS detect that, regardless of what's on the previous 3 bytes, since it's the most significant. This is apparent when you want to detect a unit's order location. It's stored in 2 bytes each, X then Y. Since it's 2 bytes, you can detect the Y but not the X, unless you pre-set a building somewhere, and you know that exact location.

Make sure you take a look at the memory editor in artmoney to see what's going on, and you'll understand slightly better.



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

Feb 2 2010, 5:31 pm ImagoDeo Post #10



Quote from Ahli
[ 3 ]
Use this Formula:
old EUD to Memory Condition:
( (player# - 1)*4 + 48 * UnitID ) /4
or in another form:
( player# - 1 ) + 12 * UnitID

Ah crap. I'm having troubles with this.

My old EUD condition that I want to make into a memory condition is as follows:

Code
Player 7 has suffered exactly 1 deaths of UnitID:1061.


This is for keypress T.

So my formula should be:

(Player 7 - 1) * 4 + (48 * 1061)
(6) * 4 + (48 * 1061)
24 + (48 * 1061)
24 + 50928
50952

What the heck do I do with that? If that's the number that I input for Deaths Table +#, it doesn't make any sense. It's nowhere near the other keypress memory conditions that I'm using (which I cannibalized from somewhere, can't really remember now). I've taken a few shots in the dark and found this:

Memory at deaths table + 12737 is exactly 65536 = Keypress R.
Memory at deaths table + 12734 is exactly 1 = Keypress D.
Memory at deaths table + 12734 is exactly 65536 = Keypress F.
Memory at deaths table + 12735 is exactly 1 = Keypress H.
Memory at deaths table + 12735 is exactly 65536 = Keypress J.

After much frustration, I decided to go to you guys for help.

/sigh

Post has been edited 2 time(s), last time on Feb 2 2010, 10:54 pm by ImagoDeo.



None.

Feb 3 2010, 1:10 am rockz Post #11

ᴄʜᴇᴇsᴇ ɪᴛ!

You didn't divide by 4. 50952/4=12738. It's important to know how the memory condition works, so I'll explain it. Memory(Player, Comparison, Amount); is just deaths of terran marine. Deaths reads starcraft's memory by the following formula: Address = Offset + 4*Player+48*Unit. In memory, Unit=0. So you need to solve for player. In your example:
Traditional:
Address = Offset + 4*6 + 48*1061
Memory
Address = Offset + 4*Player + 48*0
Now Address=Address, so just set the two sides equal to each other.
Offset + 4*6 + 48*1061 = Offset + 4*Player + 48*0
Solve for Player.

Also, all these things are in Morphling's map.

Shoot, you could have easily figured it out from the shots in the dark. Haven't you ever taken the SAT, or an SAT-like-test?

Fill in the blanks of this pattern:
12734, 1, D, 12734, 65536, F, 12735, 1, H, 12735, 65536, J, ?, ?, ?
There's 8 numbers here, and 4 letters. The letters are D F H J. One would presume the next letter would be L, then N, then P, then R, then T.

As for the first number, you add 1 to it every other replication, so 12734, 12734, 12735, 12735, 12736, 12736, 12737, 12737, 12738.
The second number just goes back and forth between 1 and 65536. Through a little guessing, we can assume that the second number is also 2^0+1, and 2^16+1, so if we were to divide it in half, the middle numbers would be 2^8+1 and 2^24+1, which would represent the letters not expressed like E, G, and I.



"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.
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are some real members mixed in those latter pages, but the *vast* majority are spam accounts
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- there are almost 3k pages
[2024-4-14. : 9:21 pm]
O)FaRTy1billion[MM] -- the real members stop around page 250
[2024-4-14. : 9:20 pm]
O)FaRTy1billion[MM] -- look at the members list
[2024-4-12. : 12:52 pm]
Oh_Man -- da real donwano
da real donwano shouted: This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
it's pretty common
[2024-4-11. : 9:53 pm]
da real donwano -- This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
[2024-4-11. : 4:18 pm]
IlyaSnopchenko -- still better than "Pakistani hookers in Sharjah" that I've seen advertised in another forum
[2024-4-11. : 4:07 pm]
Ultraviolet -- These guys are hella persistent
[2024-4-11. : 3:29 pm]
Vrael -- You know, the outdoors is overrated. Got any indoor gym and fitness equipment?
[2024-4-10. : 8:11 am]
Sylph-Of-Space -- Hello!
Please log in to shout.


Members Online: Roy