Alright so I don't know how many of you here are very familiar with Unreal Script but I figured I'd ask anyway. I'm trying to figure out a way to get a weapon to heal people when shot. Negative health doesn't work and I think there's some built in functionality for this already (the link gun can heal vehicles) but I don't know where the code is or how to make use of it.
If any of you can help out that would be great.
Replies
If you want to use projectiles, you'll have to create a custom projectile class and then override the ProcessTouch function. If you want to use an instant hit weapon, you can override the ProcessInstantHit function in the weapon class itself.
I just tested this on an instant hit weapon, and it seems to work:
Every time you shoot the pawn, its health increases by 10. If you only wanted certain classes or subclasses to be healed, you just replace "Pawn" with whichever parent class.
If you want to use the projectile class instead, you'd write something similar, but replace "Impact.HitActor" with "Other" in the ProcessTouch function. I don't have a projectile weapon setup at the moment, though.
So the updated code would look like this:
The difference is that the function I posted earlier doesn't check if the pawn's health is > 0, and it can heal over the pawn's max health.