Core.Object | +--Engine.Actor | +--Engine.Pawn | +--UnrealShare.ScriptedPawn | +--UnrealI.Gasbag
Gasbag
ParentBag
var()
byte
int
numChildren
void
Destroyed()
//----------------------------------------------------------------------------- // Gasbag functions.
Falling()
PlayDying(name DamageType, vector HitLocation)
PlayInAir()
PlayLanded(float impactVel)
PlayMeleeAttack()
PlayMovingAttack()
PlayPatrolStop()
PlayRangedAttack()
PlayRunning()
PlayTakeHit(float tweentime, vector HitLoc, int damage)
PlayThreatening()
PlayTurning()
PlayVictoryDance()
PlayWaiting()
PlayWaitingAmbush()
PlayWalking()
PoundDamageTarget()
PreSetMovement()
PunchDamageTarget()
SetMovementPhysics()
SpawnBelch()
TryToDuck(vector duckDir, bool bReversed)
TweenToFalling()
TweenToFighter(float tweentime)
TweenToPatrolStop(float tweentime)
TweenToRunning(float tweentime)
TweenToWaiting(float tweentime)
TweenToWalking(float tweentime)
EndState()
00001 //============================================================================= 00002 // Gasbag. 00003 //============================================================================= 00004 class Gasbag extends ScriptedPawn; 00005 00006 #exec MESH IMPORT MESH=GasBagM ANIVFILE=MODELS\GAS_A.3D DATAFILE=MODELS\DATA28.3D X=0 Y=0 Z=0 00007 #exec MESH ORIGIN MESH=GasBagM X=00 Y=150 Z=-100 YAW=64 00008 00009 #exec MESH SEQUENCE MESH=GasBagM SEQ=All STARTFRAME=0 NUMFRAMES=148 00010 #exec MESH SEQUENCE MESH=GasBagM SEQ=TwoPunch STARTFRAME=0 NUMFRAMES=13 RATE=15 Group=Attack 00011 #exec MESH SEQUENCE MESH=GasBagM SEQ=Belch STARTFRAME=13 NUMFRAMES=15 RATE=15 Group=MovingAttack 00012 #exec MESH SEQUENCE MESH=GasBagM SEQ=ThreatBelch STARTFRAME=13 NUMFRAMES=15 RATE=15 00013 #exec MESH SEQUENCE MESH=GasBagM SEQ=Deflate STARTFRAME=28 NUMFRAMES=16 RATE=15 00014 #exec MESH SEQUENCE MESH=GasBagM SEQ=TakeHit STARTFRAME=28 NUMFRAMES=1 00015 #exec MESH SEQUENCE MESH=GasBagM SEQ=Fiddle STARTFRAME=44 NUMFRAMES=15 RATE=15 00016 #exec MESH SEQUENCE MESH=GasBagM SEQ=Float STARTFRAME=59 NUMFRAMES=6 RATE=6 00017 #exec MESH SEQUENCE MESH=GasBagM SEQ=Grab STARTFRAME=65 NUMFRAMES=20 RATE=15 00018 #exec MESH SEQUENCE MESH=GasBagM SEQ=Pound STARTFRAME=85 NUMFRAMES=13 RATE=15 Group=Attack 00019 #exec MESH SEQUENCE MESH=GasBagM SEQ=T1 STARTFRAME=98 NUMFRAMES=5 00020 #exec MESH SEQUENCE MESH=GasBagM SEQ=T2 STARTFRAME=103 NUMFRAMES=9 00021 #exec MESH SEQUENCE MESH=GasBagM SEQ=T3 STARTFRAME=112 NUMFRAMES=4 00022 #exec MESH SEQUENCE MESH=GasBagM SEQ=T4 STARTFRAME=116 NUMFRAMES=4 00023 #exec MESH SEQUENCE MESH=GasBagM SEQ=Dead2 STARTFRAME=120 NUMFRAMES=13 RATE=15 00024 #exec MESH SEQUENCE MESH=GasBagM SEQ=Fighter STARTFRAME=65 NUMFRAMES=1 00025 #exec MESH SEQUENCE MESH=GasBagM SEQ=Hit2 STARTFRAME=120 NUMFRAMES=1 00026 00027 #exec TEXTURE IMPORT NAME=GasBag2 FILE=MODELS\gasbod.PCX GROUP="Skins" 00028 #exec TEXTURE IMPORT NAME=GasBag1 FILE=MODELS\gasarm.PCX GROUP="Skins" 00029 00030 #exec MESHMAP SCALE MESHMAP=GasBagM X=0.1 Y=0.1 Z=0.2 00031 #exec MESHMAP SETTEXTURE MESHMAP=GasBagM NUM=5 TEXTURE=GasBag1 00032 #exec MESHMAP SETTEXTURE MESHMAP=GasBagM NUM=6 TEXTURE=GasBag2 00033 00034 #exec MESH NOTIFY MESH=GasBagM SEQ=Belch TIME=0.5 FUNCTION=SpawnBelch 00035 #exec MESH NOTIFY MESH=GasBagM SEQ=TwoPunch TIME=0.35 FUNCTION=PunchDamageTarget 00036 #exec MESH NOTIFY MESH=GasBagM SEQ=TwoPunch TIME=0.7 FUNCTION=PunchDamageTarget 00037 #exec MESH NOTIFY MESH=GasBagM SEQ=Pound TIME=0.33 FUNCTION=PoundDamageTarget 00038 #exec MESH NOTIFY MESH=GasBagM SEQ=Deflate TIME=0.80 FUNCTION=LandThump 00039 00040 #exec AUDIO IMPORT FILE="Sounds\Gassius\2punch1a.WAV" NAME="twopunch1g" GROUP="Gasbag" 00041 #exec AUDIO IMPORT FILE="Sounds\Gassius\injur1a.WAV" NAME="injur1g" GROUP="Gasbag" 00042 #exec AUDIO IMPORT FILE="Sounds\Gassius\injur2a.WAV" NAME="injur2g" GROUP="Gasbag" 00043 #exec AUDIO IMPORT FILE="Sounds\Gassius\yell2a.WAV" NAME="yell2g" GROUP="Gasbag" 00044 #exec AUDIO IMPORT FILE="Sounds\Gassius\yell3a.WAV" NAME="yell3g" GROUP="Gasbag" 00045 #exec AUDIO IMPORT FILE="Sounds\Gassius\nearby1.WAV" NAME="nearby1g" GROUP="Gasbag" 00046 #exec AUDIO IMPORT FILE="Sounds\Gassius\death1a.WAV" NAME="death1g" GROUP="Gasbag" 00047 #exec AUDIO IMPORT FILE="Sounds\Gassius\hit1a.WAV" NAME="hit1g" GROUP="Gasbag" 00048 #exec AUDIO IMPORT FILE="Sounds\Gassius\amb2gb.WAV" NAME="amb2g" GROUP="Gasbag" 00049 00050 //----------------------------------------------------------------------------- 00051 // Gasbag variables. 00052 00053 // Attack damage. 00054 var() byte 00055 PunchDamage, // Basic damage done by each punch. 00056 PoundDamage; // Basic damage done by pound. 00057 00058 var(Sounds) sound Punch; 00059 var(Sounds) sound Pound; 00060 var(Sounds) sound PunchHit; 00061 var GasBag ParentBag; 00062 var int numChildren; 00063 00064 //----------------------------------------------------------------------------- 00065 // Gasbag functions. 00066 00067 function Destroyed() 00068 { 00069 if ( ParentBag != None ) 00070 ParentBag.numChildren--; 00071 Super.Destroyed(); 00072 } 00073 00074 function PreSetMovement() 00075 { 00076 bCanJump = true; 00077 bCanWalk = true; 00078 bCanSwim = false; 00079 bCanFly = true; 00080 bCanDuck = true; 00081 MinHitWall = -0.6; 00082 if (Intelligence > BRAINS_Reptile) 00083 bCanOpenDoors = true; 00084 if (Intelligence == BRAINS_Human) 00085 bCanDoSpecial = true; 00086 } 00087 00088 function TryToDuck(vector duckDir, bool bReversed) 00089 { 00090 local vector HitLocation, HitNormal, Extent; 00091 local actor HitActor; 00092 00093 //log("duck"); 00094 duckDir.Z = 0; 00095 if ( (Skill == 0) && (FRand() < 0.5) ) 00096 DuckDir *= -1; 00097 00098 Extent.X = CollisionRadius; 00099 Extent.Y = CollisionRadius; 00100 Extent.Z = CollisionHeight; 00101 HitActor = Trace(HitLocation, HitNormal, Location + 100 * duckDir, Location, false, Extent); 00102 if (HitActor != None) 00103 { 00104 duckDir *= -1; 00105 HitActor = Trace(HitLocation, HitNormal, Location + 100 * duckDir, Location, false, Extent); 00106 } 00107 if (HitActor != None) 00108 return; 00109 00110 //log("good duck"); 00111 Destination = Location + 150 * duckDir; 00112 Velocity = 400 * duckDir; 00113 AirSpeed *= 2.5; 00114 GotoState('TacticalMove', 'DoMove'); 00115 } 00116 00117 function SetMovementPhysics() 00118 { 00119 SetPhysics(PHYS_Flying); 00120 } 00121 00122 singular function Falling() 00123 { 00124 SetPhysics(PHYS_Flying); 00125 } 00126 00127 function PlayWaiting() 00128 { 00129 local float decision; 00130 local float animspeed; 00131 animspeed = 0.3 + 0.5 * FRand(); 00132 00133 decision = FRand(); 00134 if (!bool(NextAnim)) //pick first waiting animation 00135 NextAnim = 'Float'; 00136 00137 LoopAnim(NextAnim, animspeed); 00138 ////log("Next brute waiting anim is "$nextanim); 00139 if (NextAnim == 'Float') 00140 { 00141 if (decision < 0.15) 00142 NextAnim = 'Fiddle'; 00143 } 00144 else if (NextAnim == 'Fiddle') 00145 { 00146 if (decision < 0.5) 00147 NextAnim = 'Float'; 00148 else if (decision < 0.65) 00149 NextAnim = 'Grab'; 00150 } 00151 else 00152 NextAnim = 'Float'; 00153 } 00154 00155 function PlayPatrolStop() 00156 { 00157 PlayWaiting(); 00158 } 00159 00160 function PlayWaitingAmbush() 00161 { 00162 PlayWaiting(); 00163 } 00164 00165 function TweenToFighter(float tweentime) 00166 { 00167 TweenAnim('Fighter', tweentime); 00168 } 00169 00170 function TweenToRunning(float tweentime) 00171 { 00172 if ( (AnimSequence == 'Belch') && IsAnimating() ) 00173 return; 00174 if ( (AnimSequence != 'Float') || !bAnimLoop ) 00175 TweenAnim('Float', tweentime); 00176 } 00177 00178 function TweenToWalking(float tweentime) 00179 { 00180 if ( (AnimSequence != 'Float') || !bAnimLoop ) 00181 TweenAnim('Float', tweentime); 00182 } 00183 00184 function TweenToWaiting(float tweentime) 00185 { 00186 TweenAnim('Float', tweentime); 00187 } 00188 00189 function TweenToPatrolStop(float tweentime) 00190 { 00191 TweenAnim('Float', tweentime); 00192 } 00193 00194 function PlayRunning() 00195 { 00196 if ( AnimSequence == 'Belch' ) 00197 LoopAnim('Float', -1.0/AirSpeed, 0.5, 0.4); 00198 else 00199 LoopAnim('Float', -1.0/AirSpeed,, 0.4); 00200 } 00201 00202 function PlayWalking() 00203 { 00204 LoopAnim('Float', -1.0/AirSpeed,, 0.4); 00205 } 00206 00207 00208 function PlayThreatening() 00209 { 00210 local float decision; 00211 00212 decision = FRand(); 00213 00214 if ( decision < 0.7 ) 00215 PlayAnim('Float', 0.4, 0.4); 00216 else if ( decision < 0.8 ) 00217 PlayAnim('ThreatBelch', 0.4, 0.25); 00218 else 00219 { 00220 PlayThreateningSound(); 00221 TweenAnim('Fighter', 0.3); 00222 } 00223 } 00224 00225 function PlayTurning() 00226 { 00227 LoopAnim('Float'); 00228 } 00229 function PlayDying(name DamageType, vector HitLocation) 00230 { 00231 PlaySound(Die, SLOT_Talk, 4 * TransientSoundVolume); 00232 if ( FRand() < 0.5 ) 00233 PlayAnim('Deflate', 0.7, 0.1); 00234 else 00235 PlayAnim('Dead2', 0.7, 0.1); 00236 } 00237 00238 function PlayTakeHit(float tweentime, vector HitLoc, int damage) 00239 { 00240 if ( FRand() < 0.6 ) 00241 TweenAnim('TakeHit', tweentime); 00242 else 00243 TweenAnim('Hit2', 1.5 * tweentime); 00244 } 00245 00246 function TweenToFalling() 00247 { 00248 TweenAnim('Float', 0.2); 00249 } 00250 00251 function PlayInAir() 00252 { 00253 LoopAnim('Float'); 00254 } 00255 00256 function PlayLanded(float impactVel) 00257 { 00258 PlayAnim('Float'); 00259 } 00260 00261 00262 function PlayVictoryDance() 00263 { 00264 PlayAnim('Pound', 0.6, 0.1); 00265 PlaySound(PunchHit, SLOT_Interact); 00266 } 00267 00268 function PlayMeleeAttack() 00269 { 00270 local vector adjust; 00271 adjust = vect(0,0,0); 00272 adjust.Z = Target.CollisionHeight; 00273 Acceleration = AccelRate * Normal(Target.Location - Location + adjust); 00274 if (FRand() < 0.5) 00275 { 00276 PlaySound(Punch, SLOT_Interact); 00277 PlayAnim('TwoPunch'); 00278 } 00279 else 00280 { 00281 PlaySound(Pound, SLOT_Interact); 00282 PlayAnim('Pound'); 00283 }; 00284 } 00285 00286 function PlayRangedAttack() 00287 { 00288 local vector adjust; 00289 adjust = vect(0,0,0); 00290 adjust.Z = Target.CollisionHeight + 20; 00291 Acceleration = AccelRate * Normal(Target.Location - Location + adjust); 00292 PlayAnim('Belch'); 00293 } 00294 00295 function SpawnBelch() 00296 { 00297 spawn(RangedProjectile ,self,'',Location,AdjustAim(ProjectileSpeed, Location, 400, bLeadTarget, bWarnTarget)); 00298 } 00299 00300 function PunchDamageTarget() 00301 { 00302 if (MeleeDamageTarget(PunchDamage, (PunchDamage * 1300 * Normal(Target.Location - Location)))) 00303 PlaySound(PunchHit, SLOT_Interact); 00304 } 00305 00306 function PoundDamageTarget() 00307 { 00308 if (MeleeDamageTarget(PoundDamage, (PoundDamage * 800 * Normal(Target.Location - Location)))) 00309 PlaySound(PunchHit, SLOT_Interact); 00310 } 00311 00312 function PlayMovingAttack() 00313 { 00314 if ( AnimSequence == 'Float' ) 00315 PlayAnim('Belch', 1.0, 0.2); 00316 else 00317 PlayAnim('Belch'); 00318 } 00319 00320 State TacticalMove 00321 { 00322 ignores SeePlayer, HearNoise; 00323 00324 function EndState() 00325 { 00326 AirSpeed = Default.AirSpeed; 00327 Super.EndState(); 00328 } 00329 } 00330 00331 defaultproperties 00332 { 00333 PunchDamage=12 00334 PoundDamage=25 00335 Punch=Sound'UnrealI.Gasbag.twopunch1g' 00336 Pound=Sound'UnrealI.Gasbag.twopunch1g' 00337 PunchHit=Sound'UnrealI.Gasbag.hit1g' 00338 CarcassType=Class'UnrealI.GassiusCarcass' 00339 Aggressiveness=0.700000 00340 RefireRate=0.500000 00341 bHasRangedAttack=True 00342 bMovingRangedAttack=True 00343 RangedProjectile=Class'UnrealI.GasBagBelch' 00344 ProjectileSpeed=600.000000 00345 Acquire=Sound'UnrealI.Gasbag.yell2g' 00346 Fear=Sound'UnrealI.Gasbag.injur2g' 00347 Roam=Sound'UnrealI.Gasbag.nearby1g' 00348 Threaten=Sound'UnrealI.Gasbag.yell3g' 00349 bCanStrafe=True 00350 MeleeRange=50.000000 00351 AirSpeed=200.000000 00352 JumpZ=10.000000 00353 SightRadius=2000.000000 00354 FovAngle=120.000000 00355 Health=200 00356 HitSound1=Sound'UnrealI.Gasbag.injur1g' 00357 HitSound2=Sound'UnrealI.Gasbag.injur2g' 00358 Die=Sound'UnrealI.Gasbag.death1g' 00359 CombatStyle=0.400000 00360 AmbientSound=Sound'UnrealI.Gasbag.amb2g' 00361 DrawType=DT_Mesh 00362 Mesh=LodMesh'UnrealI.GasBagM' 00363 CollisionRadius=56.000000 00364 CollisionHeight=36.000000 00365 Mass=120.000000 00366 RotationRate=(Pitch=8192,Yaw=65000,Roll=2048) 00367 }