Announcement

Collapse
No announcement yet.

KActor Collision Damage

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

    KActor Collision Damage

    I'm trying to make one Kactor collide with another Kactor so that it does damage and plays a matinee but it doesn't seem to be working, does anyone know how to set this up?

    Cheers!
    Magon

    #2
    i cant get to udk to test anything at the minute but Ambershee posted some code that makes a KActor do damage.it would be a good starting point. and to create a trigger you would have to create a dynamic trigger volume and attach it to the KActor and use this to set the matinee playing.here is Ambershee code.

    //-----------------------------------------------------------
    // Autumn_Damage_KActor.uc
    // A kind of KActor that can damage the pawn
    //-----------------------------------------------------------
    class Autumn_Damage_KActor extends KActor;

    // True for can damage the pawn, False for can not, default is True
    var() bool bDamagePawn;
    // The max damage take to the pawn when the hit velocity reaches the MaxDamageVelocity
    var() int MaxDamageAmount;
    // The limitation of the velocity to damage the pawn, 40 by default
    var() float MinDamageVelocity;
    // If the velocity reaches this point, it will take the max damage to the pawn
    var() float MaxDamageVelocity;


    // Damage the pawn when touching it
    event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
    {
    local Pawn P;
    local int DamageAmount; // Damage points take to the pawn

    if (bDamagePawn)
    {
    P = Pawn(Other);
    if( P != none && P.Controller != none )
    {
    if( MinDamageVelocity < 0 )
    MinDamageVelocity = 0;

    // Only damage the pawn when the hit velocity reaches to the MinDamageVelocity
    if( VSize(Velocity) >= MinDamageVelocity )
    {
    // Max damage the pawn when the velocity reaches the max velocity
    if( VSize(Velocity) >= MaxDamageVelocity )
    {
    DamageAmount = MaxDamageAmount;
    }
    else // count the damage if not reaches the max velocity but faster than the min
    {
    DamageAmount = MaxDamageAmount * (( VSize(Velocity) - MinDamageVelocity ) / ( MaxDamageVelocity - MinDamageVelocity ));
    }
    P.TakeDamage(DamageAmount, None, HitLocation, vect(0,0,0), class'DamageType');
    }
    }
    }
    }

    defaultproperties
    {
    Begin Object Name=MyLightEnvironment
    bEnabled=True
    End Object

    bDamagePawn = true;
    MinDamageVelocity = 40;
    MaxDamageVelocity = 1000;
    MaxDamageAmount = 100;
    //DamageAmount = 1000;
    // bWakeOnLevelStart not must be false here
    bWakeOnLevelStart = false;
    // bNoEncroachCheck MUST BE FALSE here for Touch event can work
    bNoEncroachCheck = false;
    }Knew I'd done it before.

    Comment

    Working...
    X