UnrealI
Class Krall

source: e:\games\UnrealTournament\UnrealI\Classes\Krall.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--UnrealShare.ScriptedPawn
            |
            +--UnrealI.Krall
Direct Known Subclasses:KrallElite, LeglessKrall

class Krall
extends UnrealShare.ScriptedPawn

//============================================================================= // Krall. //=============================================================================
Variables
 bool AttackSuccess
 float MinDuckTime
 byte StrikeDamage,
 Dice Toy1
 Dice Toy2
 bool bDicePlayer
 bool bHasDice
 bool bSleeping
 bool bSpearToss
 name phrase

States
TacticalMove

Function Summary
 eAttitude AttitudeToCreature(Pawn Other)
     
//=========================================================================================
 bool CanFireAtEnemy()
 void GrabDice()
 void PlayAcquisitionSound()
 void PlayBigDeath(name DamageType)
 void PlayChallenge()
 void PlayDive()
 void PlayFearSound()
 void PlayGutDeath(name DamageType)
 void PlayHeadDeath(name DamageType)
 void PlayInAir()
 void PlayLanded(float impactVel)
 void PlayLeftDeath(name DamageType)
 void PlayMeleeAttack()
 void PlayMovingAttack()
 void PlayOutOfWater()
 void PlayPatrolStop()
 void PlayRangedAttack()
 void PlayRightDeath(name DamageType)
 void PlayRoamingSound()
 void PlayRunning()
 void PlaySwimming()
 void PlayTakeHit(float tweentime, vector HitLoc, int damage)
 void PlayThreatening()
 void PlayThreateningSound()
 void PlayTurning()
 void PlayVictoryDance()
 void PlayWaiting()
 void PlayWaitingAmbush()
 void PlayWalking()
 void PoundDamageTarget()
 void PreBeginPlay()
 void SetMovementPhysics()
 void ShotMove()
 Carcass SpawnCarcass()
 void SpawnShot()
 void Speak()
 void SpeakOrderTo(ScriptedPawn TeamMember)
 void SpeakTo(ScriptedPawn Other)
 void SpeechTimer()
     
//=========================================================================================
// Speech
 void StrikeDamageTarget()
 void ThrowDamageTarget()
 void ThrowDice()
 void ThrowTarget()
 void TryToDuck(vector duckDir, bool bReversed)
 void TweenToFalling()
 void TweenToFighter(float tweentime)
 void TweenToPatrolStop(float tweentime)
 void TweenToRunning(float tweentime)
 void TweenToSwimming(float tweentime)
 void TweenToWaiting(float tweentime)
 void TweenToWalking(float tweentime)
 void ZoneChange(ZoneInfo newZone)


State TacticalMove Function Summary
 void TweenToRunning(float tweentime)



Source Code


