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

Gameplay.MPTarget


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
class MPTarget extends MPActor;

var() editdisplay(displayActorLabel)
	  editcombotype(enumRook)
	  Rook	target				"The Rook that is to be a target";
var() bool	bCanComeBackToLife	"Whether or not the Rook can come back to life (if false, a BaseDevice won't be repairable and an AI won't respawn) NOT IMPLEMENTED";
var() int	teamPointsForDestruction	"The number of team points awarded for destroying this target";
var() int	teamPointsForDefending		"The number of team points awarded for defending this target for defendPeriod (NOT IMPLEMENTED)";
var() int	defendPeriod				"The number of seconds that this target must be defended in order for the defenders to score points (NOT IMPLEMENTED)";
var() MPTarget	nextTarget		"If provided, the nextTarget will be activated when this Target is successfully destroyed (or defended if defendPeriod is provided) (NOT IMPLEMENTED)";
var() bool	bChooseRandomNextTarget	"If true, overrides nextTarget to choose a random next target to activate from all eligible targets in the map (NOT IMPLEMENTED)";

// Stats
var(Stats)	class<Stat>	destroyStat			"Stat awarded for destroying this target";
var(Stats)	class<Stat> defendPerPeriodStat	"Stat awarded for defending this target per defendPeriod";

var() bool bActive				"Targets only appear if they're active";

// PostBeginPlay
function PostBeginPlay()
{
	Super.PostBeginPlay();

	// Register death message for the target
	registerMessage(class'MessageDeath', target.label);

	// Don't allow players on the Target's team to damage it
	target.teamDamagePercentage = 1.0;
}

function registerStats(StatTracker tracker)
{
	Super.registerStats(tracker);
	tracker.registerStat(destroyStat);
	tracker.registerStat(defendPerPeriodStat);
}

// addObjectives
function addObjectives()
{
	//team().objectives.add('Ball objective', 'Throw the ball into an enemy goal', ObjectiveStatus_Active, ObjectiveType_Primary);
}

function bool canBeDestroyedBy(Character c)
{
	return (c != None && (target.team() == None || team() != c.team()));
}

auto state NeverBeenDestroyed
{
	function onMessage(Message msg)
	{
		local Character killer;

		// We know this is a MessageDeath message for the target
		killer = Character(findByLabel(class'Character', MessageDeath(msg).killer));
		if (canBeDestroyedBy(killer))
		{
			awardStat(destroyStat, killer);
			scoreTeam(teamPointsForDestruction, killer.team());
			//killer.ClientMessage("You destroyed an enemy target!");
			//Level.Game.Broadcast(self, "A target was destroyed!");
			Level.Game.BroadcastLocalized(self, class'MPTargetMessages', 0, killer.tribesReplicationInfo, killer.team());
			GotoState('AlreadyBeenDestroyed');
		}
	}
}

state AlreadyBeenDestroyed
{
}

function enumRook(Engine.LevelInfo l, Array<Rook> a)
{
	local Rook r;

	ForEach DynamicActors(class'Rook', r)
	{
		a[a.length] = r;
	}
}

defaultproperties
{
	DrawType				= DT_None
    bUseCylinderCollision	= false	

	bCanComeBackToLife			= false
	teamPointsForDestruction	= 1
	teamPointsForDefending		= 1
	defendPeriod				= 240
	bActive						= true
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:53:20.000 - Creation time: st 23.5.2018 00:10:45.978 - Created with UnCodeX