I am making a welding gun, the primary fire shoots like ak12 and the secondary fires a welding armor grenade, for now I have managed to make it work but there is a small problem. I want the welding grenade from the alt fire to blow up instantly when hits a wall, a player or anything else. The Grenade projectile extends from MedicNade.
This is my code, hopefully someone can help me
This is my code, hopefully someone can help me
Code:
class GrazaBombProjectile extends MedicNade;
function HealOrHurt(float DamageAmount, float DamageRadius, class<DamageType> DamageType, float Momentum, vector HitLocation)
{
local actor Victims;
local float damageScale;
local KFPawn KFP;
local Pawn P;
local KFPlayerReplicationInfo PRI;
local int MedicReward;
local float HealSum;
local int PlayersHealed;
local KFMonster KFMonsterVictim;
NextHealTime = Level.TimeSeconds + HealInterval;
foreach CollidingActors (class 'KFPawn', KFP, DamageRadius, HitLocation)
if (KFP.ShieldStrength + 1 <= KFP.ShieldStrengthMax) KFP.ShieldStrength += 1;
else KFP.ShieldStrength = KFP.ShieldStrengthMax;
foreach CollidingActors (class 'Actor', Victims, DamageRadius, HitLocation)
{
P = Pawn(Victims);
if( P != none )
{
KFP = KFPawn(Victims);
if( KFMonsterVictim != none )
damageScale *= KFMonsterVictim.GetExposureTo(Location + 15 * -Normal(PhysicsVolume.Gravity));
}
if( KFP == none )
{
if( Pawn(Victims) != none && Pawn(Victims).Health > 0 )
{
}
}
else
{
if( Instigator != none && KFP.ShieldStrength > 0 && KFP.ShieldStrength < KFP.ShieldStrengthMax )
{
if ( KFP.bCanBeHealed )
{
PlayersHealed += 1;
MedicReward = HealBoostAmount;
PRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
HealSum = MedicReward;
if ( PRI != None )
{
MedicReward = int((FMin(float(MedicReward),KFP.ShieldStrengthMax)/KFP.ShieldStrengthMax) * 40);
PRI.ReceiveRewardForHealing( MedicReward, KFP );
if( PlayerController(Instigator.Controller) != none )
PlayerController(Instigator.Controller).ClientMessage(SuccessfulHealMessage$KFP.GetPlayerName(), 'CriticalEvent');
//KFSteamStatsAndAchievements(KFPlayerController(KFHumanPawn(Instigator).Controller).SteamStatsAndAchievements).AddWeldingPoints(int(MyDamage));
}
}
}
}
KFP = none;
}
if (PRI != none)
bHurtEntry = false;
}
simulated function Explode(vector HitLocation, vector HitNormal)
{
bHasExploded = True;
BlowUp(HitLocation);
PlaySound(ExplosionSound,,TransientSoundVolume);
if( Role == ROLE_Authority )
{
bNeedToPlayEffects = true;
AmbientSound=Sound'Inf_WeaponsTwo.smoke_loop';
}
if ( EffectIsRelevant(Location,false) )
{
Spawn(Class'KFNadeHealing',,, HitLocation, rotator(vect(0,0,1)));
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
}
defaultproperties
{
MaxHeals=80
HealInterval=0.10
SuccessfulHealMessage="You welded "
ExplosionSound=SoundGroup'KF_GrenadeSnd.NadeBase.MedicNade_Explode'
Speed=3000.0
MaxSpeed=3000.0
ExplosionDecal=Class'MedicNadeDecal'
Texture=Texture'kf_fx_trip_t.Misc.smoke_animated'
StaticMesh=StaticMesh'kf_generic_sm.Bullet_Shells.40mm_Warhead'
DrawScale=3.0
}