Cogito, ergo sum

User:Wormbo/DamageTriggerMover

From Unreal Wiki, The Unreal Engine Documentation Site
< User:Wormbo
Revision as of 00:56, 25 July 2009 by Wormbo (Talk | contribs) (Created page with '{{infobox class |game=UT2004 |engine=UE2 |custom=yes |parent1=Mover |parent2=Actor |parent3=Object }} This Mover subclass replaces the logic for damage-triggering the mover with ...')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UT2004 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);
}