home *** CD-ROM | disk | FTP | other *** search
- //================================================================
- // DiscoLightTriggerC.
- // See DiscoLightTriggerC.txt
- //================================================================
- class DiscoLightTriggerC extends Trigger placeable;
-
- var private bool Toggle;
- const QUOTES = 10;
- var private string GrouchoSays[QUOTES];
-
-
- //# 1
- function PostBeginPlay(){
- SetQuotes();
-
- }
-
- function Touch( Actor Other )
- {
- local TriggerLight SomeTriggerLight;
- // #1 access the base class Message data member
- // Assign a value using a newly defined function
- Message = GetMessage();
- if ( ReTriggerDelay > 0 ){
- if ( Level.TimeSeconds - TriggerTime < ReTriggerDelay ){
- return;
- }
- TriggerTime = Level.TimeSeconds;
- }//end if
-
- foreach DynamicActors( class 'TriggerLight', SomeTriggerLight, Event){
- SomeTriggerLight.Trigger(Other, Other.Instigator);
- }
- //#2 Access the message value
- if( (Message != "") && (Other.Instigator != None) ){
- // Send a string message to the toucher.
- Other.Instigator.ClientMessage( Message );
- }
- if (RepeatTriggerTime > 0){
- SetTimer(RepeatTriggerTime, false);
- }
- }//end Touch
- // #2 Provide a message
- private function string GetMessage(){
- local string Quote;
- if(Toggle == False){
- //Quote = "Change the lights!";
- Quote = GetQuote();
-
- }else{
- Quote = "";
- }
- return Quote;
- }
-
-
-
- // #3
- private function string GetQuote(){
-
- local int QuoteNumber;
- local string WhatHeSays;
-
- QuoteNumber = Rand(QUOTES);
-
- if(QuoteNumber <= QUOTES ){
- WhatHeSays = GrouchoSays[QuoteNumber];
- }
- return WhatHeSays;
- }
-
-
- // #4
- private function SetQuotes(){
- GrouchoSays[0] = "Either he's dead or my watch has stopped. ";
- GrouchoSays[1] = "And I want to thank you for all the " $
- "enjoyment you've taken out of it. ";
- GrouchoSays[2] = "All people are born alike - " $
- "except Republicans and Democrats. ";
- GrouchoSays[3] = "I don't care to belong to a club that " $
- "accepts people like me as members. ";
- GrouchoSays[4] = "I must confess, I was born at a very early age. ";
- GrouchoSays[5] = "I worked my way up from nothing "$
- "to a state of extreme poverty. ";
- GrouchoSays[6] = "Military intelligence is a contradiction in terms. ";
- GrouchoSays[7] = "No man goes before his time - " $
- "unless the boss leaves early. ";
- GrouchoSays[8] = "The secret of life is honesty and fair dealing." $
- " If you can fake that, you've got it made. ";
- GrouchoSays[9] = "A hospital bed is a parked taxi with the meter running. ";
- }
-
- defaultproperties
- {
- }
-