00001	//=============================================================================
00002	// Krall.
00003	//=============================================================================
00004	class Krall extends ScriptedPawn;
00005	
00006	#exec MESH IMPORT MESH=KrallM ANIVFILE=MODELS\krall_a.3D DATAFILE=MODELS\krall_d.3D LODSTYLE=2 ZEROTEX=1
00007	#exec MESH ORIGIN MESH=KrallM X=70 Y=-240 Z=-120 YAW=64 ROLL=-64
00008	
00009	#exec MESH SEQUENCE MESH=krallM SEQ=All          STARTFRAME=0   NUMFRAMES=498
00010	#exec MESH SEQUENCE MESH=krallM SEQ=Breath       STARTFRAME=0   NUMFRAMES=6   RATE=6
00011	#exec MESH SEQUENCE MESH=krallM SEQ=Crouch       STARTFRAME=6   NUMFRAMES=1				GROUP=Ducking
00012	#exec MESH SEQUENCE MESH=krallM SEQ=Die1         STARTFRAME=7   NUMFRAMES=23  RATE=15
00013	#exec MESH SEQUENCE MESH=krallM SEQ=Die2         STARTFRAME=30  NUMFRAMES=22  RATE=15
00014	#exec MESH SEQUENCE MESH=krallM SEQ=Die3         STARTFRAME=52  NUMFRAMES=12  RATE=15
00015	#exec MESH SEQUENCE MESH=krallM SEQ=Die4         STARTFRAME=64  NUMFRAMES=17  RATE=15
00016	#exec MESH SEQUENCE MESH=krallM SEQ=Fighter      STARTFRAME=157 NUMFRAMES=1 
00017	#exec MESH SEQUENCE MESH=krallM SEQ=Hit          STARTFRAME=81  NUMFRAMES=7   RATE=15
00018	#exec MESH SEQUENCE MESH=krallM SEQ=HeadHit      STARTFRAME=88  NUMFRAMES=1
00019	#exec MESH SEQUENCE MESH=krallM SEQ=LeftHit      STARTFRAME=89  NUMFRAMES=1
00020	#exec MESH SEQUENCE MESH=krallM SEQ=GutHit       STARTFRAME=90  NUMFRAMES=1
00021	#exec MESH SEQUENCE MESH=krallM SEQ=RightHit     STARTFRAME=91  NUMFRAMES=1
00022	#exec MESH SEQUENCE MESH=krallM SEQ=Jump         STARTFRAME=92  NUMFRAMES=1
00023	#exec MESH SEQUENCE MESH=krallM SEQ=Land		    STARTFRAME=93  NUMFRAMES=1
00024	#exec MESH SEQUENCE MESH=krallM SEQ=Look         STARTFRAME=94  NUMFRAMES=23  RATE=15
00025	#exec MESH SEQUENCE MESH=krallM SEQ=Run          STARTFRAME=117 NUMFRAMES=10  RATE=15
00026	#exec MESH SEQUENCE MESH=krallM SEQ=Shoot1       STARTFRAME=127 NUMFRAMES=8   RATE=15   Group=Attack
00027	#exec MESH SEQUENCE MESH=krallM SEQ=ThreatShoot1 STARTFRAME=127 NUMFRAMES=3   RATE=15
00028	#exec MESH SEQUENCE MESH=krallM SEQ=Shoot2       STARTFRAME=135 NUMFRAMES=22  RATE=15	GROUP=MovingAttack
00029	#exec MESH SEQUENCE MESH=krallM SEQ=Strike1      STARTFRAME=157 NUMFRAMES=11  RATE=15   Group=Attack
00030	#exec MESH SEQUENCE MESH=krallM SEQ=Strike2      STARTFRAME=168 NUMFRAMES=12  RATE=15   Group=Attack
00031	#exec MESH SEQUENCE MESH=krallM SEQ=Strike3      STARTFRAME=180 NUMFRAMES=15  RATE=15   Group=Attack
00032	#exec MESH SEQUENCE MESH=krallM SEQ=Swim         STARTFRAME=195 NUMFRAMES=15  RATE=15
00033	#exec MESH SEQUENCE MESH=krallM SEQ=T3           STARTFRAME=210 NUMFRAMES=7   RATE=15
00034	#exec MESH SEQUENCE MESH=krallM SEQ=Throw        STARTFRAME=217 NUMFRAMES=25  RATE=15   Group=Attack
00035	#exec MESH SEQUENCE MESH=krallM SEQ=Twirl        STARTFRAME=242 NUMFRAMES=35
00036	#exec MESH SEQUENCE MESH=krallM SEQ=Walk         STARTFRAME=277 NUMFRAMES=15  RATE=15
00037	#exec MESH SEQUENCE MESH=krallM SEQ=Breath2      STARTFRAME=292 NUMFRAMES=7   RATE=6	GROUP=Ducking
00038	#exec MESH SEQUENCE MESH=krallM SEQ=Grasp        STARTFRAME=299 NUMFRAMES=18  RATE=15	GROUP=Ducking
00039	#exec MESH SEQUENCE MESH=krallM SEQ=HeadRub      STARTFRAME=317 NUMFRAMES=18  RATE=15	GROUP=Ducking
00040	#exec MESH SEQUENCE MESH=krallM SEQ=Laugh        STARTFRAME=335 NUMFRAMES=25  RATE=15	GROUP=Ducking
00041	#exec MESH SEQUENCE MESH=krallM SEQ=Toss         STARTFRAME=360 NUMFRAMES=25  RATE=15	GROUP=Ducking
00042	#exec MESH SEQUENCE MESH=krallM SEQ=Dead5        STARTFRAME=385 NUMFRAMES=31  RATE=15	
00043	#exec MESH SEQUENCE MESH=krallM SEQ=Drag         STARTFRAME=416 NUMFRAMES=20  RATE=15	
00044	#exec MESH SEQUENCE MESH=krallM SEQ=LegLoss      STARTFRAME=436 NUMFRAMES=13  RATE=15	
00045	#exec MESH SEQUENCE MESH=krallM SEQ=Shoot3       STARTFRAME=449 NUMFRAMES=10  RATE=15	
00046	#exec MESH SEQUENCE MESH=krallM SEQ=Sleep1       STARTFRAME=459 NUMFRAMES=8   RATE=6	
00047	#exec MESH SEQUENCE MESH=krallM SEQ=Sleep2       STARTFRAME=467 NUMFRAMES=8   RATE=6	
00048	#exec MESH SEQUENCE MESH=krallM SEQ=Sleep3       STARTFRAME=475 NUMFRAMES=8   RATE=6	
00049	#exec MESH SEQUENCE MESH=krallM SEQ=SwimFire     STARTFRAME=483 NUMFRAMES=15  RATE=15	
00050	#exec MESH SEQUENCE MESH=krallM SEQ=LeglessDeath STARTFRAME=448 NUMFRAMES=1	
00051	
00052	#exec TEXTURE IMPORT NAME=jkrall FILE=MODELS\krall.PCX GROUP=Skins 
00053	#exec MESHMAP SCALE MESHMAP=krallM X=0.11 Y=0.11 Z=0.22
00054	#exec MESHMAP SETTEXTURE MESHMAP=krallM NUM=0 TEXTURE=jkrall
00055	
00056	#exec MESH NOTIFY MESH=krallM SEQ=Shoot1 TIME=0.25 FUNCTION=SpawnShot
00057	#exec MESH NOTIFY MESH=krallM SEQ=Shoot2 TIME=0.48 FUNCTION=SpawnShot
00058	#exec MESH NOTIFY MESH=krallM SEQ=Shoot2 TIME=0.8 FUNCTION=ShotMove
00059	#exec MESH NOTIFY MESH=krallM SEQ=Shoot3 TIME=0.35 FUNCTION=SpawnShot
00060	#exec MESH NOTIFY MESH=krallM SEQ=Strike1 TIME=0.375 FUNCTION=StrikeDamageTarget
00061	#exec MESH NOTIFY MESH=krallM SEQ=Strike2 TIME=0.5 FUNCTION=StrikeDamageTarget
00062	#exec MESH NOTIFY MESH=krallM SEQ=Strike3 TIME=0.26 FUNCTION=PoundDamageTarget
00063	#exec MESH NOTIFY MESH=krallM SEQ=Throw TIME=0.19 FUNCTION=ThrowDamageTarget
00064	#exec MESH NOTIFY MESH=krallM SEQ=Throw TIME=0.42 FUNCTION=ThrowTarget
00065	#exec MESH NOTIFY MESH=krallM SEQ=Grasp TIME=0.58 FUNCTION=GrabDice
00066	#exec MESH NOTIFY MESH=krallM SEQ=Toss  TIME=0.63 FUNCTION=ThrowDice
00067	#exec MESH NOTIFY MESH=krallM SEQ=Die1  TIME=0.64 FUNCTION=LandThump
00068	#exec MESH NOTIFY MESH=krallM SEQ=Die2  TIME=0.81 FUNCTION=LandThump
00069	#exec MESH NOTIFY MESH=krallM SEQ=Die3  TIME=0.54 FUNCTION=LandThump
00070	#exec MESH NOTIFY MESH=krallM SEQ=Die4  TIME=0.75 FUNCTION=LandThump
00071	#exec MESH NOTIFY MESH=krallM SEQ=Dead5 TIME=0.83 FUNCTION=LandThump
00072	
00073	#exec AUDIO IMPORT FILE="Sounds\Krall\amb1kr.WAV" NAME="amb1kr" GROUP="Krall"
00074	#exec AUDIO IMPORT FILE="Sounds\Krall\syl13kr.WAV" NAME="syl1kr" GROUP="Krall"
00075	#exec AUDIO IMPORT FILE="Sounds\Krall\syl14kr.WAV" NAME="syl2kr" GROUP="Krall"
00076	#exec AUDIO IMPORT FILE="Sounds\Krall\syl15kr.WAV" NAME="syl3kr" GROUP="Krall"
00077	#exec AUDIO IMPORT FILE="Sounds\Krall\syl16kr.WAV" NAME="syl4kr" GROUP="Krall"
00078	#exec AUDIO IMPORT FILE="Sounds\Krall\syl17kr.WAV" NAME="syl5kr" GROUP="Krall"
00079	#exec AUDIO IMPORT FILE="Sounds\Krall\syl18kr.WAV" NAME="syl6kr" GROUP="Krall"
00080	#exec AUDIO IMPORT FILE="Sounds\Krall\death1a.WAV" NAME="death1k" GROUP="Krall"
00081	#exec AUDIO IMPORT FILE="Sounds\Krall\death2a.WAV" NAME="death2k" GROUP="Krall"
00082	#exec AUDIO IMPORT FILE="Sounds\Krall\strike1kr.WAV" NAME="strike1k" GROUP="Krall"
00083	#exec AUDIO IMPORT FILE="Sounds\Krall\staflp4kr.WAV" NAME="staflp4k" GROUP="Krall"
00084	#exec AUDIO IMPORT FILE="Sounds\Krall\injur1a.WAV" NAME="injur1k" GROUP="Krall"
00085	#exec AUDIO IMPORT FILE="Sounds\Krall\injur2a.WAV" NAME="injur2k" GROUP="Krall"
00086	#exec AUDIO IMPORT FILE="Sounds\Krall\chlng1a.WAV" NAME="chlng1k" GROUP="Krall"
00087	#exec AUDIO IMPORT FILE="Sounds\Krall\chlng2a.WAV" NAME="chlng2k" GROUP="Krall"
00088	#exec AUDIO IMPORT FILE="Sounds\Krall\hit2a.WAV" NAME="hit2k" GROUP="Krall"
00089	#exec AUDIO IMPORT FILE="Sounds\Krall\throw1kr.WAV" NAME="throw1k" GROUP="Krall"
00090	#exec AUDIO IMPORT FILE="Sounds\Krall\snore1kr.WAV" NAME="snore1k" GROUP="Krall"
00091	//FIXME - also have look1a (for look anim)
00092	//FIXME- How to use strike3kr?
00093	
00094	var() byte StrikeDamage,
00095		ThrowDamage,
00096		PoundDamage;
00097	var bool AttackSuccess;
00098	var() bool bSpearToss;
00099	var() bool bDicePlayer;
00100	var() bool bSleeping;
00101	var   bool bHasDice;
00102	var	  bool bHeldDice;
00103	var(Sounds) sound strike1;
00104	var(Sounds) sound strike2;
00105	var(Sounds) sound twirl;
00106	var(Sounds) sound syllable1;
00107	var(Sounds) sound syllable2;
00108	var(Sounds) sound syllable3;
00109	var(Sounds) sound syllable4;
00110	var(Sounds) sound syllable5;
00111	var(Sounds) sound syllable6;
00112	var(Sounds) sound die2;
00113	var(Sounds)	sound spearHit;
00114	var(Sounds) sound spearThrow;
00115	var 	name phrase;
00116	var		byte phrasesyllable;
00117	var		float	voicePitch;
00118	var Dice Toy1;
00119	var Dice Toy2;
00120	var()	float MinDuckTime;
00121	var		float LastDuckTime;
00122	
00123	function PreBeginPlay()
00124	{
00125		bCanSpeak = true;
00126		voicePitch = 0.25 + 0.5 * FRand();
00127		if ( CombatStyle == Default.CombatStyle)
00128			CombatStyle = CombatStyle + 0.4 * FRand() - 0.2;
00129		bCanDuck = (FRand() < 0.5);
00130		Super.PreBeginPlay();
00131		if ( bDicePlayer )
00132			PeripheralVision = 1.0; 
00133		if ( Skill == 0 )
00134			ProjectileSpeed *= 0.85;
00135		else if ( Skill > 2 )
00136		{
00137			bCanStrafe = true;
00138			ProjectileSpeed *= 1.1;
00139		}
00140		if ( !IsA('KrallElite') )
00141			bLeadTarget = false;
00142	}
00143	
00144	function Carcass SpawnCarcass()
00145	{
00146		local carcass carc;
00147		
00148		carc = Spawn(CarcassType);
00149		carc.Initfor(self);
00150		carc.bReducedHeight = true;
00151		carc.PrePivot = PrePivot;
00152		return carc;
00153	}
00154	
00155	function PlayTakeHit(float tweentime, vector HitLoc, int damage)
00156	{
00157		local carcass carc;
00158		local LeglessKrall rep;
00159		local pawn OtherPawn;
00160		local Actor A;
00161	
00162		if ( (Health > 30) || (damage < 24) || (HitLoc.Z > Location.Z) || (FRand() < 0.6) || Level.Game.bVeryLowGore )
00163		{
00164			Super.PlayTakeHit(tweentime, HitLoc, damage);
00165			return;
00166		}
00167	
00168		carc = Spawn(class 'CreatureChunks',,, Location - CollisionHeight * vect(0,0,0.5), Rotation + rot(3000,0,16384) );
00169		if (carc != None)
00170		{
00171			carc.Mesh = mesh'KrallFoot';
00172			carc.Initfor(self);
00173			carc.Velocity = Velocity + VSize(Velocity) * VRand();
00174			carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z);
00175		}
00176		carc = Spawn(class 'CreatureChunks',,, Location - CollisionHeight * vect(0,0,0.5), Rotation + rot(3000,0,16384) );
00177		if (carc != None)
00178		{
00179			carc.Mesh = mesh'KrallFoot';
00180			carc.Initfor(self);
00181			carc.Velocity = Velocity + VSize(Velocity) * VRand();
00182			carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z);
00183		}
00184	
00185		SetCollision(false, false, false);
00186		OtherPawn = Level.PawnList;
00187		while ( OtherPawn != None )
00188		{
00189			OtherPawn.Killed(enemy, self, '');
00190			OtherPawn = OtherPawn.nextPawn;
00191		}
00192		if ( CarriedDecoration != None )
00193			DropDecoration();
00194		if ( Event != '' )
00195			foreach AllActors( class 'Actor', A, Event )
00196				A.Trigger( self, enemy );
00197		Level.Game.DiscardInventory(self);
00198		Velocity.Z *= 1.3;
00199		rep = Spawn(class'LeglessKrall');
00200		rep.InitFor(self);
00201		destroy();
00202	}
00203	
00204	function ZoneChange(ZoneInfo newZone)
00205	{
00206		bCanSwim = newZone.bWaterZone; //only when it must
00207			
00208		if ( newZone.bWaterZone )
00209			CombatStyle = 1.0; //always charges when in the water
00210		else if (Physics == PHYS_Swimming)
00211			CombatStyle = Default.CombatStyle;
00212	
00213		Super.ZoneChange(newZone);
00214	}
00215	
00216	function SetMovementPhysics()
00217	{
00218		if ( Region.Zone.bWaterZone )
00219			SetPhysics(PHYS_Swimming);
00220		else if (Physics != PHYS_Walking)
00221			SetPhysics(PHYS_Walking); 
00222	}
00223	
00224	function TryToDuck(vector duckDir, bool bReversed)
00225	{
00226		local vector HitLocation, HitNormal, Extent;
00227		local actor HitActor;
00228	
00229		//log("duck");
00230		
00231		if ( Level.TimeSeconds - LastDuckTime < (0.25 + 0.5 * FRand()) * MinDuckTime )
00232			return;	
00233		duckDir.Z = 0;
00234		if ( (Skill == 0) && (FRand() < 0.5) )
00235			DuckDir *= -1;	
00236	
00237		Extent.X = CollisionRadius;
00238		Extent.Y = CollisionRadius;
00239		Extent.Z = CollisionHeight;
00240		HitActor = Trace(HitLocation, HitNormal, Location + 128 * duckDir, Location, false, Extent);
00241		if (HitActor != None)
00242		{
00243			duckDir *= -1;
00244			HitActor = Trace(HitLocation, HitNormal, Location + 128 * duckDir, Location, false, Extent);
00245		}
00246		if (HitActor != None)
00247			return;
00248		
00249		HitActor = Trace(HitLocation, HitNormal, Location + 128 * duckDir - MaxStepHeight * vect(0,0,1), Location + 128 * duckDir, false, Extent);
00250		if (HitActor == None)
00251			return;
00252			
00253		//log("good duck");
00254	
00255		LastDuckTime = Level.TimeSeconds;
00256		SetFall();
00257		TweenAnim('Jump', 0.3);
00258		Velocity = duckDir * 1.5 * GroundSpeed;
00259		Velocity.Z = 200;
00260		SetPhysics(PHYS_Falling);
00261		GotoState('FallingState','Ducking');
00262	}	
00263	
00264	//=========================================================================================
00265	// Speech
00266	
00267	
00268	function SpeechTimer()
00269	{
00270		//last syllable expired.  Decide whether to keep the floor or quit
00271		if (FRand() < 0.3)
00272		{
00273			bIsSpeaking = false;
00274			if (TeamLeader != None)
00275				TeamLeader.bTeamSpeaking = false;
00276		}
00277		else
00278			Speak();
00279	}
00280	
00281	function SpeakOrderTo(ScriptedPawn TeamMember)
00282	{
00283		phrase = '';
00284		if ( !TeamMember.bCanSpeak || (FRand() < 0.5) )
00285			Speak();
00286		else  
00287		{
00288			if (SkaarjWarrior(TeamMember) != None)
00289				SkaarjWarrior(TeamMember).phrase = '';
00290			TeamMember.Speak();
00291		}
00292	}
00293	
00294	function SpeakTo(ScriptedPawn Other)
00295	{
00296		if (Other.bIsSpeaking || ((TeamLeader != None) && TeamLeader.bTeamSpeaking) )
00297			return;
00298		
00299		phrase = '';
00300		Speak();
00301	}
00302	
00303	function Speak()
00304	{
00305		local float decision;
00306		
00307		//if (phrase != '')
00308		//	SpeakPhrase();
00309		bIsSpeaking = true;
00310		decision = FRand();
00311		if (TeamLeader != None)	
00312			TeamLeader.bTeamSpeaking = true;
00313		if (decision < 0.167)
00314			PlaySound(Syllable1,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00315		else if (decision < 0.333)
00316			PlaySound(Syllable2,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00317		else if (decision < 0.5)
00318			PlaySound(Syllable3,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00319		else if (decision < 0.667)
00320			PlaySound(Syllable4,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00321		else if (decision < 0.833)
00322			PlaySound(Syllable5,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00323		else 
00324			PlaySound(Syllable6,SLOT_Talk,0.3 + FRand(),,, FRand() + voicePitch);
00325	
00326		SpeechTime = 0.1 + 0.3 * FRand();
00327	}
00328		
00329	function PlayAcquisitionSound()
00330	{
00331		if ( bCanSpeak && (TeamLeader != None) && !TeamLeader.bTeamSpeaking )
00332		{
00333			phrase = 'Acquisition';
00334			phrasesyllable = 0;
00335			Speak();
00336			return;
00337		}
00338		Super.PlayAcquisitionSound(); 
00339	}
00340	
00341	function PlayFearSound()
00342	{
00343		if ( bCanSpeak && (TeamLeader != None) && !TeamLeader.bTeamSpeaking )
00344		{
00345			phrase = 'Fear';
00346			phrasesyllable = 0;
00347			Speak();
00348			return;
00349		}
00350		Super.PlayFearSound(); 
00351	}
00352	
00353	function PlayRoamingSound()
00354	{
00355		if ( bCanSpeak && (TeamLeader != None) && !TeamLeader.bTeamSpeaking  && (FRand() < 0.5) )
00356		{
00357			phrase = '';
00358			Speak();
00359			return;
00360		} 
00361		Super.PlayRoamingSound();
00362	}
00363	
00364	function PlayThreateningSound()
00365	{
00366		if ( bCanSpeak && (FRand() < 0.6) && ((TeamLeader == None) || !TeamLeader.bTeamSpeaking) )
00367		{
00368			phrase = 'Threaten';
00369			phrasesyllable = 0;
00370			Speak();
00371			return;
00372		} 
00373		Super.PlayThreateningSound();
00374	}
00375	
00376	//=========================================================================================
00377	function eAttitude AttitudeToCreature(Pawn Other)
00378	{
00379		if ( Other.IsA('Nali') )
00380			return ATTITUDE_Hate;
00381		else if ( Other.IsA('Krall') )
00382			return ATTITUDE_Friendly;
00383		else
00384			return ATTITUDE_Ignore;
00385	}
00386	
00387	function ThrowDice()
00388	{
00389		local Dice d1, d2;
00390		local vector X,Y,Z, ThrowLoc;
00391	
00392		d1 = Krall(TeamLeader).Toy1;
00393		d2 = Krall(TeamLeader).Toy2;
00394		GetAxes(Rotation, X,Y,Z);
00395		ThrowLoc = Location + X * CollisionRadius + Y * CollisionRadius - Z * 0.6 * CollisionHeight; 
00396		d1.SetLocation(ThrowLoc);
00397		d2.SetLocation(ThrowLoc + vect(2,2,2));
00398	
00399		d1.instigator = self;
00400		d1.Throw(Y);
00401	
00402		d2.instigator = self;
00403		d2.Throw(Y);
00404	}
00405	
00406	function GrabDice()
00407	{
00408		if ( Krall(TeamLeader).Toy1 == None )
00409			Krall(TeamLeader).Toy1 = Spawn(class'Dice');
00410		if ( Krall(TeamLeader).Toy2 == None )
00411			Krall(TeamLeader).Toy2 = Spawn(class'Dice');
00412			
00413		Krall(TeamLeader).Toy1.bHidden = True;
00414		Krall(TeamLeader).Toy2.bHidden = True;
00415	}
00416	
00417	
00418	function PlayWaiting()
00419	{
00420		local float decision;
00421		local float animspeed;
00422		if (Region.Zone.bWaterZone)
00423		{
00424			PlaySwimming();
00425			return;
00426		}
00427	
00428		if ( bSleeping )
00429		{
00430			animspeed = 0.5 + 0.5 * FRand(); 
00431			SetAlertness(-1.0);
00432			LoopAnim('Sleep1', AnimSpeed );
00433			PlaySound(sound'Snore1K',SLOT_Talk);
00434			return;
00435		}
00436	
00437		decision = FRand();
00438	
00439		if ( bDicePlayer ) 
00440		{
00441			animspeed = 0.4 + 0.6 * FRand(); 
00442			SetAlertness(-1.0);
00443			
00444			if ( TeamLeader == None )
00445			{
00446				if ( decision < 0.9 )
00447					LoopAnim('Breath2', animspeed, 0.5);
00448				else
00449					LoopAnim('HeadRub', animspeed);
00450				return;
00451			}
00452	
00453			if ( !TeamLeader.bTeamSpeaking )
00454			{
00455				phrase = '';
00456				Speak();
00457			}
00458			if ( bHasDice )
00459			{
00460				if ( AnimSequence == 'Toss' )
00461				{
00462					bHasDice = false;
00463					Krall(TeamLeader).bHeldDice = false;
00464				}
00465				else if ( FRand() < 0.8 )
00466				{
00467					PlayAnim('Toss', animspeed);
00468					return;
00469				}
00470			}
00471			if ( Krall(TeamLeader).bHeldDice || ( FRand() < 0.65) )
00472			{
00473				if ( decision < 0.8 )
00474					LoopAnim('Breath2', animspeed, 0.5);
00475				else if ( decision < 0.9 )
00476					LoopAnim('Laugh', animspeed);
00477				else 
00478					LoopAnim('HeadRub', animspeed);
00479				return;
00480			}
00481			Krall(TeamLeader).bHeldDice = True;
00482			bHasDice = True;
00483			PlayAnim('Grasp', animspeed);
00484			return;
00485		}
00486	
00487		if (AnimSequence == 'Look')
00488		{
00489			SetAlertness(0.0);
00490			if (!bQuiet && decision < 0.3) 
00491			{
00492				LoopAnim('Twirl', 0.3 + 0.6 * FRand());
00493			    PlaySound(Twirl,SLOT_Interact,0.5,,500);
00494			}	
00495			else 
00496				LoopAnim('Breath', 0.2 + 0.7 * FRand());
00497			return;
00498		}
00499	 	else if (AnimSequence == 'Twirl')
00500		{
00501	 		SetAlertness(0.0);
00502	 		if (decision < 0.5) 
00503			{
00504			    PlaySound(Twirl,SLOT_Interact,0.5,,500);	
00505				LoopAnim('Twirl', 0.3 + 0.6 * FRand());
00506			}
00507			else 
00508				LoopAnim( 'Breath', 0.2 + 0.7 * FRand());
00509			return;
00510		}
00511		
00512		if (decision < 0.2)
00513		{
00514			SetAlertness(0.5);
00515			LoopAnim('Look', 0.2 + 0.7 * FRand());
00516		}
00517		else
00518		{
00519			SetAlertness(0.0);
00520			LoopAnim('Breath', 0.2 + 0.7 * FRand());
00521		}
00522	}
00523	
00524	function PlayPatrolStop()
00525	{
00526		if (Region.Zone.bWaterZone)
00527		{
00528			PlaySwimming();
00529			return;
00530		}
00531			
00532		if ( (AnimSequence == 'Breath') && (FRand() < 0.4) )
00533		{
00534			SetAlertness(0.5);
00535			LoopAnim('Look', 0.2 + 0.7 * FRand());
00536			return;
00537		}
00538		else if ( !bQuiet && (AnimSequence == 'Look') && (FRand() < 0.3) )
00539		{
00540			SetAlertness(0.0);
00541		    PlaySound(Twirl,SLOT_Interact,0.5,,500);	
00542			LoopAnim('Twirl', 0.3 + 0.6 * FRand());
00543			return;
00544		}
00545	 	else if ( (AnimSequence == 'Twirl') && (FRand() < 0.5) )
00546		{
00547	 		SetAlertness(0.0);
00548		    PlaySound(Twirl,SLOT_Interact,0.5,,500);	
00549			LoopAnim('Twirl', 0.3 + 0.6 * FRand());
00550			return;
00551		}
00552		SetAlertness(0.0);
00553		LoopAnim('Breath', 0.2 + 0.7 * FRand());
00554	}
00555		
00556	function PlayWaitingAmbush()
00557	{
00558		if (Region.Zone.bWaterZone)
00559		{
00560			PlaySwimming();
00561			return;
00562		}
00563		if (FRand() < 0.4)
00564			LoopAnim('Look', 0.3);
00565		else 
00566			LoopAnim('Breath', 0.3 + 0.5 * FRand());
00567	}
00568	
00569	function PlayChallenge()
00570	{
00571		if (Region.Zone.bWaterZone)
00572		{
00573			PlaySwimming();
00574			return;
00575		}
00576		if ( TryToCrouch() )
00577		{
00578			TweenAnim('Crouch', 0.12);
00579			return;
00580		}	
00581		PlayThreateningSound();
00582		PlayAnim('T3', 0.7, 0.15);
00583	}
00584	
00585	function PlayDive()
00586	{
00587		TweenToSwimming(0.2);
00588	}
00589	
00590	function TweenToFighter(float tweentime)
00591	{
00592		if ( bDicePlayer )
00593		{
00594			PeripheralVision = Default.PeripheralVision;
00595			bDicePlayer = false;
00596		}
00597		bSleeping = false;
00598		if (Region.Zone.bWaterZone)
00599		{
00600			TweenToSwimming(tweentime);
00601			return;
00602		}
00603		TweenAnim('Fighter', tweentime);
00604	}
00605	
00606	function TweenToRunning(float tweentime)
00607	{
00608		if ( bDicePlayer )
00609		{
00610			PeripheralVision = Default.PeripheralVision;
00611			bDicePlayer = false;
00612		}
00613		bSleeping = false;
00614		if (Region.Zone.bWaterZone)
00615		{
00616			TweenToSwimming(tweentime);
00617			return;
00618		}
00619		if ( (AnimSequence == 'Shoot2') && IsAnimating() )
00620			return;
00621		if ( (AnimSequence != 'Run') || !bAnimLoop )
00622			TweenAnim('Run', tweentime);
00623	}
00624	
00625	function TweenToWalking(float tweentime)
00626	{
00627		if (Region.Zone.bWaterZone)
00628		{
00629			TweenToSwimming(tweentime);
00630			return;
00631		}
00632		TweenAnim('Walk', tweentime);
00633	}
00634	
00635	function TweenToWaiting(float tweentime)
00636	{
00637		if (Region.Zone.bWaterZone)
00638		{
00639			TweenToSwimming(tweentime);
00640			return;
00641		}
00642		if ( bDicePlayer ) 
00643		{
00644			TweenAnim('Breath2', tweentime);
00645			return;
00646		}
00647		TweenAnim('Breath', tweentime);
00648	}
00649	
00650	function TweenToPatrolStop(float tweentime)
00651	{
00652		if (Region.Zone.bWaterZone)
00653		{
00654			TweenToSwimming(tweentime);
00655			return;
00656		}
00657		TweenAnim('Breath', tweentime);
00658	}
00659	
00660	function TweenToFalling()
00661	{
00662		TweenAnim('Jump', 0.35);
00663	}
00664	
00665	function PlayInAir()
00666	{
00667		TweenAnim('Jump', 0.2);
00668	}
00669	
00670	function PlayOutOfWater()
00671	{
00672		TweenAnim('Land',0.8);
00673	}
00674	
00675	function PlayLanded(float impactVel)
00676	{
00677		TweenAnim('Land', 0.1);
00678	}
00679	
00680	function PlayMovingAttack()
00681	{
00682		if (Region.Zone.bWaterZone)
00683		{
00684			PlayAnim('SwimFire');
00685			SpawnShot();
00686			return;
00687		}
00688		DesiredSpeed = 0.4;
00689		MoveTimer += 0.2;
00690		PlayAnim('Shoot2');
00691	}
00692	
00693	function PlayRunning()
00694	{
00695		if (Region.Zone.bWaterZone)
00696		{
00697			PlaySwimming();
00698			return;
00699		}
00700	
00701		DesiredSpeed = 1.0;
00702		if (Focus == Destination)
00703		{
00704			LoopAnim('Run', -1.0/GroundSpeed,, 0.4);
00705			return;
00706		}	
00707		LoopAnim('Run', StrafeAdjust(),,0.3);
00708	}
00709	
00710	function PlayWalking()
00711	{
00712		if (Region.Zone.bWaterZone)
00713		{
00714			PlaySwimming();
00715			return;
00716		}
00717		LoopAnim('Walk', 0.88);
00718	}
00719	
00720	function TweenToSwimming(float tweentime)
00721	{
00722		if ( (AnimSequence != 'Swim') || !bAnimLoop )
00723			TweenAnim('Swim', tweentime);
00724	}
00725	
00726	function PlaySwimming()
00727	{
00728		LoopAnim('Swim', -1.0/WaterSpeed,,0.3);
00729	}
00730	
00731	function PlayThreatening()
00732	{
00733		local float decision, animspeed;
00734	
00735		if (Region.Zone.bWaterZone)
00736		{
00737			PlaySwimming();
00738			return;
00739		}
00740		decision = FRand();
00741		animspeed = 0.4 + 0.6 * FRand(); 
00742	
00743		if ( decision < 0.6 )
00744			PlayAnim('Breath', animspeed, 0.3);
00745		else if ( decision < 0.7 )
00746		{
00747		    PlaySound(Twirl,SLOT_Interact,0.5,,500);	
00748			PlayAnim('Twirl', animspeed, 0.3);
00749		}
00750		else 
00751		{
00752			PlayThreateningSound();
00753			if ( decision < 0.8 )
00754				PlayAnim('T3', animspeed, 0.3);
00755			else if ( decision < 0.9 )
00756				PlayAnim('ThreatShoot1', 0.3, 0.3);
00757			else 
00758				TweenAnim('Fighter', 0.3);
00759		}
00760	}
00761	
00762	function PlayTurning()
00763	{
00764		if (Region.Zone.bWaterZone)
00765		{
00766			PlaySwimming();
00767			return;
00768		}
00769		TweenAnim('Walk', 0.3);
00770	}
00771	
00772	function PlayBigDeath(name DamageType)
00773	{
00774		PlaySound(Die2, SLOT_Talk, 4 * TransientSoundVolume);
00775		PlayAnim('Die2',0.7,0.1);
00776	}
00777	
00778	function PlayHeadDeath(name DamageType)
00779	{
00780		local carcass carc;
00781	
00782		if ( ((DamageType == 'Decapitated') || ((Health < -20) && (FRand() < 0.5)))
00783			 && !Level.Game.bVeryLowGore )
00784		{
00785			carc = Spawn(class 'CreatureChunks',,, Location + CollisionHeight * vect(0,0,0.8), Rotation + rot(3000,0,16384) );
00786			if (carc != None)
00787			{
00788				carc.Mesh = mesh'KrallHead';
00789				carc.Initfor(self);
00790				carc.Velocity = Velocity + VSize(Velocity) * VRand();
00791				carc.Velocity.Z = FMax(carc.Velocity.Z, Velocity.Z);
00792			}
00793			PlayAnim('Dead5',0.7,0.1);
00794			if ( Velocity.Z < 120 )
00795			{
00796				Velocity = GroundSpeed * vector(Rotation);
00797				Velocity.Z = 150;
00798			}
00799		}
00800		else if ( FRand() < 0.5 )
00801			PlayAnim('Die4',0.7,0.1);
00802		else
00803			PlayAnim('Die3',0.7,0.1);
00804		PlaySound(Die, SLOT_Talk, 4 * TransientSoundVolume);
00805	}
00806	
00807	function PlayLeftDeath(name DamageType)
00808	{
00809		PlayAnim('Die4',0.7, 0.1);
00810		PlaySound(Die,SLOT_Talk, 4 * TransientSoundVolume);
00811	}
00812	
00813	function PlayRightDeath(name DamageType)
00814	{
00815		PlayAnim('Die3',0.7,0.1);
00816		PlaySound(Die,SLOT_Talk, 4 * TransientSoundVolume);
00817	}
00818	
00819	function PlayGutDeath(name DamageType)
00820	{
00821		if ( Velocity.Z > 100 )
00822			PlayAnim('Die3',0.7,0.1);
00823		else
00824			PlayAnim('Die1',0.7,0.1);
00825		PlaySound(Die,SLOT_Talk, 4 * TransientSoundVolume);
00826	}
00827	
00828	function PlayVictoryDance()
00829	{
00830	    PlaySound(Twirl,SLOT_Interact,0.5,,500);	
00831		PlayAnim('Twirl', 0.5, 0.1);
00832	}
00833	
00834	function bool CanFireAtEnemy()
00835	{
00836		local vector HitLocation, HitNormal,X,Y,Z, projStart, EnemyDir, EnemyUp;
00837		local actor HitActor;
00838		local float EnemyDist;
00839			
00840		EnemyDir = Enemy.Location - Location;
00841		EnemyDist = VSize(EnemyDir);
00842		EnemyUp = Enemy.CollisionHeight * vect(0,0,0.9);
00843		if ( EnemyDist > 300 )
00844		{
00845			EnemyDir = 300 * EnemyDir/EnemyDist;
00846			EnemyUp = 300 * EnemyUp/EnemyDist;
00847		}
00848		
00849		GetAxes(Rotation,X,Y,Z);
00850		projStart = Location + 0.9 * CollisionRadius * X - 0.7 * CollisionRadius * Y;
00851		HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir + EnemyUp, projStart, true);
00852	
00853		if ( (HitActor == None) || (HitActor == Enemy) 
00854			|| ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) )
00855			return true;
00856	
00857		HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir, projStart , true);
00858	
00859		return ( (HitActor == None) || (HitActor == Enemy) 
00860				|| ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) );
00861	}
00862		
00863	function SpawnShot()
00864	{
00865		DesiredSpeed = 0.0; //For Kraal shoot2 (walking shoot, w/ pause)
00866		FireProjectile( vect(0.9, -0.5, 0), 500);
00867	}
00868	
00869	function ShotMove()
00870	{
00871		DesiredSpeed = 1.0;
00872	}
00873	
00874	function StrikeDamageTarget()
00875	{
00876		if (MeleeDamageTarget(StrikeDamage, StrikeDamage * 700 * Normal(Target.Location - Location)))
00877			PlaySound(SpearHit,SLOT_Interact);
00878	}
00879	
00880	function PoundDamageTarget()
00881	{
00882		if (MeleeDamageTarget(PoundDamage, PoundDamage * 500 * Normal(Target.Location - Location)))
00883			PlaySound(SpearHit,SLOT_Interact);
00884	}
00885	
00886	function ThrowDamageTarget()
00887	{
00888		AttackSuccess = MeleeDamageTarget(ThrowDamage, vect(0,0,0));
00889	}
00890	
00891	function ThrowTarget() 
00892	{
00893		local rotator newRot;
00894		if (AttackSuccess && (Vsize(Target.Location - Location) < CollisionRadius + Target.CollisionRadius + 1.5 * MeleeRange) )
00895		{
00896			PlaySound(SpearThrow,SLOT_Interact);
00897			newRot = Target.Rotation;
00898			newRot.Pitch = 4096;
00899			Target.SetRotation(newRot);
00900			if (Pawn(Target) != None)
00901			{
00902				Pawn(Target).AddVelocity( 
00903					(50000.0 * (Normal(Target.Location - Location) + vect(0,0,1)))/Target.Mass);
00904				if (PlayerPawn(Target) != None)
00905					PlayerPawn(Target).ShakeView(0.2, 2000, -10);
00906			}
00907		}
00908	}
00909		
00910	function PlayMeleeAttack()
00911	{
00912		local float decision;
00913	
00914		decision = FRand();
00915		if (!bSpearToss)
00916			decision *= 0.7;
00917		if (decision < 0.2)
00918		{
00919			PlayAnim('Strike1'); 
00920			PlaySound(Strike1,SLOT_Interact);
00921		}
00922	 	else if (decision < 0.4)
00923	 	{
00924	   		PlayAnim('Strike2');
00925	   		PlaySound(Strike2,SLOT_Interact);
00926	   	}
00927	 	else if (decision < 0.7)
00928	 	{
00929	 		PlayAnim('Strike3');
00930	 		PlaySound(Strike1,SLOT_Interact);
00931	 	}
00932	 	else
00933	 	{
00934	 		PlayAnim('Throw');
00935	 		PlaySound(Strike2,SLOT_Interact);
00936	 	} 
00937	}
00938	
00939	function PlayRangedAttack()
00940	{
00941		local float tweenin;
00942		
00943		if (Region.Zone.bWaterZone)
00944		{
00945			PlayAnim('SwimFire');
00946			SpawnShot();
00947			return;
00948		}
00949		if (AnimSequence == 'Shoot1')
00950			tweenin = 0.3 * FRand();
00951		else
00952			tweenin = 0.35;
00953		PlayAnim('Shoot1', 1.0, tweenin);
00954	}
00955	
00956	state TacticalMove
00957	{
00958	ignores SeePlayer, HearNoise;
00959	
00960		function TweenToRunning(float tweentime)
00961		{
00962			if ( bDicePlayer )
00963			{
00964				PeripheralVision = Default.PeripheralVision;
00965				bDicePlayer = false;
00966			}
00967			if (Region.Zone.bWaterZone)
00968			{
00969				TweenToSwimming(tweentime);
00970				return;
00971			}
00972			if ( bCanStrafe && (AnimSequence == 'Shoot2') && IsAnimating() )
00973				return;
00974			if ( (AnimSequence != 'Run') || !bAnimLoop )
00975				TweenAnim('Run', tweentime);
00976		}
00977	}
00978		
00979	
00980	defaultproperties
00981	{
00982	     StrikeDamage=20
00983	     ThrowDamage=30
00984	     PoundDamage=20
00985	     bSpearToss=True
00986	     Strike1=Sound'UnrealI.Krall.strike1k'
00987	     Strike2=Sound'UnrealI.Krall.strike1k'
00988	     Twirl=Sound'UnrealI.Krall.staflp4k'
00989	     syllable1=Sound'UnrealI.Krall.syl1kr'
00990	     syllable2=Sound'UnrealI.Krall.syl2kr'
00991	     syllable3=Sound'UnrealI.Krall.syl3kr'
00992	     syllable4=Sound'UnrealI.Krall.syl4kr'
00993	     syllable5=Sound'UnrealI.Krall.syl5kr'
00994	     syllable6=Sound'UnrealI.Krall.syl6kr'
00995	     Die2=Sound'UnrealI.Krall.death2k'
00996	     spearHit=Sound'UnrealI.Krall.hit2k'
00997	     spearThrow=Sound'UnrealI.Krall.throw1k'
00998	     MinDuckTime=8.000000
00999	     CarcassType=Class'UnrealI.KrallCarcass'
01000	     Aggressiveness=0.500000
01001	     RefireRate=0.500000
01002	     bHasRangedAttack=True
01003	     bMovingRangedAttack=True
01004	     bLeadTarget=False
01005	     RangedProjectile=Class'UnrealI.KraalBolt'
01006	     Acquire=Sound'UnrealI.Krall.chlng1k'
01007	     Fear=Sound'UnrealI.Krall.chlng2k'
01008	     Threaten=Sound'UnrealI.Krall.chlng2k'
01009	     MeleeRange=50.000000
01010	     GroundSpeed=240.000000
01011	     AirSpeed=240.000000
01012	     AccelRate=500.000000
01013	     JumpZ=360.000000
01014	     HearingThreshold=0.000000
01015	     Health=180
01016	     Intelligence=BRAINS_HUMAN
01017	     HitSound1=Sound'UnrealI.Krall.injur1k'
01018	     HitSound2=Sound'UnrealI.Krall.injur2k'
01019	     Die=Sound'UnrealI.Krall.death1k'
01020	     CombatStyle=0.800000
01021	     AmbientSound=Sound'UnrealI.Krall.amb1kr'
01022	     DrawType=DT_Mesh
01023	     Mesh=LodMesh'UnrealI.KrallM'
01024	     TransientSoundVolume=1.500000
01025	     CollisionRadius=25.000000
01026	     CollisionHeight=46.000000
01027	     Mass=140.000000
01028	     Buoyancy=140.000000
01029	     RotationRate=(Pitch=3072,Yaw=60000,Roll=0)
01030	}

End Source Code