Author Topic: Having an item heal you then drain your HP back to what it used to be?  (Read 1278 times)

I need to know this for my Pain Pills mod i'm making, i need to know if it's possible to make it so once someone uses the pills, they get healed fully, but they're HP drains back to what it used to be before they used the pills

If this ain't possible, let me know

Possible but will likely involve schedules.


Possible but will likely involve schedules.
I was thinking it may involve schedules

Bump

Edit: I also want my pills to do the shiftAway thing like most guns do when fired, but i got the play thread shift away thing in the onFire script with the other stuff, but it doesn't work, also, i'm trying to get the pills to stop moving in the firstperson view by setting the eyeOffset to something other than 0.0 0.0 0.0, but when i set it to something like 0.0 0.0 0.1 or 0.0 0.0 0.01, it disappears :<
« Last Edit: March 08, 2009, 11:20:39 AM by Masterlegodude »

Try setting the offset to around 0 0 1. It's probably under your line of view and you can't see it from first person.

Try setting the offset to around 0 0 1. It's probably under your line of view and you can't see it from first person.
K, i'll try that

Edit: Okay, i got the eyeOffset done, now i just need the shiftAway thing to work and fix the heal points, i was messing with it and it only makes your HP 50, so it hurts you if you're 51 or higher in HP, but heals you when you're 49 or lower
« Last Edit: March 08, 2009, 08:37:06 PM by Masterlegodude »

Shiftaway: Look at the Gun. Play the animation when the item is used. In any case, won't it just disappear from your hand and look weird? (Unless it takes time to use...)

Healing: Use %obj.getDamageLevel() to get the current damage amount. Subtract the amount you need from this (it's the current amount you have been hurt by, not the current amount of health left!), making sure it doesn't go below zero, then use %obj.setDamageLevel() to this. Use schedules to continually reduce the health by one or two every 100-500ms. Use a counter variable to only reduce the health by the amount it adds on.

Shiftaway: Look at the Gun. Play the animation when the item is used. In any case, won't it just disappear from your hand and look weird? (Unless it takes time to use...)
I'm hoping it plays the animation then disappears when the animation finishes, if not, ah well, if it disappears while the animation plays, it's good enough, unless that can be fixed

Healing: Use %obj.getDamageLevel() to get the current damage amount. Subtract the amount you need from this (it's the current amount you have been hurt by, not the current amount of health left!), making sure it doesn't go below zero, then use %obj.setDamageLevel() to this. Use schedules to continually reduce the health by one or two every 100-500ms. Use a counter variable to only reduce the health by the amount it adds on.
Hmm, i'll see what i can do

Edit: I can't seem to figure out how to do that healing thing, it seems confusing :S
« Last Edit: March 14, 2009, 11:33:13 AM by Masterlegodude »

Bump, i'm confused...

Edit: I can't seem to figure out how to do that healing thing, it seems confusing :S

You add the health and progressivly take away from it maybe make a pain pills bar



Health boost level - - - - - -