Weapons
180
simulated function RespawnDestructible()
{
// Turns off fire/smoke particles
PSC.DeactivateSystem();
// Reset static mesh & re-attach SM component.
StaticMeshComponent.SetStaticMesh(RespawnSM);
if(!StaticMeshComponent.bAttached)
{
AttachComponent(StaticMeshComponent);
}
bDestroyed = FALSE;
}
- The main part of this class is the barrel exploding, which we simply name
Explode(). Within Explode() you'll find the HurtRadius() function, to which
we pass parameters for the base damage, radius, damage type, momentum applied
to the explosion, location, and whether or not it can apply full damage to the pawn.
Most, if not all, area-effect weapons in UDK use this function.
/****- Called when damage is taken or it is touched
****/
simulated function Explode()
{
local UTSD_SpawnedKActor PhysMesh;
- Called when damage is taken or it is touched
HurtRadius(30.0, 200.0, class'UTDamageType', 300.0,
Location,,, True);
// Swap or hide mesh when destroyed
if(MeshOnDestroy != None)
{
StaticMeshComponent.SetStaticMesh(MeshOnDestroy);
}
else
{
StaticMeshComponent.SetStaticMesh(None);
DetachComponent(StaticMeshComponent);
}
// Play sfx after object is destroyed
if(SoundOnDestroy != None)
{
PlaySound(SoundOnDestroy, TRUE);