Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Tyrion.AI_DirectAttackGoal

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

    //=====================================================================
    // AI_DirectAttackGoal
    // The DirectAttackGoal is only matched by DirectAttack, whereas the
    // AttackGoal is matched by any character-specific attack behavior
    //=====================================================================

    class AI_DirectAttackGoal extends AI_CharacterGoal
    	editinlinenew;

    //=====================================================================
    // Variables

    var(Parameters) editconst int rank "Rank of the AI; set by the ability in the class DB";
    var(Parameters) editinline Name targetName "Label of target (any Pawn)";
    var(Parameters) class<Weapon> preferredWeaponClass "AI will use this weapon if at all possible";

    var(InternalParameters) editconst Pawn target;
    var(InternalParameters) editconst IWeaponSelectionFunction weaponSelection;
    var(InternalParameters) editconst IFollowFunction followFunction;

    //=====================================================================
    // Functions

    overloaded function construct( AI_Resource r, int pri, Pawn _target,
    							  optional IWeaponSelectionFunction _weaponSelection,
    							  optional class<Weapon> _preferredWeaponClass, optional IFollowFunction _followFunction )
    {
    	priority = pri;
    	target = _target;
    	weaponSelection = _weaponSelection;
    	preferredWeaponClass = _preferredWeaponClass;
    	followFunction = _followFunction;

    	super.construct( r );
    }

    //---------------------------------------------------------------------
    // Called when a goal is removed

    function cleanup()
    {
    	super.cleanup();

    	followFunction = None;
    	weaponSelection = None;
    }

    //---------------------------------------------------------------------
    // Called explicitly at start of gameplay

    function init( AI_Resource r )
    {
    	super.init( r );

    	if ( target == None && targetName != '' )
    		target = Pawn(resource.pawn().findByLabel( class'Pawn', targetName, true ));

    	if ( target == None )
    	{
    		log( "AI WARNING:" @ name @ "can't find specified rook" @ targetName );

    		// goal needs to be matched so it can be cleaned up by the action:
    		bInActive = false;
    	}
    	else
    	{
    		// userData is always 'None' for deactivation sensors, and != None for activation sensors
    		activationSentinel.activateSentinel( self, class'AI_TargetMemorySensor', r,, class'AI_Sensor'.const.ONLY_NON_NONE_VALUE, self );
    		AI_TargetMemorySensor(activationSentinel.sensor).setParameters( target, Rook(resource.pawn()).visionMemory );
    	}
    }

    //=====================================================================

    defaultproperties
    {
    	bInactive = true
    	bPermanent = false
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 15:54:24.000 - Creation time: st 23.5.2018 00:10:41.036 - Created with UnCodeX