Staredit Network > Forums > SC2 Assistance > Topic: Health Over Time
Health Over Time
Aug 17 2010, 2:57 pm
By: deathfromace  

Aug 17 2010, 2:57 pm deathfromace Post #1



Now in my game I have a medkit that heals for 40 at the moment but this is because I could not figure out the system I wanted.

I want it so when I pickup food it is automatically used and gets added to a counter of how much food you currently have. This would heal you for one health every 2seconds and when you have full health it would do nothing until health is lost. I assume this would be a combination of triggers and data editor but I am lost when it comes to triggers.



None.

Aug 17 2010, 6:18 pm Deev Post #2



Let me think out loud here.

Var [food] initially=0

Trigger: Player Takes Damage

If Player Hp is less than 100%
If Var [food] >0

Then

Var [food] -1
Add unit health 1
Wait 2
Repeat trigger

.. hmmm, this is just thinkin' out loud, might work if set up propperly.



None.

Aug 17 2010, 7:12 pm Temp Post #3



You could probably do this with data editor alone. Using a behaviour that uses up charges and gives health only when a unit is under 100% health should be do able.

You could set it up so that your food items add charges and have a periodic behaviour which causes a modify unit or healer effect with a cost of charges. You would also need a validator on the behaviour which checks to make sure the unit is <100% health



None.

Aug 19 2010, 10:34 pm Sand Wraith Post #4

she/her

Code
durr
   Events
       Unit - Any Unit dies
   Local Variables
   Conditions
       (Unit type of (Triggering unit)) == Zergling
       (Owner of (Killing unit)) == 1
   Actions
       Player - Modify player 1 Minerals: Add 40


Code
durr2
   Events
       Timer - Every 2.0 seconds of Game Time
   Local Variables
   Conditions
       (yourUnit Life (Current)) < (yourUnit Life (Default))
       (Player 1 Minerals) >= 1
   Actions
       Player - Modify player 1 Minerals: Subtract 1
       Unit - Set yourUnit Life to ((yourUnit Life (Current)) + 1.0)


"durr" activates on kill of Zergling (assuming you kill your powerup to acquire it or something), and player 1 is the killer. P1 is given 40 "food (minerals)."
"durr2" works every 2 seconds, checking if the player has at least 1 food. If so, and the player's unit is not full HP, the player loses 1 food but the unit is healed by 1.

You'll probably be using something along the lines of that.




Aug 23 2010, 9:05 pm deathfromace Post #5



I tried going full data with it but I can't seem to get it to work. I got the food behavior made and added it to my unit where it shows it along with stamina and power with that the food is meant to add 2 health per 2 secs. I am trying to make it so when the health kit is used it added it to the food bar but I can't get it to add to the counter.



None.

Aug 23 2010, 9:55 pm Temp Post #6



What are you using for a counter?



None.

Aug 23 2010, 10:07 pm deathfromace Post #7



Hmm was planning on making the food behavior I made the counter but I guess that counts as an attribute and can't be a counter..hmm. Is there just a food counter already in the code somewhere.



None.

Aug 23 2010, 11:45 pm Temp Post #8



There are a couple ways you might be able to do it. One is charges (need to be added to units through triggers), you also might be able to stack the behaviours. I would suggest charges, you can see an example of their use in the secret mission (for jim's pickups).



None.

Aug 28 2010, 11:36 am deathfromace Post #9



Unless im missing it I can only find how to take a charge away not add charges to a unit. I also am not sure how I would find the secret mission.



None.

Aug 28 2010, 7:24 pm Undead-Fox Post #10



On this note, where is the HP regeneration of the Zerg units located?
Would there be some way to turn that on or off depending on when it's needed?
And in StarCraft 2, the Zerg 'regen' works both directions, example would be when a building is off creep, it slowly loses health instead of gaining.
Would be helpful to make some sort of 'poison' effect in given areas of the map or something, or force some sort of unit to stay on Creep.



None.

Aug 28 2010, 7:34 pm Devourer Post #11

Hello

Data editor, unit specific.
Go to units -> stats -> HP regenration

That hp losing is nothing else than an effect, having a perodic 2nd effect reducing the building's hp by X.



Please report errors in the Staredit.Network forum.

Aug 28 2010, 7:59 pm payne Post #12

:payne:

Anyone would be kind enough to create a Wiki about this please?
http://www.staredit.net/?p=wiki



None.

Aug 28 2010, 11:57 pm Temp Post #13



Quote from deathfromace
Unless im missing it I can only find how to take a charge away not add charges to a unit. I also am not sure how I would find the secret mission.

Although strange in order to add charges simply take away a negative amount. To open a campaign map go to open a file like normal but change the tab on the top of the window to campaign.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:18 am]
Sylph-Of-Space -- No complaints here, i'm just curious!
[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.
[2024-5-18. : 3: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
Please log in to shout.


Members Online: Roy