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 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 |
//============================================================================= // PropertyFlipper.uc // $Author: Mfox $ // $Date: 10/02/02 2:25p $ // $Revision: 12 $ //============================================================================= //------------------------------------------------------------------------------ // Description: Use this to modify any variable of any Actor at runtime via // a trigger. //------------------------------------------------------------------------------ // Basic Instructions: // // Set the Event to the object's Tag you wish to modify. // // Note: Only the first object you link to will be affected. If you need to // affect multiple objects, use multiple PropertyFlippers. // Update: You can now link up to 16 objects safely. // // There are three InitialStates that you can set: // // + TriggerToggle // + TriggerControl // + TriggerTimed (note associated TriggerDuration) // // These are self explanatory. // // Under the PropertyFlipper section in the default properties, you will see // a bunch of variables. // // + PropertyName - set this to the name of the variable you wish to modify // (i.e. DrawScale). Just type it in -- spelling counts. // + PropertyType - set this to the type of property you are modifying // (i.e. float, Texture, Sound, etc.) // + XXXValue (FloatValue, TextureValue, SoundValue, etc) - set this to the // value you wish your variable to be modified too. These are basically for // easy of use. Rather than making you type in // "Texture'Angreal.Effects.GreenExplosion'" you can simply select the texture // in the texture browser, and then click USE in the variable box. // // Notes: // // If I didn't include the type of variable you want to modify (i.e. an enumeration // like Style), you can use StringValue to hack it into submission. // // Example: // + Set PropertyName to Style. // + Set PropertyType to TYPE_String. // + Set StringValue to STY_Translucent. // // This will not work for constant variables like Physics and Location, however, // I have added a PropertyType for Physics, and I can add more for other constant // variables if you find you need to modify them. // // This will not work for Static actors. If you can't figure out why your // PropertyFlipper isn't working, make sure to check that the Actor you are trying // to modify isn't static. Also make sure you didn't spell the PropertyName wrong. //------------------------------------------------------------------------------ class PropertyFlipper extends KeyPoint; #exec Texture Import File=Textures\PrpFlipper.pcx Name=S_PrpFlipper Mips=Off MASKED=1 var() enum TPropType { TYPE_Bool, TYPE_Float, TYPE_Int, TYPE_Byte, TYPE_Vector, TYPE_Rotator, TYPE_String, TYPE_Texture, TYPE_Sound, TYPE_Physics, TYPE_Collision, // No property name needed. TYPE_Color, TYPE_bCollideActors, TYPE_DrawType, } PropertyType; var() string PropertyName; var() bool BoolValue; var() float FloatValue; var() int IntValue; var() byte ByteValue; var() vector VectorValue; var() rotator RotatorValue; var() string StringValue; var() Texture TextureValue; var() Sound SoundValue; var() EPhysics PhysicsValue; var() float CollisionRadiusValue; // No property name needed. var() float CollisionHeightValue; // No property name needed. var() color ColorValue; var() EDrawType DrawTypeValue; var string OldPropertyText; var EPhysics OldPhysics; var float OldCollisionRadius; var float OldCollisionHeight; var() float TriggerDuration; var bool bOn; var PropertyFlipper Flippers[16]; //------------------------------------------------------------------------------ simulated state() TriggerToggle { simulated function Trigger( Actor Other, Pawn EventInstigator, optional name EventName ) { if( !bOn ) Set(); else Reset(); bOn = !bOn; } } //------------------------------------------------------------------------------ simulated state() TriggerControl { simulated function Trigger( Actor Other, Pawn EventInstigator, optional name EventName ) { Set(); } simulated function UnTrigger( Actor Other, Pawn EventInstigator, optional name EventName ) { Reset(); } } //------------------------------------------------------------------------------ simulated state() TriggerTimed { simulated function Trigger( Actor Other, Pawn EventInstigator, optional name EventName ) { Set(); SetTimer( TriggerDuration, false ); } simulated event Timer() { Reset(); } } //------------------------------------------------------------------------------ simulated function Set() { local Actor IterA; local int i; i = -1; if( Event != '' ) foreach AllActors( class'Actor', IterA, Event ) StaticSet( GetInstance(i++), IterA ); } //------------------------------------------------------------------------------ simulated function Reset() { local Actor IterA; local int i; i = -1; if( Event != '' ) foreach AllActors( class'Actor', IterA, Event ) StaticReset( GetInstance(i++), IterA ); } //------------------------------------------------------------------------------ simulated static function StaticSet( PropertyFlipper P, Actor A ) { if( P == None || A == None ) return; if( P.PropertyType != TYPE_Physics && P.PropertyType != TYPE_Collision && P.PropertyType != TYPE_bCollideActors && P.PropertyType != TYPE_DrawType && !A.CanSetProperty( P.PropertyName ) ) { A.DMT( "Warning -- can't set property '" $ P.PropertyName $ "' (Type=" $ EnumStr( enum'TPropType', P.PropertyType ) $ ") for Actor " $ A $ " using property flipper " $ P ); return; } P.OldPropertyText = A.GetPropertyText( P.PropertyName ); switch( P.PropertyType ) { case TYPE_Bool: A.SetPropertyText( P.PropertyName, string(P.BoolValue) ); if( P.PropertyName == "bHidden" ){ A.StaticFilterState = FS_Maybe; } break; case TYPE_Float: A.SetPropertyText( P.PropertyName, string(P.FloatValue) ); break; case TYPE_Int: A.SetPropertyText( P.PropertyName, string(P.IntValue) ); break; case TYPE_Byte: A.SetPropertyText( P.PropertyName, string(P.ByteValue) ); break; case TYPE_Vector: A.SetPropertyText( P.PropertyName, string(P.VectorValue) ); break; case TYPE_Rotator: A.SetPropertyText( P.PropertyName, string(P.RotatorValue) ); break; case TYPE_String: A.SetPropertyText( P.PropertyName, P.StringValue ); break; case TYPE_Texture: A.SetPropertyText( P.PropertyName, string(P.TextureValue) ); break; case TYPE_Sound: A.SetPropertyText( P.PropertyName, string(P.SoundValue) ); break; case TYPE_Physics: P.OldPhysics = A.Physics; A.SetPhysics( P.PhysicsValue ); break; case TYPE_Collision: P.OldCollisionRadius = A.CollisionRadius; P.OldCollisionHeight = A.CollisionHeight; A.SetCollisionSize( P.CollisionRadiusValue, P.CollisionHeightValue ); break; case TYPE_Color: A.SetPropertyText( P.PropertyName, "(R="$P.ColorValue.R$",G="$P.ColorValue.G$",B="$P.ColorValue.B$")" ); break; case TYPE_bCollideActors: A.SetCollision( P.BoolValue ); break; case TYPE_DrawType: A.SetDrawType( P.DrawTypeValue ); break; default: A.DMT( "Warning -- unhandled PropertyType" ); break; } } //------------------------------------------------------------------------------ simulated static function StaticReset( PropertyFlipper P, Actor A ) { if( P == None || A == None ) return; if( P.PropertyType == TYPE_Physics ) { A.SetPhysics( P.OldPhysics ); } else if( P.PropertyType == TYPE_Collision ) { A.SetCollisionSize( P.OldCollisionRadius, P.OldCollisionHeight ); } else { if( !A.CanSetProperty( P.PropertyName ) ) A.DMT( "Warning -- can't reset property '" $ P.PropertyName $ "' (Type=" $ EnumStr( enum'TPropType', P.PropertyType ) $ ") for Actor " $ A $ " using property flipper " $ P ); A.SetPropertyText( P.PropertyName, P.OldPropertyText ); if( P.PropertyName == "bHidden" ){ A.StaticFilterState = FS_Maybe; } } } //------------------------------------------------------------------------------ simulated function PropertyFlipper GetInstance( int i ) { if( i == -1 ) return Self; if( i < 0 || i >= ArrayCount(Flippers) ) { warn(i$") PropertyFlipper linked to too many Actors!!"); return None; } if( Flippers[i] == None ) { Flippers[i] = Spawn( Class,,, Location, Rotation, Self ); Flippers[i].Tag = ''; // make sure the trigger doesn't affect us. } return Flippers[i]; } defaultproperties { bStatic=false InitialState='TriggerControl' Texture=Texture'Legend.S_PrpFlipper' 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 |