Announcement

Collapse
No announcement yet.

Not getting killcredit for something

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Not getting killcredit for something

    Similar to an ONSDecoy, only this thing damages locked on Avrils and their instigators. However if I switch seats, I no longer get any credit for the kills this thing makes, if I am in the right seat though everything is fine. Anyone got an idea how to fix it?

    Code:
    //-----------------------------------------------------------
    //  When out in the world, this can be used to destroy an avril.
    //-----------------------------------------------------------
    class DeathSphere extends Projectile;
    
    var class<emitter> 	DecoyFlightSFXClass; 	// Class of the emitter to spawn for the effect
    var class<emitter> 	DecoyLaunchSFXClass;	// Class of the emitter to spawn when launched
    var emitter			DecoyFlightSFX;			// The actual effect
    
    var Samael	ProtectedTarget;	// Protect this vehicle
    var byte	Team;
    var class<ONSTurretBeamEffect> 	BeamEffectClass[2];
    var array<actor> 		TargetArray;
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
    	Velocity = Speed * Vector(Rotation);	
    }
    
    function HitStuff(Actor A)
    {
        local vector X, HitLocation, HitNormal;
    	local Rotator Dir;
    
    	HitLocation = A.Location;
    
        Dir = rotator(HitLocation - Location);
    
        X = Vector(Dir);
    
                //P.TakeDamage(Damage, Instigator, HitLocation, MomentumTransfer*X, MyDamageType); Obsolete
    		
    	HurtRadius(Damage, DamageRadius, MyDamageType, MomentumTransfer, HitLocation);
    
            HitNormal = Vect(0,0,0);
    
        SpawnHitEffects(A, HitLocation, HitNormal);
    }
    
    simulated function SpawnHitEffects(actor HitActor, vector HitLocation, vector HitNormal)
    {
    		local ONSTurretBeamEffect Beam;
    
    		if (Level.NetMode != NM_DedicatedServer)
    		{
    			Beam = Spawn(BeamEffectClass[Team],,, Location, rotator(HitLocation - Location));
    			BeamEmitter(Beam.Emitters[0]).BeamDistanceRange.Min = VSize(Location - HitLocation);
    			BeamEmitter(Beam.Emitters[0]).BeamDistanceRange.Max = VSize(Location - HitLocation);
    			BeamEmitter(Beam.Emitters[1]).BeamDistanceRange.Min = VSize(Location - HitLocation);
    			BeamEmitter(Beam.Emitters[1]).BeamDistanceRange.Max = VSize(Location - HitLocation);
    			Beam.SpawnEffects(HitLocation, HitNormal);
    		}
    }
    
    simulated function PostNetBeginPlay()
    {
    	super.PostNetBeginPlay();
    
    	if ( EffectIsRelevant(Location, false) )
    		Spawn(DecoyLaunchSFXClass,,,location,Rotation);
    
    	if ( (Level.NetMode != NM_DedicatedServer) && (DecoyFlightSFXClass != None) )
    	{
    		DecoyFlightSFX = spawn(DecoyFlightSFXClass);
    		if (DecoyFlightSFX!=None)
    			DecoyFlightSFX.SetBase(self);
    	}
    
    	SetTimer(1,true);
    }
    
    Simulated function Timer()
    {
    	local int	i;
    	local Weapon W;
    
    	for(i = 0; i < TargetArray.Length; i++)
    	{
    		if(TargetArray[i] != None && FastTrace(TargetArray[i].Location, Location) && Vsize(TargetArray[i].Location - Location) < 20000)
    		{
    		HitStuff(TargetArray[i]);
    		}
    		Else if(TargetArray[i] != None && ONSAvrilRocket(TargetArray[i]) != None && !FastTrace(TargetArray[i].Location, Location))
    			ONSAvrilRocket(TargetArray[i]).OverRideTarget = self;
    	}
    
    	TargetArray.Length = 0;
    
    }
    
    simulated function MarkMissile(actor Aggressor)
    {
    	TargetArray[TargetArray.Length] = Aggressor;
    }
    
    simulated event Destroyed()	
    {
    local int i;
    
    	super.Destroyed();
    
    	if (ProtectedTarget!=None)
    	{
    		for (i=0;i<ProtectedTarget.Stars.Length;i++)
    		{
    			if (ProtectedTarget.Stars[i]!=none && ProtectedTarget.Stars[i] == self)
    			{
    				ProtectedTarget.Stars.Remove(i,1);
    				return;
    			}
    		}
    	}
    
    	if (DecoyFlightSFX!=None)
    		DecoyFlightSFX.Destroy();
    }
    
    
    simulated function Landed( vector HitNormal )
    {
    	super.Landed(HitNormal);
    	Destroy();
    }
    
    defaultproperties
    {
         BeamEffectClass(0)=Class'OnslaughtBP.ONSBellyTurretFire'
         BeamEffectClass(1)=Class'OnslaughtBP.ONSBellyTurretFire'
         DecoyFlightSFXClass=Class'OnslaughtBP.ONSDecoyFlight'
         DecoyLaunchSFXClass=Class'OnslaughtBP.ONSDecoyLaunch'
         Speed=500.000000
         MaxSpeed=1500.000000
         Damage=50.000000
         DamageRadius=250.000000
         MomentumTransfer=10000.000000
         Physics=PHYS_Falling
         AmbientSound=Sound'CicadaSnds.Decoy.DecoyFlight'
         MyDamageType=class'DamTypeDeathStar'
         LifeSpan=5.000000
         bBounce=True
    }

    #2
    Remember the Controller at the time the Projectile was shot, then use his current pawn when inflicting damage. That should cut it. I have no experience with vehicles though, so there might be an easier way.

    Comment

    Working...
    X