I am just posting the code so you can read it rather than have me try and explain.
But I do know int is integer, bool is boolean or the other two here.
But how does that work with the mechanics of programing with reference to the actual things that happen considering Unreal actors, why a"float" "byte" "bool" "int", why are they different and how it applies to know what I need to do.
not sure how to apply the programing thinking, I do know that int would be for a solid set number and shoved it in, the others, why would I need it or how to think of why I would use them
I do know a $ string can be a word of text, or made a variable,
here is the code just so you can read it
This part
var() enum TPropType
{
TYPE_Bool,
TYPE_Float,
TYPE_Int,
TYPE_Byte,
I just need a scenario real game example , not necessarily the exact meaning but a scenario for an actor results.
like
"If a skaar, or light or mover" will make this or that happen.
Code: Select all
//=============================================================================
// 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];
}