| Home Page | Recent Changes

AdrenalinePickup/Script

UT2003, Build 2225

//=============================================================================
// AdrenalinePickup  //Name of the class
//=============================================================================
class AdrenalinePickup extends TournamentPickUp; //Says this class is a subclass of Tournament Pickups

var() float AdrenalineAmount; //The variable that determines adreneline you get from the pickup

DetourWeight() //How much the bots will stray off a course to pick up this object
function float DetourWeight(Pawn Other,float PathWeight)
{
    if ( !Other.Controller.NeedsAdrenaline() )
        return 0;
    return MaxDesireability;
}

event float BotDesireability(Pawn Bot) //Determines how much a bot will want to pick this up
{
    if ( Bot.Controller.bHuntPlayer )
        return 0;
    if ( !Bot.Controller.NeedsAdrenaline() )
        return 0;
    return MaxDesireability;
}

auto state Pickup //What happens when you pick this up
{   
    function Touch( actor Other )
    {
        local Pawn P;
            
        if ( ValidTouch(Other) ) //If a player touches an adreneline pill...
        {           
            P = Pawn(Other);    
            P.Controller.AwardAdrenaline(AdrenalineAmount); //He will get Adreneline based off of the variable AdrenelineAmount...
            AnnouncePickup(P); //The player will recieve a message that he has recieved adreneline...
            SetRespawn(); //And the Adreneline will be set to respawn in a few seconds      
        }
    }
}

defaultproperties //Definitions for variables used by this class
{
     AdrenalineAmount=3.000000 //How much adreneline you get
     MaxDesireability=0.300000 //The amount of desireability the bots have for it
     RespawnTime=30.000000 //How long it takes to respawn (in second)
     PickupMessage="Adrenaline " //The message you get when you pick it up
     PickupSound=Sound'PickupSounds.AdrenelinPickup' //The pick up sound
     PickupForce="AdrenelinPickup"
     Physics=PHYS_Rotating //The physics for the adreneline model.  This sets the model to spin in place.
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'XPickups_rc.AdrenalinePack'
     DrawScale=0.075000
     AmbientGlow=255 //The glow the pill gives off
     ScaleGlow=0.600000
     Style=STY_AlphaZ
     CollisionRadius=32.000000 //The radius...
     CollisionHeight=23.000000 //And height to determine when you collide with the pickup, there adding it to your inventory
     Mass=10.000000 //The pill's mass
     RotationRate=(Yaw=24000) //How fast the pill rotates
}

UT2004

//=============================================================================
// AdrenalinePickup
//=============================================================================
class AdrenalinePickup extends TournamentPickUp;

var float AdrenalineAmount;

/* DetourWeight()
value of this path to take a quick detour (usually 0, used when on route to distant objective, but want to grab inventory for example)
*/
function float DetourWeight(Pawn Other,float PathWeight)
{
    if ( (PathWeight > 500) || !Other.Controller.NeedsAdrenaline() )
        return 0;
    if ( (Other.Controller.Enemy != None) && (Level.TimeSeconds - Other.Controller.LastSeenTime < 1) )
        return 0;
    
    return 0.15/PathWeight;
}

event float BotDesireability(Pawn Bot)
{
    if ( Bot.Controller.bHuntPlayer )
        return 0;
    if ( !Bot.Controller.NeedsAdrenaline() )
        return 0;
    return MaxDesireability;
}

auto state Pickup
{   
    function Touch( actor Other )
    {
        local Pawn P;
            
        if ( ValidTouch(Other) ) 
        {           
            P = Pawn(Other);    
            P.Controller.AwardAdrenaline(AdrenalineAmount);
            AnnouncePickup(P);
            SetRespawn();           
        }
    }
}

Related Topics

Discussion

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In