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

Engine.Counter


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
00125
00126
00127
00128
//NEW (mdf)
//=============================================================================
// Counter: waits until it has been triggered 'NumToCount' times, and then
// it sends Trigger/UnTrigger events to actors whose names match 'EventName'.
//=============================================================================
class Counter extends Triggers;

#exec Texture Import File=Textures\S_Counter.pcx Mips=Off Masked=1

//-----------------------------------------------------------------------------
// Counter variables.

var() byte       NumToCount;                // Number to count down from.
var() bool       bShowMessage;              // Display count message?
var() localized  string CountMessage;       // Human readable count message.
var() localized  string CompleteMessage;    // Completion message.
var   byte       OriginalNum;               // Number to count at startup time.

var() font       CountFont;					//NEW
var() float      CountMsgDuration;			//NEW
var() color      CountColor;				//NEW
var() sound      CountSound;				//NEW
var() float      CountVolume;				//NEW
var() float      CountPitch;				//NEW

var() font       CompleteFont;				//NEW
var() float      CompleteMsgDuration;		//NEW
var() color      CompleteColor;				//NEW
var() sound      CompleteSound;				//NEW
var() float      CompleteVolume;			//NEW
var() float      CompletePitch;				//NEW

//-----------------------------------------------------------------------------
// Counter functions.

//
// Init for play.
//
event BeginPlay()
{
	OriginalNum = NumToCount;
}

//
// Reset the counter.	
//
function Reset()
{
	NumToCount = OriginalNum;
}

//
// Counter was triggered.
//
//NEW (mdf)
function Trigger( Actor Other, Pawn EventInstigator, optional name EventName )
/*OLD
function Trigger( Actor Other, Pawn EventInstigator )
*/
{
	local string S;
	local string Num;
	local int i;

	if( NumToCount > 0 )
	{
		if( --NumToCount == 0 )
		{
			// Trigger all matching actors.
			if( bShowMessage && CompleteMessage != "" )
//				EventInstigator.ClientMessage( CompleteMessage );
				if
				(	EventInstigator!=None
				&&	PlayerController(EventInstigator.Controller)!=None
				&&	PlayerController(EventInstigator.Controller).Player!=None
				&&	PlayerController(EventInstigator.Controller).Player.Console!=None
				){	PlayerController(EventInstigator.Controller).Player.Console.TimedMessage( CompleteMessage, CompleteMsgDuration, CompleteFont, CompleteColor );	//NEW
					if(CompleteSound!=None) EventInstigator.Controller.PlaySound( CompleteSound, SLOT_Interface, CompleteVolume,,, CompletePitch ); }
		  	TriggerActors( Self, TriggerClass, Other, EventInstigator, Event, bTriggerNPCs );
		}
		else if( bShowMessage && CountMessage != "" )
		{
			// Still counting down.
			switch( NumToCount )
			{
				case 1:  Num="one"; break;
				case 2:  Num="two"; break;
				case 3:  Num="three"; break;
				case 4:  Num="four"; break;
				case 5:  Num="five"; break;
				case 6:  Num="six"; break;
				default: Num=string(NumToCount); break;
			}
			S = CountMessage;
			while( InStr(S, "%i") >= 0 )
			{
				i = InStr(S, "%i");
				S = Left(S,i) $ Num $ Mid(S,i+2);
			}
//			EventInstigator.ClientMessage( S );
			if
			(	EventInstigator!=None
			&&	PlayerController(EventInstigator.Controller)!=None
			&&	PlayerController(EventInstigator.Controller).Player!=None
			&&	PlayerController(EventInstigator.Controller).Player.Console!=None
			){	PlayerController(EventInstigator.Controller).Player.Console.TimedMessage( S, CountMsgDuration, CountFont, CountColor );	//NEW
				if(CountSound!=None) EventInstigator.Controller.PlaySound( CountSound, SLOT_Interface, CountVolume,,, CountPitch ); }
		}
	}
}

defaultproperties
{
	NumToCount=2
	CountMessage="Only %i more to go..."
	CompleteMessage="Completed!"
	CountVolume=1.000000
	CountPitch=1.000000
	CompleteVolume=1.000000
	CompletePitch=1.000000
	Texture=Texture'Engine.S_Counter'
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:40.000 - Creation time: sk 3-1-2016 10:48:37.833 - Created with UnCodeX