# SFCharacter.SFMite

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 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 |
    //=============================================================================
    // Spatial Fear
    // Class: SFMite
    // Description:  Small SF enemy. Does meele damage and has a limited ranged attack.
    //					An acid spit.Can be configured
    //					as blind, dump or without the sense of scent.
    //
    // Created by: Markus Nuebel
    //=============================================================================

    class SFMite expands SFScriptedPawn;

    #exec OBJ LOAD FILE=SPF-Content.uax  PACKAGE=SPF-Content GROUP=Creatures

    #exec MESH IMPORT MESH=SFMite ANIVFILE=MODELS\SFMite_a.3d DATAFILE=MODELS\SFMite_d.3d
    #exec MESH ORIGIN MESH=SFMite X=0 Y=0 Z=0 YAW=64 ROLL=0 PITCH=0

    #exec MESH SEQUENCE MESH=SFMite SEQ=All STARTFRAME=0 NUMFRAMES=99

    #exec MESH SEQUENCE MESH=SFMite SEQ=Breath STARTFRAME=100 NUMFRAMES=10 RATE=10
    #exec MESH SEQUENCE MESH=SFMite SEQ=Look STARTFRAME=44 NUMFRAMES=13 RATE=10 Group=Waiting
    #exec MESH SEQUENCE MESH=SFMite SEQ=Look2 STARTFRAME=110 NUMFRAMES=10 RATE=10

    #exec MESH SEQUENCE MESH=SFMite SEQ=Fighter STARTFRAME=0 NUMFRAMES=1

    #exec MESH SEQUENCE MESH=SFMite SEQ=Run STARTFRAME=34 NUMFRAMES=10 RATE=20
    #exec MESH SEQUENCE MESH=SFMite SEQ=Walk STARTFRAME=1 NUMFRAMES=10 RATE=10
    #exec MESH SEQUENCE MESH=SFMite SEQ=Turn STARTFRAME=1 NUMFRAMES=2 RATE=15 //2 frames of walklgfr

    #exec MESH SEQUENCE MESH=SFMite SEQ=AimDnLg STARTFRAME=28 NUMFRAMES=1 Group=Waiting
    #exec MESH SEQUENCE MESH=SFMite SEQ=AimUpLg STARTFRAME=51 NUMFRAMES=1 Group=Waiting

    #exec MESH SEQUENCE MESH=SFMite SEQ=HeadHit STARTFRAME=52 NUMFRAMES=1 Group=TakeHit
    #exec MESH SEQUENCE MESH=SFMite SEQ=GutHit STARTFRAME=39 NUMFRAMES=1 Group=TakeHit

    #exec MESH SEQUENCE MESH=SFMite SEQ=Jump STARTFRAME=57 NUMFRAMES=1 Group=Jumping
    #exec MESH SEQUENCE MESH=SFMite SEQ=Land STARTFRAME=58 NUMFRAMES=1 Group=Landing

    #exec MESH SEQUENCE MESH=SFMite SEQ=Dead1 STARTFRAME=69 NUMFRAMES=10 RATE=20 Group=TakeHit
    #exec MESH SEQUENCE MESH=SFMite SEQ=Dead2 STARTFRAME=59 NUMFRAMES=10 RATE=20
    #exec MESH SEQUENCE MESH=SFMite SEQ=Dead3 STARTFRAME=79 NUMFRAMES=20 RATE=20

    #exec MESH SEQUENCE MESH=SFMite SEQ=DeathEnd STARTFRAME=78 NUMFRAMES=1
    #exec MESH SEQUENCE MESH=SFMite SEQ=DeathEnd2 STARTFRAME=68 NUMFRAMES=1
    #exec MESH SEQUENCE MESH=SFMite SEQ=DeathEnd3 STARTFRAME=98 NUMFRAMES=1

    #exec MESH SEQUENCE MESH=SFMite SEQ=Roar STARTFRAME=11 NUMFRAMES=10 RATE=10
    #exec MESH SEQUENCE MESH=SFMite SEQ=Eat STARTFRAME=24 NUMFRAMES=10 RATE=10

    #exec MESH SEQUENCE MESH=SFMite SEQ=GutHit STARTFRAME=39 NUMFRAMES=1 Group=TakeHit
    #exec MESH SEQUENCE MESH=SFMite SEQ=LeftHit STARTFRAME=39 NUMFRAMES=1 Group=TakeHit
    #exec MESH SEQUENCE MESH=SFMite SEQ=RightHit STARTFRAME=39 NUMFRAMES=1 Group=TakeHit

    #exec MESHMAP NEW MESHMAP=SFMite MESH=SFMite
    #exec MESHMAP SCALE MESHMAP=SFMite X=0.025 Y=0.025 Z=0.05

    #exec TEXTURE IMPORT NAME=Mite1 FILE=Textures\Mite.pcx GROUP=Skins FLAGS=2 LODSET=0
    #exec TEXTURE IMPORT NAME=Mite1 FILE=Textures\Mite.pcx GROUP=Skins PALETTE=Mite1
    #exec MESHMAP SETTEXTURE MESHMAP=SFMite NUM=1 TEXTURE=Mite1

    //#exec AUDIO IMPORT FILE="Sounds\Mite\MiteAquisition.wav"	NAME=Aquisition PACKAGE=SFCharacter GROUP=Mite
    //#exec AUDIO IMPORT FILE="Sounds\Mite\MiteFear.wav"			NAME=Fear PACKAGE=SFCharacter GROUP=Mite
    //#exec AUDIO IMPORT FILE="Sounds\Mite\MiteRoaming.wav"		NAME=Roam PACKAGE=SFCharacter GROUP=Mite
    //#exec AUDIO IMPORT FILE="Sounds\Mite\MiteRoar.wav"			NAME=Roar PACKAGE=SFCharacter GROUP=Mite
    //#exec AUDIO IMPORT FILE="Sounds\Mite\MiteSpit.wav"			NAME=Spit PACKAGE=SFCharacter GROUP=Mite

    var (SpatialFear) Sound ChewSound; // Sound played during the eating animation

    var (SpatialFear) float sfSpeed;
    var (SpatialFear) float sfMass;

    var bool	m_bBumpedIntoNPC;	//
    var Actor	m_actBumpedNPC;
    var bool	m_bFireDelayed;
    var float	m_fFireDelay;
    var vector	m_vectMeleeMomentum;

    // Overwritten, to handle NPCDeco bump
    function Bump(actor Other)
    {
    	if(Other.IsA('SFNPCDeco'))
    	{
    		if( SFNPCDeco(Other).bSpawnPheromones)
    		{
    			m_bBumpedIntoNPC	= true;
    			m_actBumpedNPC		= Other;
    			GotoState('Waiting');
    		}
    		else
    			// Call to base clase
    			Super.Bump(Other);
    	}
    	else
    		// Call to base clase
    		Super.Bump(Other);
    }

    // Overwritten to increase the momentum, mite is a light enemy
    function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation,
    						Vector momentum, name damageType)
    {
    	// Call to base class
    	Super.TakeDamage(Damage, instigatedBy, hitlocation, momentum*1.5, damageType);
    }

    // Behaviour towards other creates. Modified for the mites purposes
    function eAttitude AttitudeToCreature(Pawn Other)
    {
    	local float	fDecision;

    	// Check the global attitude flag
    	if(!bFightOtherCreatures)
    		return ATTITUDE_IGNORE;

    	if ( Other.IsA('SFBabyMite') )
    	{
    		// Children like to play with each other
    		if(Self.IsA('SFBabyMite'))
    			if(FRand() < 0.05)
    				return ATTITUDE_Threaten;

    		// Do not hate children
    		return ATTITUDE_Friendly;
    	}
    	else if ( Other.IsA('SFMite') )
    	{
    		fDecision	= FRand();
    		if(Self.IsA('SFBabyMite'))
    		{
    			if(fDecision < 0.05)
    				return ATTITUDE_Threaten;
    			else
    				return ATTITUDE_Friendly;
    		}

    		if(fDecision < 0.05)
    			return ATTITUDE_Threaten;
    		else if (fDecision < 0.09)
    			return ATTITUDE_Follow;
    		else if (fDecision < 0.10)
    			return ATTITUDE_Hate;
    		else
    			return ATTITUDE_Friendly;
    	}
    	else
    		if(ScriptedPawn(Other).Aggressiveness > Aggressiveness)
    		{
    			if(FRand() < 0.1)
    				return ATTITUDE_Threaten;
    			else
    				return ATTITUDE_Ignore;
    		}
    		else
    		{
    			if(FRand() < 0.05)
    				return ATTITUDE_Threaten;
    			else
    				return ATTITUDE_Ignore;
    		}
    }

    function TweenToStunned(float tweentime)
    {
    	TweenAnim('Jump', tweentime);
    }

    function PlayStunned()
    {
    	PlayAnim('Jump');
    }

    function TweenToWaiting(float tweentime)
    {
    	TweenAnim('Eat', tweentime);
    }

    function PlayWaiting()
    {
    	local float decision;
    	local float animspeed;

    	animspeed = 0.4 + 0.6 * FRand();
    	decision = FRand();

    	if ( !bool(NextAnim) || (decision < 0.7) ) //pick first waiting animation
    	{
    		if(m_bBumpedIntoNPC)
    		{

    			if ( !bQuiet )
    				PlaySound(ChewSound, SLOT_Talk, 0.7,,800);

    			NextAnim = 'Eat';
    		}
    		else
    			NextAnim = 'Breath';
    	}
    	else if (decision < 0.8)
    		NextAnim = 'Look';
    	else if (decision < 0.9)
    		NextAnim = 'Look2';
    	else
    	{
    		if ( !bQuiet )
    			PlaySound(Threaten, SLOT_Talk, 0.7,,800);
    		NextAnim	= 'Roar';
    		animspeed	*= 1.3;
    	}

    	LoopAnim(NextAnim, animspeed, 0.4, 0.4);

    }

    function Tick(float fDelta)
    {
    	local vector projStart;
    	local Vector vecStart,X,Y,Z;

    	// Call to base class
    	Super.Tick(fDelta);

    	if(!m_bFireDelayed)
    		return;

    	// Count down
    	m_fFireDelay -= fDelta;

    	if(m_fFireDelay<0)
    	{
    		if(!IsInState('Dying'))
    		{
    			// Extract the axis from the rotation
    			GetAxes(Self.Rotation,X,Y,Z);

    			MakeNoise(1.0);
    			projStart = Location + CollisionHeight * vect(0,0,0.5) + CollisionRadius*0.25*X;
    			Projectile(spawn(RangedProjectile ,self,'',projStart,AdjustAim(ProjectileSpeed, projStart, 900, bLeadTarget, bWarnTarget)));
    		}

    		m_bFireDelayed = false;
    	}

    }
    function PlayRangedAttack()
    {
    	PlayAnim('Roar', 2.2, 0.2);
    	m_bFireDelayed = true;
    	m_fFireDelay	= Default.m_fFireDelay;
    }

    function PlayChallenge()
    {
    	if ( FRand() < 0.3 )
    		PlayWaiting();
    	else
    		PlayAnim('Roar', 1.3);
    }

    function TweenToFighter(float tweentime)
    {
    	TweenAnim('Fighter', tweentime);
    }

    function PlayDying(name DamageType, vector HitLocation)
    {
    	local carcass carc;

    	PlaySound(Die, SLOT_Talk, 3.5 * TransientSoundVolume);
    	if ( FRand() < 0.35 )
    		PlayAnim('Dead1', 1.5, 0.1);
    	else if ( FRand() < 0.5 )
    	{
    		PlayAnim('Dead2', 1.5, 0.1);
    	}
    	else
    	{
    		PlayAnim('Dead3', 1.5, 0.1);
    	}
    }

    function JumpOffPawn()
    {
    	Super.JumpOffPawn();
    	PlayAnim('walk', 1.0, 0.2);
    }

    function Jump()
    {
    	SetPhysics(PHYS_Falling);
    	PlayAnim('Jump');
    	Velocity = GroundSpeed * Vector(Rotation);
    	if ( JumpZ != 0 )
    		Velocity.Z = JumpZ;
    	else
    		Velocity.Z = FMax(100, JumpZ);
    	bJumpOffPawn = true;
    	SetFall();
    }

    function PlayMeleeAttack()
    {
    	local float dist, decision;

    	decision = FRand();
    	dist = VSize(Target.Location - Location);
    	if (dist > CollisionRadius + Target.CollisionRadius + 40)
    		decision = 0.0;

    	if (Physics == PHYS_Falling)
    		decision = 1.0;
    	if (Target == None)
    		decision = 1.0;

    	if (decision < 0.15)
    	{
    		// Jump at them
    		PlaySound(Threaten, SLOT_Interact);
    		Enable('Bump');
    		PlayAnim('Jump');
    		Velocity = 425 * Normal(Target.Location + Target.CollisionHeight * vect(0,0,0.75) - Location);
    		if (dist > CollisionRadius + Target.CollisionRadius + 35)
    			Velocity.Z += 0.7 * dist;
    		SetPhysics(PHYS_Falling);
    	}
      	else
      	{
    		// Bite them
    		PlaySound(Threaten, SLOT_Interact);
      		PlayAnim('Roar', 1.2);
    		MeleeRange = 28;
    		MeleeDamageTarget(fMeleeDamage, m_vectMeleeMomentum);
    		MeleeRange = Default.MeleeRange;
    	}
    }

    state Waiting
    {
    	function EndState()
    	{
    		m_bBumpedIntoNPC	= false;
    		m_actBumpedNPC		= None;

    		// Call to base class
    		Super.EndState();
    	}
    }
    //	Acquire=Sound'UnrealI.Pupae.hiss2pp'
    //	Fear=Sound'UnrealI.Pupae.hiss1pp'
    //	Roam=Sound'UnrealI.Pupae.roam1pp'
    //	Threaten=Sound'UnrealI.Pupae.hiss3pp'

    defaultproperties
    {
         ChewSound=Sound'UnrealI.Pupae.munch1p'
         m_fFireDelay=0.200000
         WalkSound=Sound'UnrealI.Pupae.scuttle1pp'
         WalkAnim=Walk
         RunSound=Sound'UnrealI.Pupae.scuttle1pp'
         RunAnim=Run
         ThreatenAnim=Roar
         TakeHitAnim=GutHit
         VictoryAnim=Roar
         SmellRadius=800.000000
         fMeleeDamage=6.000000
         fStunnedTime=6.000000
         CarcassType=Class'SFCharacter.SFMiteCarcass'
         TimeBetweenAttacks=1.250000
         Aggressiveness=1.000000
         RefireRate=0.200000
         bHasRangedAttack=True
         RangedProjectile=Class'SFCharacter.SFMiteProjectile'
         ProjectileSpeed=15.000000
         Acquire=Sound'SPF-Content.Creatures.MiteAquisition'
         Fear=Sound'SPF-Content.Creatures.MiteFear'
         Threaten=Sound'SPF-Content.Creatures.MiteRoar'
         MeleeRange=700.000000
         GroundSpeed=230.000000
         WaterSpeed=100.000000
         AirSpeed=300.000000
         AccelRate=150.000000
         JumpZ=340.000000
         Visibility=100
         SightRadius=1400.000000
         PeripheralVision=1.000000
         Health=80
         HitSound1=Sound'UnrealI.Pupae.injur1pp'
         HitSound2=Sound'UnrealI.Pupae.injur2pp'
         Die=Sound'UnrealI.Pupae.death1pp'
         CombatStyle=1.000000
         DrawType=DT_Mesh
         Mesh=LodMesh'SFCharacter.SFMite'
         ScaleGlow=0.150000
         MultiSkins(1)=Texture'SFCharacter.NewSkins.Mite1'
         CollisionRadius=24.000000
         CollisionHeight=16.000000
         Mass=80.000000
         RotationRate=(Pitch=3072,Yaw=65000,Roll=0)
    }

class file time: 12/7/2003 3:58:26 PM - creation time: 12/7/2003 4:03:45 PM
Created with UnCodeX