Always snap to grid

User:Wormbo/DamageTriggerMover

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UE2 Object >> Actor >> Mover >> DamageTriggerMover (custom)

This Mover subclass replaces the logic for damage-triggering the mover with the ability to trigger a generic event when the mover is damaged.

Properties

Property group 'Mover' (redefined from Mover)

bDamageTriggered

Type: bool

Not used.

DamageThreshold

Type: float

Minimum amount of damage required to trigger the event.

Property group 'MoverEvents'

DamageEvent

Type: name

This event will be triggered when the mover is damaged.

Usage

Download DamageTriggerMover.zip and extract it to your UT2004\System directory. Either load DamageTriggerMover.u in the Actor Browser or add DamageTriggerMover to your EditPackages list. You will be able to place this type of mover by right-clicking the mover icon in the UnrealEd toolbox.

The other way is manually creating a subclass of Mover in myLevel and compiling the following code, which should be compatible with almost all Unreal Engine 2 games.

class DamageTriggerMover extends Mover;
 
 
//=============================================================================
// Variables
//=============================================================================
 
var(MoverEvents) name DamageEvent;
var() const editconst string Build;
 
 
/**
Called when the mover takes damage. (duh...)
*/
event TakeDamage(int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType)
{
  if (Damage >= DamageThreshold)
    TriggerEvent(DamageEvent, Self, EventInstigator);
}