Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Stim pack detection
Stim pack detection
Jul 10 2009, 6:35 pm
By: Toothfariy
Pages: 1 2 34 >
 

Jul 10 2009, 6:35 pm Toothfariy Post #1



I've been reading a lot about EUDs lately and i know this is possible, though im still very confused on what to do

Ultimatly, i want to have the ability to detect stim packs for each player, each player only owns 1 unit that can stim

then i want to be able to detect if someone casts a spell (ensnare)

these units wont be preplaced, they'll be created in the game; but they'll all be within a particular location

Wil this work, or am i wasting my time by trying to set this up?



None.

Jul 10 2009, 7:42 pm rockz Post #2

ᴄʜᴇᴇsᴇ ɪᴛ!

Alright:

EUDs have to be preplaced or PREDICTABLY CREATED. That means you have to make sure they are created in a certain spot in the unit table. I haven't gone through testing yet, since I haven't needed to, but I think newly created units will always be created in the lowest vacant spot. In memory it looks something like this:
1 1700 1699 1698 ... 3 2. The first unit created is first in the unit table. The second unit created is the last in the unit table.

When you kill a unit, it goes through its death animation, then is removed from the unit table, creating a vacancy. This might be correct. That means if you wait a little while after the unit dies, and then create your unit, it will be placed in that unit slot on the table.

Now, for detecting stimpacks. There's a bit of a problem here, as three things change when using stim packs. First, health is decreased by 10 exactly. This can be detected by detecting ALL of the unit's health values (you probably only need the whole numbers and not the extra precision). Then, set a DC to that number. Use binary countoffs to compare the previous frame with the current frame. If it's 10, then you have stimmed.

Another alternative is to detect the unit's speed. I don't know how to do this, but it's probably somewhere in the iscript area. Perhaps a modder can tell you how 2 is added to the unit's iscript, and that can be detected.

The same goes for the 3rd aspect, where you detect cooldown. However, I've never been able to detect cooldown on any unit, even though you can detect the timer for the cooldown, just not what it's supposed to be set to.

For detecting a spell: do you want to detect when the queen/kerrigan casts it, or whether or not the unit is ensnared? If you want to detect when it is ensnared, you can detect the top speed if it's controlled by flingy.dat. I'm not sure how to detect iscript ensnares. If you want to detect when it's cast, you can either detect cooldown timer, or detect the energy difference.



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

Jul 10 2009, 7:58 pm crutex Post #3



O_O you can detect the cooldown for any spell using EUDs only? this sounds interesting...
if you can detect the timer, can't you just try something like "at least 256"



None.

Jul 10 2009, 8:05 pm Toothfariy Post #4



So i would have to have these units preplaced on the map, and i would have to sit in each players position and calculate out all this information with health difference?

i've been reading over fartys tutorial on this too, but i have a problem. it says to edit starforges data file, and i dont have a data file in my starforge folder.

and i thought scmdraft could write euds

i have all the information, but im confused on the last part about the byte offset

can anyone explain this to me?



None.

Jul 10 2009, 8:10 pm rockz Post #5

ᴄʜᴇᴇsᴇ ɪᴛ!

I don't think you know what you're talking about.

+0x54 - BYTE bMainOrderTimer
+0x55 - BYTE bGroundWeaponCooldown
+0x56 - BYTE bAirWeaponCooldown
+0x57 - BYTE bSpellCooldown
are all detected via the same EUD. These are the timers, and can be detected, but only when they are greater than 0. They don't stay some number (like 15 for marine).

