Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UnrealI.Health


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
class Health expands PickUp;

#exec AUDIO IMPORT FILE="Sounds\Pickups\HEALTH2.WAV"  NAME="Health2"     GROUP="Pickups"

#exec TEXTURE IMPORT NAME=I_Health FILE=TEXTURES\HUD\i_Health.PCX GROUP="Icons" MIPS=OFF

#exec MESH IMPORT MESH=HealthM ANIVFILE=MODELS\aniv38.3D DATAFILE=MODELS\data38.3D X=0 Y=0 Z=0
#exec  MESH ORIGIN MESH=HealthM X=0 Y=0 Z=0 YAW=0
#exec  MESH SEQUENCE MESH=HealthM SEQ=All    STARTFRAME=0  NUMFRAMES=1
#exec  TEXTURE IMPORT NAME=Jhealth1 FILE=MODELS\health.PCX GROUP="Skins" FLAGS=2
#exec  MESHMAP SCALE MESHMAP=HealthM X=0.02 Y=0.02 Z=0.04
#exec  MESHMAP SETTEXTURE MESHMAP=HealthM NUM=0 TEXTURE=Jhealth1

var() int HealingAmount;
var() bool bSuperHeal;

event float BotDesireability(Pawn Bot)
{
    local float desire;

    desire = HealingAmount;
    if ( !bSuperHeal )
        desire = Min(desire, 100 - Bot.Health);

    if ( (Bot.Weapon != None) && (Bot.Weapon.AIRating > 0.3) )
        desire *= 2;
    if ( Bot.Health < 40 )
        return ( FMin(0.03 * desire, 2) );
    else if ( Bot.Health < 100 )
        return ( 0.01 * desire ); 
    else
        return 0;
}

auto state Pickup
{   
    function Touch( actor Other )
    {
        local int HealMax;
    
        if ( ValidTouch(Other) ) 
        {       
            HealMax = Pawn(Other).default.health;
            if (bSuperHeal) HealMax = HealMax * 2.0;
            if (Pawn(Other).Health < HealMax) 
            {
                Pawn(Other).Health += HealingAmount;
                if (Pawn(Other).Health > HealMax) Pawn(Other).Health = HealMax;
                if ( bSuperHeal )
                    Pawn(Other).ClientMessage(PickupMessage);
                else                
                    Pawn(Other).ClientMessage(PickupMessage $ HealingAmount);               
                PlaySound (PickupSound,,2.5);
                if ( Level.Game.Difficulty > 1 )
                    Other.MakeNoise(0.1 * Level.Game.Difficulty);       
                SetRespawn();
            }
        }
    }
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 12:52:32.000 - Creation time: za 22-4-2006 12:53:45.515 - Created with UnCodeX