RuneI
Class Baracuda

source: c:\runehov\RuneI\Classes\Baracuda.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--RuneI.ScriptPawn
            |
            +--RuneI.Baracuda
Direct Known Subclasses:None

class Baracuda
extends RuneI.ScriptPawn

//============================================================================= // Baracuda. //=============================================================================
Variables
 float AirTime

States
Flopping, Fighting, Fleeing

Function Summary
 void FootStep()
     
//=============================================================================
//
// FootStep Notify
// 
//=============================================================================
 void Landed(vector HitNormal, Actor HitActor)
 Texture PainSkin(int BodyPart)
 void PlayDeath(name DamageType)
 void PlayInAir(optional float)
 void PlayMoving(optional float)
 void PlayWaiting(optional float)
     
// ANIMATIONS -----------------------------------------------------------------
 void PreSetMovement()
     
// FUNCTIONS ------------------------------------------------------------------
 void SpeechTimer()
 void ZoneChange(ZoneInfo NewZone)


State Flopping Function Summary
 void BeginState()
 void AnimEnd()
 void Timer()
 void Landed(vector HitNormal, Actor HitActor)


State Fighting Function Summary
 void AmbientSoundTimer()


State Fleeing Function Summary



Source Code


00001	//=============================================================================
00002	// Baracuda.
00003	//=============================================================================
00004	class Baracuda expands ScriptPawn;
00005	
00006	
00007	/* Description:
00008		Swims around and eats things.
00009		uses collision joint to sense collisions.  Swims away quickly upon touch.
00010	
00011	   ANIMS:
00012		Death
00013		Turn
00014		Flop
00015	
00016	   TODO:
00017	*/
00018	
00019	var(Sounds) sound	SwimSound;
00020	var float AirTime;
00021	
00022	
00023	// FUNCTIONS ------------------------------------------------------------------
00024	
00025	function PreSetMovement()
00026	{
00027		bCanJump = false;
00028		bCanWalk = false;
00029		bCanSwim = true;
00030		bCanFly = false;
00031		MinHitWall = -0.6;
00032		bCanOpenDoors = false;
00033		bCanDoSpecial = false;
00034	}
00035	
00036	function SpeechTimer()
00037	{
00038		IgnoreEnemy=None;
00039	}
00040	
00041	function Texture PainSkin(int BodyPart)
00042	{
00043	}
00044	
00045	//=============================================================================
00046	//
00047	// FootStep Notify
00048	// 
00049	//=============================================================================
00050	function FootStep()
00051	{
00052		local EMatterType matter;
00053		local vector end;
00054		local sound snd;
00055		local int i;
00056	
00057		if(bFootsteps && Region.Zone.bWaterZone)
00058		{
00059			PlaySound(SwimSound, SLOT_Interact, 0.33, false,, 0.95 + (FRand() * 0.1));
00060		}
00061	}
00062	
00063	
00064	function ZoneChange( ZoneInfo NewZone )
00065	{
00066		Super.ZoneChange(NewZone);
00067		if (!NewZone.bWaterZone)
00068		{
00069			AmbientSound = None;
00070			if (Physics != PHYS_Falling)
00071			{
00072				MoveTimer = -1;
00073				SetPhysics(PHYS_Falling);
00074			}
00075		}
00076		else if (AmbientSound == None)
00077		{
00078			AmbientSound=Default.AmbientSound;
00079		}
00080	}
00081	
00082	function Landed(vector HitNormal, actor HitActor)
00083	{
00084		local rotator newRotation;
00085	
00086		Super.Landed(HitNormal, HitActor);
00087	
00088		SetPhysics(PHYS_None);
00089		SetTimer(0.2 + FRand(), false);
00090		newRotation = Rotation;
00091		newRotation.Pitch = 0;
00092		newRotation.Roll = 16384;
00093		SetRotation(newRotation);
00094		GotoState('Flopping');
00095	}
00096	
00097	
00098	// ANIMATIONS -----------------------------------------------------------------
00099	function PlayWaiting(optional float tween)			{	LoopAnim('swim', 1.0, 0.1);	}
00100	function PlayMoving(optional float tween)			{	LoopAnim('swim', 1.0, 0.1);	}
00101	function PlayInAir(optional float tween)			{	LoopAnim('swim', 1.0, 0.1);	}
00102	function PlayDeath(name DamageType)					{	PlayAnim('death',1.0, 0.1);	}
00103	
00104	
00105	// STATES ---------------------------------------------------------------------
00106	
00107	// Fleeing state is used to back off, circle around, for another charge
00108	State Fleeing
00109	{
00110	ignores HitWall;
00111	
00112	Begin:
00113		SpeechTime = RandRange(3,10);	// When this timer expires, return to attack
00114		IgnoreEnemy=Enemy;
00115		Enemy=None;
00116		GotoState('Roaming');
00117	}
00118	
00119	
00120	state Fighting
00121	{
00122	ignores SeePlayer, HearNoise;
00123	
00124		function AmbientSoundTimer()
00125		{
00126			PlayAmbientFightSound();
00127		}
00128	
00129	
00130	Begin:
00131		// Damage check
00132	
00133		GotoState('Fleeing');
00134	}
00135	
00136	
00137	State Flopping
00138	{
00139		ignores Touch, Bump, SeePlayer, HearNoise, EnemyAcquired;
00140	
00141		function Landed(vector HitNormal, actor HitActor)
00142		{
00143			local rotator newRotation;
00144	
00145			SetPhysics(PHYS_None);
00146			SetTimer(0.3 + 0.3 * AirTime * FRand(), false);
00147			newRotation = Rotation;
00148			newRotation.Pitch = 0;
00149			newRotation.Roll = 16384;
00150			SetRotation(newRotation);
00151		}
00152			
00153		function Timer()
00154		{
00155			AirTime += 1;
00156			if (AirTime > 25 + 20 * FRand())
00157			{
00158				Died(self, 'Suffocated', Location);
00159			}
00160			else
00161			{
00162				SetPhysics(PHYS_Falling);
00163				Velocity = 200 * VRand();
00164				Velocity.Z = 60 + 160 * FRand();
00165				DesiredRotation.Pitch = Rand(8192) - 4096;
00166				DesiredRotation.Yaw = Rand(65535);
00167			}		
00168		}
00169	
00170		function AnimEnd()
00171		{
00172			PlayAnim('Swim', 0.1 * FRand());
00173		}
00174	
00175		function BeginState()
00176		{
00177			SetPhysics(PHYS_Falling);
00178		}
00179	}
00180	
00181	defaultproperties
00182	{
00183	     FightOrFlight=0.700000
00184	     FightOrDefend=1.000000
00185	     HighOrLow=1.000000
00186	     bRoamHome=True
00187	     bGlider=True
00188	     bBurnable=False
00189	     GroundSpeed=0.000000
00190	     WaterSpeed=300.000000
00191	     AccelRate=400.000000
00192	     JumpZ=0.000000
00193	     WalkingSpeed=300.000000
00194	     ClassID=16
00195	     Health=50
00196	     HitSound1=Sound'CreaturesSnd.Fish.fish07'
00197	     HitSound2=Sound'CreaturesSnd.Fish.fish07'
00198	     HitSound3=Sound'CreaturesSnd.Fish.fish07'
00199	     Die=Sound'CreaturesSnd.Fish.fish08'
00200	     Die2=Sound'CreaturesSnd.Fish.fish08'
00201	     Die3=Sound'CreaturesSnd.Fish.fish08'
00202	     SoundRadius=20
00203	     SoundVolume=115
00204	     SoundPitch=54
00205	     AmbientSound=Sound'CreaturesSnd.Fish.fish01L'
00206	     TransientSoundRadius=800.000000
00207	     CollisionRadius=65.000000
00208	     CollisionHeight=15.000000
00209	     bCollideActors=False
00210	     bBlockActors=False
00211	     bBlockPlayers=False
00212	     Mass=50.000000
00213	     Buoyancy=50.000000
00214	     RotationRate=(Yaw=22768)
00215	     Skeletal=SkelModel'creatures.Baracuda'
00216	}

End Source Code