Also, I just found this in the reference, I think you can detect it here:
Code
+0xDC - DWORD dwStatus
    00000001(0x1) - Is Completed
    00000010(0x2) - Is on ground? or is it is unit...
    00000100(0x4) - Is in air
    00001000(0x8) - Checked for disabled, if it is 00001000, then the unit is disabled(/unpowered?)
    00010000(0x10) - Checked for burrowing purposes, if it is 00010000, then the unit is burrowed
    00100000(0x20) - Unit is entering a building
    01000000(0x40) - unit is entering a transport
    10000000(0x80) -
   
    00000001(0x100) - Checked for invisible purposes, if it is 00000001, then the unit requires a detector?
    00000010(0x200) - checked for cloak?
    00000100(0x400) - deals with doodad states? if set, is disabled
    00001000(0x800) - Unit cloaking doesn't need energy decrease
    00010000(0x1000) - Unit is in unbreakable code section? Cannot receive orders
    00100000(0x2000) - Set by nobrkcodestart
    01000000(0x4000) -
    10000000(0x8000) - cannot attack if set

    00000001(0x10000)
    00000010(0x20000) - Is a Building?

    00000100(0x4000000) - Invincible

    00010000(0x10000000) - Speed upgrade
    00100000(0x20000000) - cooldown upgrade


For help on EUDs, please refer to everything in this thread.
http://www.staredit.net/topic/6256/
Do some tutorials as well, so you can make your own map. Also, where's farty's tutorial?



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

Jul 10 2009, 8:16 pm Toothfariy Post #6



http://www.staredit.net/wiki/EUDs

im not really sure where to put all the information that the tutorial tells me to find



None.

Jul 10 2009, 8:25 pm crutex Post #7



the basis is you use the program eudtrig to turn memory locations into trigger conditions that check the amount of deaths for a particular unit by a particular player 0-255



None.

Jul 10 2009, 8:29 pm rockz Post #8

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from Toothfariy
http://www.staredit.net/wiki/EUDs

im not really sure where to put all the information that the tutorial tells me to find
Yeah, Bronto wrote that for the wiki. Farty said he'd write one, but never did, afaik.

Follow the health detection tutorial first, that will get you introduced to EUD creation. Make sure you open up the map and see what the triggers look like.



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

Jul 10 2009, 8:31 pm Toothfariy Post #9



yeah i understand that part

ive read through a bunch of tutorials and theres a few parts i still dont quite get

i dont know how to make the trigger itself

in the tutorial i posted, it says i need to edit the data file, but i dont have a data file anywhere so idk what to do



None.

Jul 10 2009, 8:33 pm crutex Post #10



you can't with staredit get scmdraft2 latest version and it has a "Memory" condition which will compile into a standard trigger.



None.

Jul 10 2009, 8:42 pm Toothfariy Post #11



nvm i found it

how to i make it into a death condition tho?



None.

Jul 10 2009, 8:43 pm crutex Post #12



make a new trigger and under conditions look for "Memory" if it's not there you haven't got the latest scmdraft

it will translate it into a death condition for you. with the memory condition you just specify the offset and value to check

like for one of my units i use to check if the unit goes below 50% hp but is not dead (between 1 and 1000 cause the unit has 2000 max hp)

157879 is the offset for the particular unit's hp that i found by scanning memory

Post has been edited 4 time(s), last time on Jul 10 2009, 8:51 pm by crutex.



None.

Jul 10 2009, 8:47 pm rockz Post #13

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote
Now, you have the offsets! How do you get them into your map? Well you have a few choices. One, EUD Trig lets you export .trg files and import them into a map. Another is to use starforge. Change your starforge/data/Conditions.lst to have the following line for the "Deaths();" condition.

Condition Deaths(Player Player, Comparison Comparison, Number Number, Number Unit)

Make sure you change Conditions.lst in your starforge/data folder to allow for a number for units instead of the name (you want "Number Unit" rather than "Unit Unit"). The way I did it, since I didn't know Starforge could handle EUDs, was download mapkit, break open the chk, and hex edit the trig section.
Quote
(Memory Offset you want to read - Death Table location)/4 = Player number.

As a note, "Memory" is actually just "Deaths(Playernum, quantcompare, quantnum, 0 (Terran Marine))". It's not worded very well in SCMDraft.

The first number is the LOCATION of the memory you want to read, and the second number is the actual number. If you are reading the first byte, and it's normally followed by 3 bytes of zeros, you just use the number. If it's the 2nd byte, you use the number*256.
Is it really that hard?



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

Jul 10 2009, 8:52 pm crutex Post #14



