Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: [SOLVED] Detecting energy of a high templar
[SOLVED] Detecting energy of a high templar
This topic is locked. You can no longer write replies here.
Aug 13 2011, 6:32 pm
By: Ice Baby  

Aug 15 2011, 9:24 pm Ice Baby Post #21



Ok. So lets say i have the holding pen for the temps. I would need 18 then. The players would also be able to create templars but they will not be used the same way. Is there a way to have the temps in the pen defined just for that location? So the templars being created wont create an issue?

Also in the equation roy gave. What is the 84 represent?

Y = 161865 - 84x



None.

Aug 15 2011, 9:29 pm Roy Post #22

An artist's depiction of an Extended Unit Death

84 is a constant representing the length between start indexes for units. Each unit has 84 EPD values associated with it, so you multiply this by the Index ID to help find the starting point of a particular unit.

As for your prior question, as long as you uniquely identify the Templars you want to be affected (like the Location ID system), you won't have to worry about affecting other Templars.




Aug 15 2011, 9:42 pm Ice Baby Post #23



Ok so did i get this equation correct?
I just made a templar on my map. The index showed 757

Y = 161865 - 84(757)
Y = 161865 - 63588
Y = 98277

And to check the energy for anything less than 50 i would do???
16777216(49) + 16777215 = 838860799

So the way i want it the condition would be???
Memory at + 98277 is at most 838860799
Yes?



None.

Aug 15 2011, 9:53 pm Roy Post #24

An artist's depiction of an Extended Unit Death

Yes, those calculations are correct if that truly is your unit index. Since you have so many preplaced units before the High Templar, though, there's a good chance that this is not, or will not always be, the index of the High Templar.

Try it out and see if it works. If it does, great; if it doesn't, I wouldn't be surprised.

Select the High Templar, right-click -> properties. Click on the "Move Up" button to move its index to the top. The closer it is to index 0, the more you're guaranteed for that index to always be accurate.

Edit: There's a "Move to top" button that will work much better/faster.
Edit2: Apparently that button doesn't work. Damn you, SI!
Edit3: Apparently the "Move to top" button does work, if you look at the index column; it just doesn't physically move it to the top until you close and reopen the properties window.

Post has been edited 1 time(s), last time on Aug 15 2011, 9:59 pm by Roy.




Aug 15 2011, 9:59 pm Ice Baby Post #25



Ok that makes sense. So if an earlier unit dies, all the other preplaced unit indexes after that unit will shift closer to 0? Also is there a dif way to change the index so its at 0? "easier than just removing every single preplaced unit and then trying to readd them exactly where they were"

Edit: Ok that works great then. Ill try that. Sry i dont know how yo edit my last post

Post has been edited 1 time(s), last time on Aug 15 2011, 10:04 pm by Roy. Reason: Try not to double-post



None.

Aug 15 2011, 10:04 pm Roy Post #26

An artist's depiction of an Extended Unit Death

Quote from Ice Baby
So if an earlier unit dies, all the other preplaced unit indexes after that unit will shift closer to 0?
No. Once a unit is assigned an Index ID, it will have it until the day it dies. The reason you want them to be close to the top is because if a player has preplaced units, but the player isn't in the game, those units never existed, so all preplaced units' indexes shift down as the map initializes. This means depending which players are in the game, some units may start with different Index IDs. I explain this in a bit more detail here.
Quote from Ice Baby
Also is there a dif way to change the index so its at 0? "easier than just removing every single preplaced unit and then trying to readd them exactly where they were"
Use the "Move to top" button in the properties window to move the unit all the way to index 0.

P.S.: There's an icon on your posts that allows you to edit them. It looks like one of these:




Aug 17 2011, 4:59 am IAGG Post #27



Hey, so my brother is trying to help me with the high templar energy detection. When he did the triggering on the map, I watched him do the calculations as well.

This is what the calculations came to be.

I moved the 1st high templar to the very top to give him the index 0
y = 161865 - 84(0)
y = 161865 - 0
y = 161865

This brings my memory condition to:

Memory at + 161865 is X Y

Then because i want it to follow an action only if the energy is less than 50 i did
16777216(49) + 16777215 = 838860799

So my final condition would be:

Memory at + 161865 is at most 838860799

This brings my trigger to be:

Trigger("Player 1","Player 2","Player 3","Player 4","Player 5","Player 6"){
Conditions:
Command("Current Player", "Protoss High Templar", At least, 1);
Memory(161865, At most, 838860799);

Actions:
Modify Unit Energy("Current Player", "Protoss High Templar", 22, 1, "Area");
Preserve Trigger();

I am having an issue though. This trigger is just setting the high templar's energy to 55 constantly. It never gains energy. Im guessing that i did something wrong

Nevermind. Found what I as doing wrong. This should be the correct trigger for what im looking for. It works perfectly in my map. Thanks Sam and everyone else for the help.

Trigger("Player 1","Player 2","Player 3","Player 4","Player 5","Player 6"){
Conditions:
Command("Current Player", "Protoss High Templar", At least, 1);
Memory(19065, At most, 838860800);

Actions:
Modify Unit Energy("Current Player", "Protoss High Templar", 22, 1, "Area");
Preserve Trigger();

Post has been edited 2 time(s), last time on Aug 17 2011, 8:27 am by IAGG.



None.

Aug 17 2011, 5:00 am Ice Baby Post #28



Sry mike :/



None.

Aug 17 2011, 1:56 pm Roy Post #29

An artist's depiction of an Extended Unit Death

Quote from IAGG
I moved the 1st high templar to the very top to give him the index 0
y = 161865 - 84(0)
y = 161865 - 0
y = 161865
The formula is only for units with an index greater than 0. For the unit at index 0, you use the value found in http://www.staredit.net/topic/10471/0/ (19065). The correct memory condition is:

Memory at + 19065 is X Y

Quote from IAGG
Then because i want it to follow an action only if the energy is less than 50 i did
16777216(49) + 16777215 = 838860799
This calculation is correct.

Quote from IAGG
I am having an issue though. This trigger is just setting the high templar's energy to 55 constantly. It never gains energy. Im guessing that i did something wrong
This is most likely because the address from EPD 161865 is always less than 838860799, which would always pass as true, therefore making the trigger run constantly.

And yes, your final answer is correct. ^^




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[05:41 am]
Ultraviolet -- 🤔 so inf is in you?
[04:57 am]
O)FaRTy1billion[MM] -- my name is mud
[04:35 am]
Ultraviolet -- mud, meet my friend, the stick
[10:07 pm]
lil-Inferno -- nah
[08: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
[05:25 pm]
NudeRaider -- there he is, right on time! Go UV! :D
[05:24 pm]
lil-Inferno -- poopoo
[05:14 pm]
UndeadStar -- I wonder if that's what happened to me. A returned product (screen) was "officially lost" for a while before being found and refunded. Maybe it would have remained "lost" if I didn't communicate?
[03:36 pm]
NudeRaider -- :lol:
Please log in to shout.


Members Online: IlyaSnopchenko, 1taylorc781eL2