Game Development Reference
In-Depth Information
First, we define the pawn that is being hit. Then, it takes the
ProcessInstantHit() function and rather than have it apply damage to a pawn,
it applies additional health by calling our pawn's HealDamage() function. The first
parameter used by HealDamage() is an integer, which declares exactly how much
health each shot will heal a pawn for. We've set it to the modest value of 10 .
We use a log for debugging again and have it output our pawn's health each time
it is shot, through the call to P.Health .
* Heals a pawn with an instant hit weapon
* Doesn't allow pawn's health to exceed maximum (100)
simulated function ProcessInstantHit(byte FiringMode, ImpactInfo
Impact, optional int NumHits)
local Pawn P;
if (Impact.HitActor != None &&
// Defining the pawn
P = Pawn(Impact.HitActor);
// Increase health by 10
P.HealDamage(10, Instigator.Controller,
// Log for debugging
'Log("***Pawn Health:" @P.Health);
We still need to make one alteration to our DefaultProperties block.
// Do not perform any damage
We're telling the game that despite us using an instant hit weapon, we do not want it
to perform any damage. Therefore, we set the damage type to None .
Search Nedrilad ::

Custom Search