Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 |
//============================================================================= // ScriptTrigger.uc // Created By: Mike Fox // Created On: 8/01/00 // $Author: Mfox $ // $Date: 1/29/03 4:24p $ // $Revision: 7 $ //============================================================================= class ScriptTrigger extends Trigger; /*----------------------------------------------------------------------------- Used to give a script to an NPC when triggered. e.g. if an NPC walks through a certain spot in the level could give him a script which will cause him to point at a switch and fire off a dialog related to noticing the switch, shoot at switch etc. If more than one script given, subsequent triggers will iterate through the list. -----------------------------------------------------------------------------*/ struct TScriptInfo { var() string CommandFileName; var() string CommandStartLabel; }; var() array<TScriptInfo> ScriptList; var() enum ETargetType { TT_TargetInstigator, // target is instigator (must be a U2NPCBase) // TT_TargetNamed, // target is NPC with Name=TargetName (mdf-tbd: how NPCs will be named) TT_TargetNearest, // target is nearest NPC matching specified class (pawn or controller class) TT_TargetTagged, // target is NPC with Tag=TargetName } TargetType; var() string TargetClassString; // pawn/controller class to use with TT_TargetNearest var() name TargetName; var private int CurrentScript; //NEW (mw) // NOTE: mb modified so the use reticle doesn't display them on the hud function bool IsUsable( Actor Other ) { // 2003.01.29 (mdf) fix for adding timers (etc.) to invalid (e.g. deleted) actors if( bDeleteMe ) return false; if( Pawn(Other) != None && Pawn(Other).Controller != None ) Other = Pawn(Other).Controller; // players can't use script triggers. return PlayerController(Other) != None; } //OLD //----------------------------------------------------------------------------- protected function TriggerActors( Actor TriggerSrc, class<Actor> TriggerClass, Actor Other, Pawn Instigator, name TriggerEvent, bool bTriggerNPCs ) { // find the target NPC and set its script local U2NPCController TargetController; local Controller C; local class<Actor> TargetClass; local Actor TargetActor; if( TargetType == TT_TargetInstigator ) { TargetController = U2NPCController(Instigator.Controller); } else if( TargetType == TT_TargetNearest ) { TargetClass = class<Actor>(DynamicLoadObject( TargetClassString, class'Class' )); if( TargetClass != None ) { TargetActor = class'UtilGame'.static.GetClosestActor( Self, TargetClass ); if( Pawn(TargetActor) != None ) TargetController = U2NPCController(Pawn(TargetActor).Controller); else if( U2NPCController(TargetActor) != None ) TargetController = U2NPCController(TargetActor); } } else if( TargetType == TT_TargetTagged ) { for( C=Level.ControllerList; C!=None; C=C.NextController ) { if( U2NPCController(C)!=None && C.Pawn.Tag==TargetName ) { TargetController = U2NPCController(C); break; } } } if( TargetController != None ) { TargetController.SetScript( ScriptList[ CurrentScript ].CommandFileName, ScriptList[ CurrentScript ].CommandStartLabel ); CurrentScript++; if( CurrentScript >= ScriptList.Length || ScriptList[ CurrentScript ].CommandFileName == "" ) CurrentScript = 0; // wrap } // !!mdf-tbd: didn't do anything -- make sure trigger still active? // Its not trivial to do this without refactoring teh trigger code even further } //----------------------------------------------------------------------------- defaultproperties { TargetClassString="U2.U2NPCController" UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |