Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Possible to Detect Unit Life with EUD Conditions?
Possible to Detect Unit Life with EUD Conditions?
Mar 8 2022, 3:33 am
By: riffdex  

Mar 8 2022, 3:33 am riffdex Post #1



Building a map where you can swap weapons during battle. Basically I'd like to be able to use EUD to detect the unit HP of the current weapon, then when you swap to different weapon I'll use built in Action of "Set Unit Hit Points %" to align the newly equipped weapon with the life of the old equipped weapon. Won't be perfect but I think it'll be good enough. Possible to use EUDs to detect the initial unit's HP?



None.

Mar 8 2022, 7:25 am DarkenedFantasies Post #2

Roy's Secret Service

Yes. Before swapping the unit, find the unit's CUnit address, grab its HP value, change the unit, go to the player's Last Unit Pointer for the newly created unit's CUnit address, and apply your stored HP value to it (which would be much more precise than the set hit points percentage action).

Dunno if you're using an EUD editor, but if not, I can provide instructions to implement it manually if needed.




Mar 8 2022, 7:47 am TheHappy115 Post #3



A while ago I used a basic EUD Trigger editor and one of the features was detecting a specific units health.

I don't know to much about EUDs but I found:
1) You can run a trigger for when a specific unit is above/below or at a specific HP value. (Such as if a structure/unit reaches below 50% health or shields, spawn a bunch of enemies).
2) You can directly modify that units health. You can increase the health by exactly 10, or however much you want to. Beware, I noticed that this can go OVER the maximum health. (A unit could technically have 2500 health out of 2000 maximum. I never seen how it interacts with shields).
3) I found that when I used said EUD triggers, it would correct save files. Not sure how to get around this. This only matters if you value players saving games to come back to play later (such as campaigns or really long single player games or group friend RPG games).
4) As mentioned by DarkenedFantasies, its based on the Unit's address. Because of this, the unit needs already exist within the map (not made by a trigger). This can make death "seemingly" permanent as it would be very difficult to set a unit's address to the correct value mid-game. From asking around, I couldn't find a solution to this so it would be interesting if someone had one. A tedious way to get around would be to just have a "lives" system and preplaced copies of the unit. As a result, life-1 may be Index:0, life-2 may be Index:1, and life-3 may be Index:2 and so on. And the triggers, I imagine, would have to be copied with each new index value (which may be a pain).

I also did a test with a Siege Tank, and found that it seems to occupy multiple index points (Due to its ability to transform). Was entertaining since the test involved modifying its attackspeed to auto-reset each trigger check (essentially having it attack ~4 times a second).
Hope anything was helpful!.



None.

Mar 8 2022, 11:10 am DarkenedFantasies Post #4

Roy's Secret Service

Quote from TheHappy115
4) As mentioned by DarkenedFantasies, its based on the Unit's address. Because of this, the unit needs already exist within the map (not made by a trigger). This can make death "seemingly" permanent as it would be very difficult to set a unit's address to the correct value mid-game. From asking around, I couldn't find a solution to this so it would be interesting if someone had one. A tedious way to get around would be to just have a "lives" system and preplaced copies of the unit. As a result, life-1 may be Index:0, life-2 may be Index:1, and life-3 may be Index:2 and so on. And the triggers, I imagine, would have to be copied with each new index value (which may be a pain).
When creating a unit with a trigger, you simply use the player's "Last Unit Pointer" to find its index. Either store the value for later use or apply your actions to the unit any time before you create another. If you don't know the unit's index, you can go to the player's last unit and use "Previous Player Unit" to narrow down your search by cycling through only the units of that particular player, but it would be wise to keep track of the indexes you want whenever possible.




Mar 9 2022, 2:46 am riffdex Post #5



