Core.Object | +--Engine.Actor | +--Engine.Pawn | +--RuneI.ScriptPawn | +--RuneI.Manowar
float
PulseRadius
RefireDelay
RoamRadius
bool
poweringup
void
CheckForEnemies()
Died(Pawn Killer, name damageType, vector HitLocation)
Texture
PainSkin(int BodyPart)
PlayDeath(name DamageType)
//============================================================ // Animation functions //============================================================
PlayWaiting(optional float)
PostBeginPlay()
PreSetMovement()
Debug(Canvas canvas, int mode)
HurtWaterRadius(float DamageAmount, float DamageRadius, name DamageType, float Momentum, vector HitLocation)
Timer()
BeginState()
SeePlayer(Actor Seen)
PickDestination()
JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Mom, name DamageType, int joint)
00001 //============================================================================= 00002 // Manowar. 00003 //============================================================================= 00004 class Manowar expands ScriptPawn; 00005 00006 00007 /* Description: 00008 Drifts around, staying close to homebase. When an enemy encroaches on his MeleeRange, he 00009 electrifies the water. 00010 00011 */ 00012 00013 00014 var() float RoamRadius; // Distance allowed to travel from home 00015 var() float PulseRadius; // Radius for detection and pulse damage 00016 var() float RefireDelay; // Delay between firing 00017 var bool poweringup; 00018 00019 var(Sounds) Sound ChargeupSound; 00020 var(Sounds) Sound PulseSound; 00021 00022 00023 function PreSetMovement() 00024 { 00025 bCanJump = false; 00026 bCanWalk = false; 00027 bCanSwim = true; 00028 bCanFly = false; 00029 MinHitWall = -0.6; 00030 bCanOpenDoors = false; 00031 bCanDoSpecial = false; 00032 } 00033 00034 00035 function PostBeginPlay() 00036 { 00037 Super.PostBeginPlay(); 00038 00039 HomeBase = Location; // don't wander too far from home 00040 } 00041 00042 function CheckForEnemies() 00043 { 00044 } 00045 00046 function Texture PainSkin(int BodyPart) 00047 { 00048 return None; 00049 } 00050 00051 function Died(pawn Killer, name damageType, vector HitLocation) 00052 { // Force gib death 00053 Super.Died(Killer, 'gibbed', HitLocation); 00054 } 00055 00056 //============================================================ 00057 // Animation functions 00058 //============================================================ 00059 00060 function PlayDeath(name DamageType) { PlayAnim ('death', 1.0, 0.1); } 00061 00062 function PlayWaiting(optional float tween) 00063 { 00064 LoopAnim('swim', 1.0); 00065 } 00066 00067 00068 //============================================================ 00069 // States 00070 //============================================================ 00071 00072 auto State Swimming 00073 { 00074 ignores Bump, Touch, HearNoise; 00075 00076 function bool JointDamaged(int Damage, Pawn EventInstigator, vector HitLoc, vector Mom, name DamageType, int joint) 00077 { 00078 if (DamageType=='thrownweaponblunt'||DamageType=='thrownweaponsever'||DamageType=='thrownweaponbluntsever') 00079 GotoState('pulse'); 00080 00081 return Super.JointDamaged(Damage, EventInstigator, HitLoc, Mom, DamageType, joint); 00082 } 00083 00084 function PickDestination() 00085 { 00086 // Pick a destination near home 00087 Destination = HomeBase + VRand()*RoamRadius; 00088 Destination.Z = Location.Z; 00089 } 00090 00091 function SeePlayer(actor Seen) 00092 { 00093 Enemy = Pawn(Seen); 00094 00095 // Don't attack unless at surface 00096 if (HeadRegion.Zone.bWaterZone) 00097 return; 00098 00099 //TODO: Need to move this if he can attack non-players 00100 if((Enemy.Region.Zone.bWaterZone || Enemy.FootRegion.Zone.bWaterZone) 00101 && VSize(Enemy.Location-Location) < PulseRadius) 00102 { 00103 GotoState('pulse'); 00104 } 00105 } 00106 00107 function BeginState() 00108 { 00109 if (!Region.Zone.bWaterZone) 00110 SetPhysics(PHYS_FALLING); 00111 LoopAnim('swim', 1.0, 0.1); 00112 } 00113 00114 Begin: 00115 Move: 00116 // Drift until something threatening comes near 00117 PickDestination(); 00118 // Spawn(class'Ripple'); 00119 MoveTo(Destination); 00120 Goto('Move'); 00121 } 00122 00123 00124 State Pulse 00125 { 00126 ignores Bump, SeePlayer, Touch, HearNoise; 00127 00128 function Timer() 00129 { 00130 // Toggle texture of brain (or whole thing) 00131 if (SkelGroupSkins[1] == texture'manowarmowbright') 00132 SkelGroupSkins[1] = texture'manowarmowdim'; 00133 else 00134 SkelGroupSkins[1] = texture'manowarmowbright'; 00135 00136 00137 if (poweringup) 00138 { 00139 ScaleGlow+=0.1; 00140 } 00141 else 00142 { 00143 ScaleGlow-=0.2; 00144 } 00145 } 00146 00147 function HurtWaterRadius( float DamageAmount, float DamageRadius, name DamageType, float Momentum, vector HitLocation ) 00148 { 00149 local pawn Victim; 00150 local float damageScale, dist; 00151 local vector dir; 00152 00153 foreach VisibleCollidingActors( class 'Pawn', Victim, DamageRadius, HitLocation ) 00154 { 00155 if(Victim != self && Victim != Owner && 00156 ((Victim.Region.Zone.bWaterZone && Victim.Region.Zone == FootRegion.Zone) 00157 || (Victim.FootRegion.Zone.bWaterZone && Victim.FootRegion.Zone == FootRegion.Zone))) 00158 { 00159 dir = Victim.Location - HitLocation; 00160 dist = FMax(1,VSize(dir)); 00161 dir = dir/dist; 00162 damageScale = 1 - FMax(0,(dist - Victim.CollisionRadius)/DamageRadius); 00163 00164 Victim.JointDamaged(damageScale * DamageAmount, 00165 Instigator, 00166 Victim.Location - 0.5 * (Victim.CollisionHeight + Victim.CollisionRadius) * dir, 00167 (damageScale * Momentum * dir), 00168 DamageType, 00169 0); 00170 00171 Victim.AddVelocity(damageScale*Momentum*dir); 00172 } 00173 } 00174 } 00175 00176 Begin: 00177 Powerup: 00178 poweringup = true; 00179 PlaySound(ChargeupSound, SLOT_Interact,,,, 1.0 + FRand()*0.2-0.1); 00180 SetTimer(0.05, true); 00181 Sleep(2); 00182 SetTimer(0, false); 00183 Pulse: 00184 // Damage anything in the water within the damage radius 00185 Spawn(class'ManowarEffect',,, Location + vect(0, 0, 15)); 00186 Spawn(class'ManowarEffect',,, Location - vect(0, 0, 10)); 00187 PlaySound(PulseSound, SLOT_Interact,,,, 1.0 + FRand()*0.2-0.1); 00188 HurtWaterRadius(30, PulseRadius, 'stung', 1000, Location - vect(0, 0, 20)); // Guarantee to sting in the water 00189 00190 Powerdown: 00191 poweringup = false; 00192 SetTimer(0.05, true); 00193 Sleep(1); 00194 SetTimer(0, false); 00195 00196 SkelGroupSkins[1] = texture'manowarmowdim'; 00197 ScaleGlow = default.ScaleGlow; 00198 LoopAnim('Swim'); 00199 Sleep(RefireDelay); 00200 GotoState('Swimming'); 00201 } 00202 00203 00204 function Debug(Canvas canvas, int mode) 00205 { 00206 Super.Debug(canvas, mode); 00207 Canvas.DrawText("Manowar:"); 00208 Canvas.CurY -= 8; 00209 Canvas.DrawLine3D(HomeBase, Location, 255, 0, 0); 00210 } 00211 00212 defaultproperties 00213 { 00214 RoamRadius=100.000000 00215 PulseRadius=500.000000 00216 RefireDelay=3.000000 00217 bBurnable=False 00218 GroundSpeed=0.000000 00219 WaterSpeed=25.000000 00220 AccelRate=5.000000 00221 JumpZ=0.000000 00222 AirControl=0.000000 00223 ClassID=4 00224 PeripheralVision=-1.000000 00225 BaseEyeHeight=25.000000 00226 EyeHeight=25.000000 00227 Health=120 00228 Intelligence=BRAINS_REPTILE 00229 HitSound1=Sound'CreaturesSnd.Fish.fish01' 00230 HitSound2=Sound'CreaturesSnd.Fish.fish01' 00231 HitSound3=Sound'CreaturesSnd.Fish.fish01' 00232 Die=Sound'CreaturesSnd.Fish.fish08' 00233 Die2=Sound'CreaturesSnd.Fish.fish08' 00234 Die3=Sound'CreaturesSnd.Fish.fish08' 00235 LookDegPerSec=0.000000 00236 Style=STY_Translucent 00237 DrawScale=2.500000 00238 SoundRadius=30 00239 SoundVolume=190 00240 SoundPitch=77 00241 AmbientSound=Sound'CreaturesSnd.Dangler.danglerhum01L' 00242 TransientSoundRadius=800.000000 00243 CollisionRadius=32.000000 00244 CollisionHeight=36.000000 00245 Buoyancy=101.000000 00246 RotationRate=(Pitch=0,Yaw=5000,Roll=0) 00247 bNoSurfaceBob=True 00248 Skeletal=SkelModel'creatures.manowar' 00249 }