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

UnrealGame.UnrealScriptedSequence


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
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
class UnrealScriptedSequence extends ScriptedSequence;

var UnrealScriptedSequence EnemyAcquisitionScript;
var Controller CurrentUser;
var UnrealScriptedSequence NextScript;  // list of scripts with same tag
var bool bFirstScript;              // first script in list of scripts
var() bool bSniping;                // bots should snipe when using this script as a defense point
var() bool bDontChangeScripts;      // bot should go back to this script, not look for other compatible scripts
var bool  bFreelance;                   // true if not claimed by any game objective
var() bool bRoamingScript;              // if true, roam after reaching
var bool bAvoid;
var bool bDisabled;
var() bool bNotInVehicle;       // bot should not attempt to use this script while in a vehicle
var() byte priority;                // used when several scripts available (e.g. defense scripts for an objective)
var() name EnemyAcquisitionScriptTag;   // script to go to after leaving this script for an acquisition
var() float EnemyAcquisitionScriptProbability;  // likelihood that bot will use acquisitionscript
var() name SnipingVolumeTag;        // area defined by volume in which to look for (distant) sniping targets
var() class<Weapon> WeaponPreference;   // bots using this defense point will preferentially use this weapon

var float NumChecked;

/* Reset()
reset actor to initial state - used when restarting level without reloading.
*/
function Reset()
{
    bDisabled = false;
    FreeScript();
}

function FreeScript()
{
    CurrentUser = None;
}

function bool CheckForErrors()
{
    if ( Tag == '' )
    {
        log(Self$" has no tag - won't be assigned to any objective!");
        return true;
    }

    return Super.CheckForErrors();
}

function BeginPlay()
{
    local UnrealScriptedSequence S, Last;
    local SnipingVolume V;

    Super.BeginPlay();

    if ( EnemyAcquisitionScriptTag != '' )
    {
        ForEach AllActors(class'UnrealScriptedSequence',EnemyAcquisitionScript,EnemyAcquisitionScriptTag)
            break;
    }

    if ( Tag == '' )
        warn(self$" has no tag - won't be assigned to any objective!");
    else if ( bFirstScript )
    {
        Last = self;
        // first one initialized - create script list
        ForEach AllActors(class'UnrealScriptedSequence',S,Tag)
            if ( S != self )
            {
                Last.NextScript = S;
                S.bFirstScript = false;
                Last = S;
            }
    }

    if ( SnipingVolumeTag != 'None' )
        ForEach AllActors(class'SnipingVolume',V,SnipingVolumeTag)
            V.AddDefensePoint(self);
}

function bool HigherPriorityThan(UnrealScriptedSequence S, Bot B)
{
    NumChecked = 1;
    if ( bAvoid )
    {
        bAvoid = false;
        return false;
    }
    if ( bNotInVehicle && Vehicle(B.Pawn) != None )
        return false;
    if ( (CurrentUser != None) && !CurrentUser.bDeleteMe && (CurrentUser != B)
        && CurrentUser.SameTeamAs(B) )
    {
        if ( (Bot(CurrentUser) != None) && (Bot(CurrentUser).GoalScript != self) )
            Bot(CurrentUser).GoalScript = None;
        else
            return false;
    }
    if ( (S == None) || (S.Priority < Priority) )
        return true;
    if ( S.Priority > Priority )
        return false;
    if ( (B.FavoriteWeapon != None) && (B.FavoriteWeapon == WeaponPreference) )
        return true;
    S.NumChecked += 1;
    return ( FRand() < 1/S.NumChecked );
}

defaultproperties
{
     bFirstScript=True
     bFreelance=True
     EnemyAcquisitionScriptProbability=1.000000
     Begin Object Class=Action_MOVETOPOINT Name=DefensePointDefaultAction1
     End Object
     Actions(0)=Action_MOVETOPOINT'UnrealGame.UnrealScriptedSequence.DefensePointDefaultAction1'

     Begin Object Class=Action_WAITFORTIMER Name=DefensePointDefaultAction2
         PauseTime=3.000000
     End Object
     Actions(1)=Action_WAITFORTIMER'UnrealGame.UnrealScriptedSequence.DefensePointDefaultAction2'

     ScriptControllerClass=Class'UnrealGame.Bot'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:38:48.000 - Creation time: Wed 7/2/2007 19:16:55.390 - Created with UnCodeX