Quote from TheHappy115
4) As mentioned by DarkenedFantasies, its based on the Unit's address. Because of this, the unit needs already exist within the map (not made by a trigger). This can make death "seemingly" permanent as it would be very difficult to set a unit's address to the correct value mid-game. From asking around, I couldn't find a solution to this so it would be interesting if someone had one. A tedious way to get around would be to just have a "lives" system and preplaced copies of the unit. As a result, life-1 may be Index:0, life-2 may be Index:1, and life-3 may be Index:2 and so on. And the triggers, I imagine, would have to be copied with each new index value (which may be a pain).
When creating a unit with a trigger, you simply use the player's "Last Unit Pointer" to find its index. Either store the value for later use or apply your actions to the unit any time before you create another. If you don't know the unit's index, you can go to the player's last unit and use "Previous Player Unit" to narrow down your search by cycling through only the units of that particular player, but it would be wise to keep track of the indexes you want whenever possible.
Glad to see it's possible. EUDs are all new to be so it'll probably be awhile before I get to learning to implement them, but I wanted to see if it was possible before building the map around that expectation.



None.

Mar 12 2022, 7:12 pm riffdex Post #6



Quote from TheHappy115
4) As mentioned by DarkenedFantasies, its based on the Unit's address. Because of this, the unit needs already exist within the map (not made by a trigger). This can make death "seemingly" permanent as it would be very difficult to set a unit's address to the correct value mid-game. From asking around, I couldn't find a solution to this so it would be interesting if someone had one. A tedious way to get around would be to just have a "lives" system and preplaced copies of the unit. As a result, life-1 may be Index:0, life-2 may be Index:1, and life-3 may be Index:2 and so on. And the triggers, I imagine, would have to be copied with each new index value (which may be a pain).
When creating a unit with a trigger, you simply use the player's "Last Unit Pointer" to find its index. Either store the value for later use or apply your actions to the unit any time before you create another. If you don't know the unit's index, you can go to the player's last unit and use "Previous Player Unit" to narrow down your search by cycling through only the units of that particular player, but it would be wise to keep track of the indexes you want whenever possible.
Since you've replied to a few of my threads about the same map, I was wondering if you have time to play thru the map with me so I can explain the ideas I have (specifically EUDs and how i would like to implement them) we could also look at the Complex Hyper Triggers issue although I'm not particularly worried about that because I'm sticking with traditional HTs since they are working fine.



None.

Mar 12 2022, 8:35 pm DarkenedFantasies Post #7

Roy's Secret Service

Quote from riffdex
Since you've replied to a few of my threads about the same map, I was wondering if you have time to play thru the map with me so I can explain the ideas I have (specifically EUDs and how i would like to implement them)
I would prefer not doing that, sorry. I'm fine with just giving you pointers and stuff. Though, going by your current shoutbox discussion, if you're going to use an EUD editor, you'd be better off seeking on-hands help from someone else who uses them. I don't use them so I don't know the process of implementing EUDs that way, only manually through classic triggers, and as such could probably only be able to help by telling you what's technically possible or what you need to look for.

About your issue with the hyper triggers, just do as Ultraviolet said in the other thread. Either attach the map to your post so anyone can help, or PM me a link if you'd prefer to keep the map private. I don't understand why we should do it any other way.




Mar 12 2022, 9:59 pm riffdex Post #8



Quote from riffdex
Since you've replied to a few of my threads about the same map, I was wondering if you have time to play thru the map with me so I can explain the ideas I have (specifically EUDs and how i would like to implement them)
I would prefer not doing that, sorry. I'm fine with just giving you pointers and stuff. Though, going by your current shoutbox discussion, if you're going to use an EUD editor, you'd be better off seeking on-hands help from someone else who uses them. I don't use them so I don't know the process of implementing EUDs that way, only manually through classic triggers, and as such could probably only be able to help by telling you what's technically possible or what you need to look for.

About your issue with the hyper triggers, just do as Ultraviolet said in the other thread. Either attach the map to your post so anyone can help, or PM me a link if you'd prefer to keep the map private. I don't understand why we should do it any other way.
I sent you a direct message, thank you



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
[2024-4-20. : 7:56 pm]
Oh_Man -- lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
Please log in to shout.


Members Online: MetalGear