Quote from rockz
stuff
what is the cooldown relative to though? is it stored for each unit? the hp thing is easy to find because you can set it to whatever value you want.



None.

Jul 10 2009, 8:57 pm rockz Post #15

ᴄʜᴇᴇsᴇ ɪᴛ!

cooldown is the number of frames a unit has to wait after beginning the attack sequence before it can attack again. There is a cooldown timer which is easily detectable for each unit. There is a reference cooldown in units.dat which describes the base cooldown of the unit. This is already known. It can't be changed. Somehow, using upgrades, some units can attack faster, presumably by the flag I posted earlier.



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

Jul 10 2009, 9:14 pm Toothfariy Post #16



Quote from crutex
make a new trigger and under conditions look for "Memory" if it's not there you haven't got the latest scmdraft

it will translate it into a death condition for you. with the memory condition you just specify the offset and value to check

like for one of my units i use to check if the unit goes below 50% hp but is not dead (between 1 and 1000 cause the unit has 2000 max hp)

157879 is the offset for the particular unit's hp that i found by scanning memory
so how do u go from the hex number that EUDTrig calls for to that number there?



None.

Jul 10 2009, 9:16 pm rockz Post #17

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote
(Memory Offset you want to read - Death Table location)/4 = Player number.




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

Jul 10 2009, 9:17 pm crutex Post #18



Quote from rockz
cooldown is the number of frames a unit has to wait after beginning the attack sequence before it can attack again. There is a cooldown timer which is easily detectable for each unit. There is a reference cooldown in units.dat which describes the base cooldown of the unit. This is already known. It can't be changed. Somehow, using upgrades, some units can attack faster, presumably by the flag I posted earlier.
hmm using datedit I could not find a cooldown value listed for any unit.



None.

Jul 10 2009, 9:22 pm Toothfariy Post #19



Quote from rockz
Quote
(Memory Offset you want to read - Death Table location)/4 = Player number.
okay... so whats the death table location?

i am just super confused

i have this

memory offset: 0x59CCB1
player: 2
unit id: 1586

waht do i do now?

Post has been edited 1 time(s), last time on Jul 10 2009, 9:36 pm by Toothfariy.



None.

Jul 10 2009, 11:05 pm rockz Post #20

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from crutex
Quote from rockz
cooldown is the number of frames a unit has to wait after beginning the attack sequence before it can attack again. There is a cooldown timer which is easily detectable for each unit. There is a reference cooldown in units.dat which describes the base cooldown of the unit. This is already known. It can't be changed. Somehow, using upgrades, some units can attack faster, presumably by the flag I posted earlier.
hmm using datedit I could not find a cooldown value listed for any unit.
Do you see it now? It's under weapons.

Quote from Toothfariy
Quote from rockz
Quote
(Memory Offset you want to read - Death Table location)/4 = Player number.
okay... so whats the death table location?

i am just super confused

i have this

memory offset: 0x59CCB1
player: 2
unit id: 1586

waht do i do now?
Death table is player 1 deaths of terran marine. You can either find it yourself or look online, but I'd recommend finding it yourself. It's already on the EUDDB.
(0x59ccb1-0x58a364)/4 = 19027

Your condition will look like this:
memory(19027, quantcompare, quantmod)

Post has been edited 1 time(s), last time on Jul 11 2009, 1:43 am by rockz.



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

Options
Pages: 1 2 34 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:36 pm]
RIVE -- Nah, I'm still on Orange Box.
[04:36 pm]
Oh_Man -- anyone play Outside the Box yet? it was a fun time
[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
[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.
[2024-4-27. : 7:56 pm]
Ultraviolet -- NudeRaider
NudeRaider shouted: "War nie wirklich weg" 🎵
sing it brother
[2024-4-27. : 6:24 pm]
NudeRaider -- "War nie wirklich weg" 🎵
[2024-4-27. : 3:33 pm]
O)FaRTy1billion[MM] -- o sen is back
[2024-4-27. : 1:53 am]
Ultraviolet -- :lol:
[2024-4-26. : 6:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
Please log in to shout.


Members Online: Oh_Man