Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Detecting Loss in Energy
Detecting Loss in Energy
May 22 2008, 4:44 am
By: Kow  

May 22 2008, 4:44 am Kow Post #1



So I'm trying to make a dark swarm firing system, but I'm gonna basically have teams, so I want to be able to know who shot what, etc, to eliminate friendly fire. I thought to detect if energy goes down at the same time as the DS is out, to attribute that DS to that guy.

Thing is, I don't really know how to do EUD conditions anymore, and I looked through the things on farty's site and can't find anything regarding unit Energy. Can I get some help here?



None.

May 22 2008, 5:24 am Falkoner Post #2



Just to eliminate any odd suggestions, the only way to detect energy loss is through EUDs, although it is quite possible to make a good guess at who fired it, it will not be perfect without EUDs.



None.

May 22 2008, 5:27 am Kow Post #3



Wait, so is there a way to detect who fired a DS directly using EUD, or are you just reiterating my point?



None.

May 22 2008, 5:34 am Falkoner Post #4



No, Dark Swarms are owned by player 12, I'm sure you can detect the order to cast a spell though, I was just making sure no one tried to post crack-pot ideas on how you could do it. Although here's one that was put up a while ago, I think by Tux:

Code
As for the shot conflict, there are a few methods for handling this.
What you'll want to do is to have a large location for each player
to encompass the maximum firing range of a dark swarm (18x18 grid
squares, if I remember correctly), and then to activate the "Firing
Event" only for the player who has the dark swarm inside their
location. Alternatively, you could center just a single encompassing
location on any dark swarms in the Anywhere location, and check
which players are within that location, then activate the shot for
that player(s).

The problem now is when shots occur close to other players, as there
won't be any way to distinguish between which player cast the dark
swarm. One solution is to simply disable dark swarms cast next to
more than one players altogether, as I've done in my Trigger Happy
D map. However, as you may have noted from playing the map, this can
get frusterating when players are ignorant of this rule, or else in
a hurry to make a shot.
Another solution is to register the shot for the first player whose
triggers catch the dark swarm, which could be problematic for one
player shooting into another's zone and having all the shots register
for that player.
Another solution still would be to register the shot for both players,
which can still be problematic but it will at least guarantee that
whoever makes the shot actually gets it.
Finally, you could avoid the situation altogether by preventing
players from getting close enough to fire within their zones, either
by physically preventing them from with terrain blockers, barriers,
or boundary locations, or else relocating the players to their starting
positions if detected within each others' zones (or else relocate only
if shots are detected in their shared zones, maybe after a certain
limit, so players who abuse the no-shot rule frequently will be
moved before those who don't.)


(Sorry about weird formatting)

But I'm pretty sure none of those are what you are going for, so yes, you will need to use EUDs.



None.

May 22 2008, 5:34 am Impeached Post #5



He's reiterating.

Anyway, place a defiler on the map, get it to a weird number of energy points (like say 164), and then search for the number in ArtMoney.

Then, to make sure the address you find is right, change the 'Value' to something like 400 and see if the defiler has 400/200 energy. If it does, copy/paste the address into Farty's EUDTrig, and you'll get what you need to detect that defiler's energy (I think this'll work, though I may be wrong).



None.

May 22 2008, 5:52 am Kow Post #6



And I can get these things where? And I can learn how to use these things where?

Thankies :P



None.

May 22 2008, 1:00 pm Impeached Post #7



Ah, I thought you meant you still knew some stuff.

Google ArtMoney, and get EUDTrig here. You'll also want Starforge. You'll need to customize it. Go into your Starforge's 'Conditions.lst' (opened in Notepad), and change Condition Deaths(Player Player, Comparison Comparison, Number Number, Unit Unit) to Condition Deaths(Player Player, Comparison Comparison, Number Number, Number Unit) (make sure Starforge is closed), then save the Conditions.lst.

