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 |
//============================================================================= // U2AraknidControllerHatched. //============================================================================= class U2AraknidControllerHatched extends U2AraknidController; //----------------------------------------------------------------------------- #exec OBJ LOAD FILE=..\Sounds\U2AraknidHeavy.uax //----------------------------------------------------------------------------- const HatchedState = 'Hatched'; const PlayMommySoundTimer = 'PlayMommySound'; //----------------------------------------------------------------------------- var() float FollowMommaSeconds; // time to keep following the player var() float MinSelfDestructDistance; // min distance from player before self destructing var() float MaxWanderDistanceFromMomma; // maximum distance that npc can stray from momma before heading back var() sound MommySound; // sound to be played after baby steps to momma var Actor Momma; var bool bGrownUp; var bool bWalkedToMomma; var float HatchedTime; //----------------------------------------------------------------------------- event Destroyed() { RemoveAllTimers(); Super.Destroyed(); } //----------------------------------------------------------------------------- function NavigationError( U2Pawn.EErrorType ErrorType, string ErrorMessage ) { if( Pawn != None ) Pawn.Died( None, class'Suicided', Pawn.Location, vect(0,0,0) ); else Super.NavigationError(ErrorType, ErrorMessage); } //----------------------------------------------------------------------------- function EMoveType HandleSetMoveTargetError( Actor GoalActor, float GoalDistance ) { if( Pawn != None ) { Pawn.Died( None, class'Suicided', Pawn.Location, vect(0,0,0) ); return MT_Error; } else { return Super.HandleSetMoveTargetError( GoalActor, GoalDistance ); } } //----------------------------------------------------------------------------- function Trigger( Actor Other, Pawn EventInstigator, optional name EventName ) { Momma = Other; } //----------------------------------------------------------------------------- state @ HatchedState extends @ WanderingState { //------------------------------------------------------------------------- function bool ShouldWanderTowardMomma() { return( Momma != None && ( Level.TimeSeconds - HatchedTime < FollowMommaSeconds ) && ( !bWalkedToMomma || VSize( Momma.Location - Pawn.Location ) > MaxWanderDistanceFromMomma ) ); } //------------------------------------------------------------------------- function vector GetWanderDirection( int FallbackType ) { local vector Direction; if( ShouldWanderTowardMomma() ) { Direction = Momma.Location - Pawn.Location; Direction = class'Util'.static.CalcSprayDirection( rotator(Direction), 30.0 ); Direction.Z = 0.0; return Normal( Direction ); } return Super.GetWanderDirection( FallbackType ); } //------------------------------------------------------------------------- function float GetWanderDistanceModifier() { return 1.0; } //------------------------------------------------------------------------- function PlayMommySound() { if( MommySound != None ) { PlaySound( MommySound, /*slot*/, /*volume*/, , 1000 ); MommySound = None; } } //------------------------------------------------------------------------- function bool CanSelfDestruct() { return( Level.TimeSeconds > (HatchedTime + FollowMommaSeconds) && Pawn != None && Momma != None && VSize( Pawn.Location - Momma.Location ) > MinSelfDestructDistance && !PlayerCanSeeMe() ); } //------------------------------------------------------------------------- function bool PickDestination() { if( CanSelfDestruct() ) { Pawn.Destroy(); Destroy(); return false; } else return Super.PickDestination(); } //------------------------------------------------------------------------- function WanderDidMoveSpecialHandling() { if( !bWalkedToMomma && MoveResult == MR_DestinationReached ) { bWalkedToMomma = true; PlayMommySound(); #debug UpdateBehavior( false, GetContext() ); #release UpdateBehavior( false ); } } //------------------------------------------------------------------------- event BeginState() { HatchedTime = Level.TimeSeconds; // reset hatch time for fighting hatchlings } //------------------------------------------------------------------------- event EndState() { RemoveAllTimers(); } //------------------------------------------------------------------------- @ BeginLabel: if( !bGrownUp ) { bGrownUp=true; Sleep( Pawn.MeshAgentCallAction( 'Event_BambuBirth' ) ); Sleep( Pawn.MeshAgentCallAction( 'Event_BambuFirstSteps' ) ); Pawn.MeshAgentCallAction( 'Event_BambuWobble' ); } GotoLabel( MovePickDestLabel ); } // HatchedState //----------------------------------------------------------------------------- defaultproperties { FollowMommaSeconds=60.000000 MinSelfDestructDistance=2000.000000 MaxWanderDistanceFromMomma=250.000000 MommySound=Sound'U2WeaponsA.LeechGun.LG_SpiderBabyBorn' DefaultState='Hatched' 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 |