05- Destruction

I will be detailing three different ways to do damage states in UDK. These are just example, the engine is very flexible, and there are many other ways to do this. Use the Example map AOCTO-5-Destruction.

--

Initialization

Same setup as all my previous example. Disable elements on Loaded and Visible. Enable on Level Reset.

 

Gate 01

The first gate is an AOCStaticMeshActor. You can convert a regular Static Mesh with Right Click > Convert to AOCStaticMeshActor.

The selected Mesh is: StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade'

The mesh being hidden on Level Load, acting as the destroyed version is: StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade_Damage_03'

-Gib Meshes can be whatever you want, but I like StaticMesh'CHV_Gate_PKG.Meshes.pm_wood_piece'. These will fly out of the mesh when destroyed.

-ParticleSystem'CHV_PartiPack.Particles.P_wood-impact_large' is set as the Take Damage Particle. Self Explanatory.

-Only attackers (Mason) can damage this one.

 

When 200 Damage is dealt in this case, the gate will vanish, and shoot out the Gib Meshes. Then some Kismet will fire from the Destroyed Event.

 

The Kismet is very simple. Once the actor has been destroyed, the HUD Marker is disabled, and the damaged mesh is revealed. All the particles, damage calculations, and removal of the clean mesh are done in the code, through the actor.

 

The Two damage states. Clean, and Destroyed.

Gate 02

This Gate will be hit based. The amount of damage dealt will not matter, just the number of hits. All the mesh swapping will be done through Kismet.

 

On Level Reset, the Gate blocking the AOCStaticMeshActor Take Damage Event is opened. From then on, any hit to the Gate will add (1) to the Switch. At (2) hits, it will change to the first damage state, then again at (4). Link (6) will set the final damage state, close the gate, remove the collision of the old meshes, and Disable the HUD Marker.

 

Meshes used.

StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade'

StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade_Damage_01'

StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade_Damage_02'

StaticMesh'CHV_DF_Cave_Props.SM_DF_Barricade_Damage_03'

Gate 03

This more elaborate method uses a custom Skeletal Mesh with  custom Animations.

http://udn.epicgames.com/Three/SkeletalMeshHome.html

Similar setup to Gate 02. In the Kismet we will see the main difference.

 

The Kismet is the same as Gate 02 up to the Switch. On the second activation (hit), The Matinee will play up to a point, then pause itself at the DamageState1 event. Setting a Float value is more effective on a server than pausing.

After the Matinee (Detailed further down) completes, it disables collision, reveals a Ramp mesh (similar to Stoneshill) and disables the HUD Marker.

 

Gate 03 Matinee.

This is a relatively simple Matinee. It will use an event track to pause the animation the during damage states. Make sure the Anim Set Group is set to:

AnimSet'CHV_Gate_PKG.Meshes.AS_gate01'

Add an animation to the Anim Track by click it, then typing the Enter key. Add the names: Idle, Break, break_idle, break02, and break02_idle.

http://udn.epicgames.com/Three/MatineeUserGuide.html

 

Here is an illustration of the 3 damage states.

 

Objective Completion

The end Kismet is nothing extraordinary. Each time a gate is destroyed, it fires into a Switch. Third activation completes the Objective.