1. Open ArtMoney
2. Start playing your Starcraft map, with the defiler you want to detect first placed.
3. Go to 'Broodwar' in the list-thing at the top of ArtMoney
4. Search for the amount of energy on your defiler. If you get more than 3-4 results, change the defiler's energy again and search for its amount with the 'filter' option.
5. You'll know you found the correct value for the defiler's energy when you change the amount in the 'value' box and he defiler's energy changes.
6. Once you find the correct memory offset, copy/paste the memory offset into the memory offset box of EUDTrig.
7. Press the 'down' button in EUDTrig
8. Press the 'Exporter' button in EUDTrig
9. Type in the Player Number/Unit ID given to you, with other info, with the Starforge button selected
10. To find the exact value of the energy you want to detect, look at the number of 00 at the bottom of EUDTrig. If there is one set of 00, you have to multiply the value you want to detect (i.e. see if there's 5 energy) by 16. If there are two 00, you have to multiply it by 256. etc etc.
11. Type the correct value into the 'Value' box, and press 'Add'.
12. Open starforge, go to your trigger, and paste the energy condition in. It should work fine.

If you don't get it, feel free to ask. I won't treat you like an idiot...I didn't get it for awhile and got kinda condescended, but it's damn hard to understand. :P

Post has been edited 2 time(s), last time on May 22 2008, 1:06 pm by Impeached.



None.

May 22 2008, 5:28 pm Kow Post #8



When I was doing EUD (Actions), none of this was required...

So I was messing around with ArtMoney last night, and I just couldn't find the energy thing. I even made a map that set the defiler's energy to something like 137 or something like that, and I searched that value, and it still returned like 26 or so. I changed every single one of them ('cause I still dont see how I can match the energy at the exact time that it's x energy) and the energy didn't change. Bleh.



None.

May 22 2008, 5:36 pm Heimdal Post #9



If you know the index of the unit in the unit array, then you can figure out the offset from that. The offset for energy within the unitnode is 0xA2. http://farty1billion.dyndns.org/EUDDB/?pg=ref&a=unitnode

What is the max energy of a unit? I would have though that the low-order byte for energy would be the regeneration counter like it is for HP and shields. But 255 is too low, right? It's also possible that the regeneration counter is less than 8 bits, in which case ArtMoney would never be able to find the value.



None.

May 22 2008, 9:42 pm rockz Post #10

ᴄʜᴇᴇsᴇ ɪᴛ!

See my visual guide as well. You'll need to find HP to find just about everything else anyway. I'll look into this.
http://www.staredit.net/topic/2757/



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

May 23 2008, 4:29 am DT_Battlekruser Post #11



Quote
When I was doing EUD (Actions), none of this was required...

That's because we were modifying the DAT table, and DoA and I did all the dirty work so you could just pick your data offset from MemCalc 3 and go off. When I finish v6 you should be able to do that again.

Quote
It's also possible that the regeneration counter is less than 8 bits, in which case ArtMoney would never be able to find the value.

I really, really doubt that they split values or flags not on a byte.




None.

May 23 2008, 5:09 am rockz Post #12

ᴄʜᴇᴇsᴇ ɪᴛ!

I found it no problem. Something tells me you are doing it wrong. Have hyper triggers constantly set energy to some value, then go on a separate beacon to change the energy to something else, and sieve.

I found a 2 byte and 4 byte value which both seem to show the energy. It looks like the 2 byte value is the actual value, since if I change it, the energy actually gets changed, whereas it doesn't change if I edit the 4 byte value.

So yes, you can detect energy. Now the question is how do you actually use it? You can't detect "I just spent 100 energy" very easily. I suppose you can detect when you have less than max energy, and constantly set energy to the max.



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

May 23 2008, 6:17 am Falkoner Post #13



Can you detect when a unit gets the command to cast a spell? That seems like it would be more useful.



None.

May 23 2008, 1:04 pm Impeached Post #14



With energy detection, you can easily detect a casting of Swarm using hypers. Just make swarm cost 250, and make it detect at most 1 energy, then set it to max once casted.



None.

May 23 2008, 2:33 pm DT_Battlekruser Post #15



If energy is a short, then you wont be able to detect a cast if it is in the trailing bytes. You would have to preplace your defilers and make sure you put them in every other Local ID.



None.

May 23 2008, 5:14 pm Heimdal Post #16



I think you'd be able to detect the spell cooldown. It's only 1 byte, but it'd be the highest-order byte:

+0x54 - BYTE bMainOrderTimer
+0x55 - BYTE bGroundWeaponCooldown
+0x56 - BYTE bAirWeaponCooldown
+0x57 - BYTE bSpellCooldown

The energy value is in the high 2 bytes as well:

+0xA0 - WORD wQueue5
+0xA2 - WORD wEnergy

Of course, I'm assuming farty's tables are correct :)

Quote from DT_Battlekruser
Quote
It's also possible that the regeneration counter is less than 8 bits, in which case ArtMoney would never be able to find the value.

I really, really doubt that they split values or flags not on a byte.[/color]
On the contrary, this would make perfect sense if they wanted a higher max energy value (like 1024) and still needed a regeneration counter. You'd use the high 10 bits as the actual value, and the low 6 bits for your regeneration counter. Every frame, just add 1 to the short. To get the unit's actual energy, shift it right by 6 bits (a cheap operation). This is why HP appears to be a 3-byte integer - the low 8 bits are the regen counter - but there's no reason that couldn't be fewer than 8 bits.

You are correct that they wouldn't split two unrelated values across byte boundaries, but it would make sense for the way they manage things like HP, energy, and shields.

Now that I think of it, there's a perfect example of this in action - the supply counters. They're twice as large as they are displayed because zerglings and scourges take up half a supply. It's like getting 1 bit of decimal places, without using floating points. This is actually called fixed point arithmetic.

Post has been edited 2 time(s), last time on May 23 2008, 5:23 pm by Heimdal.



None.

May 23 2008, 5:38 pm Clokr_ Post #17



Quote from Heimdal
Now that I think of it, there's a perfect example of this in action - the supply counters. They're twice as large as they are displayed because zerglings and scourges take up half a supply. It's like getting 1 bit of decimal places, without using floating points. This is actually called fixed point arithmetic.

HP also works that way. That's why when you attack an unit with 255 shields with an unit that does 1 damage the HP gets reduced by 1 every two hits.
That's also why the extra HP box gives them +1 HP (SC rounds HP up to display it).



?????

May 23 2008, 5:41 pm Heimdal Post #18



Quote from Clokr_
HP also works that way. That's why when you attack an unit with 255 shields with an unit that does 1 damage the HP gets reduced by 1 every two hits.
That's also why the extra HP box gives them +1 HP (SC rounds HP up to display it).
Quote from Heimdal
This is why HP appears to be a 3-byte integer - the low 8 bits are the regen counter - but there's no reason that couldn't be fewer than 8 bits.
That's what I said :P. I was giving an example where the "fractional" part was less than 8 bits.



None.

May 23 2008, 6:05 pm Clokr_ Post #19



... Dunno why I read energy instead of HP, nvm then :P



?????

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[03:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
[2024-5-16. : 8:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
Please log in to shout.


Members Online: Roy