Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Advanced EUD - Regen rate?
Advanced EUD - Regen rate?
Feb 5 2019, 10:53 pm
By: MTiger156  

Feb 5 2019, 10:53 pm MTiger156 Post #1

Veteran Mapper

For several months, I've been watching Korean maps being played on youtube in order to learn and replicate their EUD techniques (Koreans are WAY ahead on EUD knowledge, if you didn't know).

One thing I haven't solved is how they push regen/recharge rates as high as 40/sec. Maybe I'm just not looking hard enough at the available memory addresses?
(All of this is being done on Remastered multiplayer, so very unlikely it was modded)




Feb 5 2019, 10:57 pm Lanthanide Post #2



There's no memory address for it, beyond turning the standard protoss shield or zerg HP regen on or off.

They'll simply be running a loop that adds shields / HP every execution to each unit via the cUnit struct. Simple. I did it in the last version of my DS Night Remastered map 3.21 for the Roach , Immortal and Void Ray units.



None.

Feb 6 2019, 12:44 am MTiger156 Post #3

Veteran Mapper

Ohhh ok.
I'd like to employ this is a current project, but the necessary unit indexes would not be known ahead of time. Considering that you did regen EUDs in a DS map (involving tons of units killing eachother constantly), there's a way to "get" unit indexes by unit type and player ownership, right?
In my case, each player would own 1 of a unique unit type, so that already narrows it down. The problem then lies in how to handle respawning it and getting the new index.




Feb 6 2019, 11:35 pm Lanthanide Post #4



I just loop over all 1700 units and check if the unit type == Roach, if it does, add some HP.

You can loop over units owned by only particular players, to reduce the CPU load of the loop operation.

In the EUD Channel in SEN Discord, Armo gave an explanation a week or two ago for how you can use variables to track specific units. If a player only has a fixed number of units at a time and you only have to deal with respawning of them occasionally, then using variables to track specific units is a tenable approach.



None.

Feb 10 2019, 8:11 pm Ultraviolet Post #5



Quote from Lanthanide
I just loop over all 1700 units and check if the unit type == Roach, if it does, add some HP.

You can loop over units owned by only particular players, to reduce the CPU load of the loop operation.

In the EUD Channel in SEN Discord, Armo gave an explanation a week or two ago for how you can use variables to track specific units. If a player only has a fixed number of units at a time and you only have to deal with respawning of them occasionally, then using variables to track specific units is a tenable approach.




Like this?




Feb 10 2019, 11:11 pm Lanthanide Post #6



Yes.



None.

Aug 3 2020, 3:06 pm Ultraviolet Post #7



For anyone's benefit who reads this topic later, here's a private message between SPyro_Malin and myself:

Quote from SPyro_Malin
Hey there, you seem to have worked out this http://www.staredit.net/topic/17741/#6
How do you add some hp to unit instead of setting it to a %? Or is it just giant loop of detecting exact ammount of hp and setting it slighty higher?

Hey, it's a little more elegant than that. I use EUD Editor 2 for this purpose. Here's an image of the advanced portion of EUD Editor 2's TriggerEditor where I have a trigger from one of my maps to regenerate HP for any Fenix (Zealot) owned by Player 1:



The first part is a For All Unit loop with Player 1 as the selected player which simply cycles through all of Player 1's units every trigger cycle. Then I create a new If condition which is basically a standard trigger and I set the conditions to detect if the unit being pointed at is a Fenix (Zealot) and if its HP is at most 149 (HP is stored where every single value we can see = 256 because the last section is used for detecting partial HP for regeneration, so 149*256 = 38144). These conditions can be found under "Structure" then "CUnitData" in EUD Editor 2's TriggerEditor. The first field I always set to ptr which just tells it to detect whichever unit is currently being pointed at in the for loop. The second field tells you what data you're checking. I use unitType to detect if the unit is Fenix or not and hitPoints to detect quantity of HP. Once you have your conditions, you must decide what you're going to do to the unit if the conditions are met. So for actions in the case, we do a similar thing. We create a new action and go to "Structure" then "AddCUnitData". For HP regeneration we'll add a quantity to ptr for hitPoints. This quantity will be added every trigger loop (so once every ~2 seconds with non-hyper triggers, 12 times per second with hyper triggers and 24 times per second with ultra hyper triggers, on fastest game speed). So in my example, my map has hyper triggers and the Fenix (Zealot) unit also has (Zerg) Regeneration ticked under his advanced settings. So every second he will regenerate 14*12 + 4*24 (4 is the quantity of hp regenerated with zerg regeneration and it is regenerated once per frame which is 24 per second on fastest game speed) = 264/256 =~ 1 HP/s (1.03125 precisely). I detect that his HP is under 149 in the health regeneration trigger because adding CUnitData doesn't consider what the max HP of the unit is. In my map Fenix's max HP is 150, so I make sure the regeneration trigger won't operate if his current HP is above 149.




Aug 5 2020, 7:50 pm SPyro_Malin Post #8



10/10



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[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
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
[2024-4-17. : 1:08 am]
O)FaRTy1billion[MM] -- i'll trade you mineral counts
Please log in to shout.


Members Online: RIVE, Roy