| Home Page | Recent Changes | Preferences

SustainedDamageTrigger

Mod ideas for UT 2003 – Sustained damage trigger (keeps track of total damage)

Description

In the original UT a trigger could be set to fire based on a minimum damage threshold. This trigger keeps track of the amonut of damage it receives and fires when the total damage it has sustained reaches the value specified.

Interested Scripters

If you are interested in developing this mod for UT2003 then add your name to the list. Once you start development you should indicate that below (and hopefully include a link to a journal page). Before you start development you should also check this section to see if anyone else has started.

  • EntropicLqd – I'll need one of these for a map idea I've got. It's a little poly intensive for UT, but UT2003 would have no problems.

Tarquin: Try this:

//=============================================================================
// SustainedDamageTrigger.
// by Tarquin. Untested. 
//=============================================================================
class SustainedDamageTrigger extends Trigger;

var float  DamageTaken ;

function bool IsRelevant( actor Other )
{
    if( !bInitiallyActive )
        return false;
    switch( TriggerType )
    {
        case TT_PlayerProximity:
            return Pawn(Other)!=None && Pawn(Other).bIsPlayer;
        case TT_PawnProximity:
            return Pawn(Other)!=None && ( Pawn(Other).Intelligence > BRAINS_None );
        case TT_ClassProximity:
            return ClassIsChildOf(Other.Class, ClassProximityType);
        case TT_AnyProximity:
            return true;
        case TT_Shoot:
            if(Projectile(Other) != None) 
                DamageTaken += Projectile(Other).Damage ;
            return ( DamageTaken >= DamageThreshold );
    }
}

even smaller:

//=============================================================================
// SustainedDamageTrigger.
// by Tarquin. Untested. 
//=============================================================================
class SustainedDamageTrigger extends Trigger;

var float  DamageTaken ;

function bool IsRelevant( actor Other )
{
    if( !bInitiallyActive )
        return false;
    if( TriggerType == TT_Shoot )
    {
        if(Projectile(Other) != None) 
            DamageTaken += Projectile(Other).Damage ;
        return ( DamageTaken >= DamageThreshold );
    }
    super.IsRelevant( Other );
    // case TT_Shoot in super will never be called
}

Discussion

EntropicLqd: Neato :) But what about hit scan weapons? I must confess to not having done a whole lot of research (ie. none) on this one but I was sort of expecting to use a TakeDamage() equivalent for the Trigger.

Tarquin: being cheap, I just used the code from Trigger which checks for damage. I have no idea!!

Mychaeel: You'd need to overwrite TakeDamage to deal with hitscan weapons, I suppose. For that matter, I'd think dealing with projectile weapons there instead of in IsRelevant would be neater too.


Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In