Core.Object | +--Engine.Actor | +--Engine.Pawn | +--RuneI.ScriptPawn | +--RuneI.Eel
bool
bCoiled
void
CheckForEnemies()
Texture
PainSkin(int BodyPart)
PlayAttack()
PlayDeath(name DamageType)
//============================================================ // Animation functions //============================================================
PlayWaiting(optional float)
PreSetMovement()
AttachRagnar()
ActorInRange(Actor A)
Bump(Actor Other)
EnemyNotVisible()
SeePlayer(Actor seen)
00001 //============================================================================= 00002 // Eel. 00003 //============================================================================= 00004 class Eel expands ScriptPawn; 00005 00006 00007 00008 /* Description: 00009 Found in underwater holes, they poke their heads out and watch for prey. They use the look joints 00010 to turn toward their current target and then spring out at them. After the first attack, the eel 00011 stays partially extended and attacks from there. When inactive for a while, can curl up and go 00012 back to idleA inside the hold. 00013 00014 TODO: 00015 Attack animations need to translate down bones following base_ bones 00016 */ 00017 00018 var bool bCoiled; // If eel is coiled up inside hole 00019 00020 00021 function PreSetMovement() 00022 { 00023 bCanJump = false; 00024 bCanWalk = false; 00025 bCanSwim = false; 00026 bCanFly = false; 00027 MinHitWall = -0.6; 00028 bCanOpenDoors = false; 00029 bCanDoSpecial = false; 00030 } 00031 00032 function CheckForEnemies() 00033 { 00034 } 00035 00036 function Texture PainSkin(int BodyPart) 00037 { 00038 } 00039 00040 //============================================================ 00041 // Animation functions 00042 //============================================================ 00043 00044 function PlayDeath(name DamageType) { PlayAnim ('death', 1.0, 0.1); } 00045 00046 function PlayWaiting(optional float tween) 00047 { 00048 if (bCoiled) 00049 LoopAnim('IdleA', 1.0, 0.1); 00050 else 00051 LoopAnim('IdleB', 1.0, 0.1); 00052 } 00053 00054 function PlayAttack() 00055 { 00056 if (bCoiled) 00057 PlayAnim('AttackA', 1.0, 0.1); 00058 else 00059 PlayAnim('AttackB', 1.0, 0.1); 00060 } 00061 00062 00063 //============================================================ 00064 // States 00065 //============================================================ 00066 00067 auto State GuardHole 00068 { 00069 function SeePlayer(actor seen) 00070 { 00071 LookTarget = seen; 00072 Enemy = Pawn(seen); 00073 } 00074 00075 function EnemyNotVisible() 00076 { 00077 bCoiled = true; 00078 LookTarget = None; 00079 00080 PlayWaiting(); 00081 } 00082 00083 function Bump(actor Other) 00084 { 00085 Enemy = pawn(Other); 00086 } 00087 00088 function bool ActorInRange(actor A) 00089 { 00090 local rotator angleToTarget; 00091 local vector ToTarget; 00092 local int yaw, pitch, yawangle, pitchangle; 00093 00094 if (Enemy==None) 00095 return false; 00096 00097 ToTarget = A.Location - Location; 00098 if (VSize(ToTarget) > MeleeRange) 00099 return false; 00100 00101 angleToTarget = (rotator(ToTarget) - Rotation); 00102 yaw = angleToTarget.Yaw; 00103 pitch = angleToTarget.Pitch; 00104 00105 if (yaw > 32768) 00106 yaw = yaw - 65535; 00107 if (yaw < -32768) 00108 yaw = yaw + 65535; 00109 if (pitch > 32768) 00110 pitch = pitch - 65535; 00111 if (pitch < -32768) 00112 pitch = pitch + 65535; 00113 00114 yawangle = MaxBodyAngle.Yaw + MaxHeadAngle.Yaw; 00115 pitchangle = MaxBodyAngle.Pitch + MaxHeadAngle.Pitch; 00116 00117 return ((yaw >= -yawangle) && (yaw <= yawangle) && 00118 (pitch >= -pitchangle) && (pitch <= pitchangle)); 00119 } 00120 00121 function AttachRagnar() 00122 { 00123 /* 00124 local actor a; 00125 00126 a = spawn(class'testdude'); 00127 if (a!=None) 00128 AttachActorToJoint(a, JointNamed('Jaw')); 00129 */ 00130 } 00131 00132 Begin: 00133 bCoiled = true; 00134 PlayWaiting(); 00135 00136 WaitUntilInRange: 00137 if (ActorInRange(Enemy)) 00138 { // Attack 00139 PlayAttack(); 00140 FinishAnim(); 00141 00142 // Uncoil 00143 bCoiled = false; 00144 LookTarget = Enemy; 00145 00146 // AttachRagnar(); 00147 00148 // LoopAnim('IdleA', 1.0, 0.5); 00149 PlayWaiting(); 00150 Sleep(RandRange(0.5*TimeBetweenAttacks, 1.5*TimeBetweenAttacks)); 00151 Goto('WaitUntilInRange'); 00152 } 00153 else 00154 { // Wait 00155 Sleep(0.2); 00156 Goto('WaitUntilInRange'); 00157 } 00158 } 00159 00160 00161 00162 00163 00164 simulated function Debug(Canvas canvas, int mode) 00165 { 00166 local vector ToEnemy, ToSide, Up; 00167 00168 Super.Debug(canvas, mode); 00169 00170 Canvas.DrawText("Eel:"); 00171 Canvas.CurY -= 8; 00172 Canvas.DrawText("bCoiled: "$bCoiled); 00173 Canvas.CurY -= 8; 00174 } 00175 00176 defaultproperties 00177 { 00178 bBurnable=False 00179 MeleeRange=200.000000 00180 ClassID=21 00181 HitSound1=Sound'CreaturesSnd.Fish.fish01' 00182 HitSound2=Sound'CreaturesSnd.Fish.fish01' 00183 HitSound3=Sound'CreaturesSnd.Fish.fish01' 00184 Die=Sound'CreaturesSnd.Fish.fish08' 00185 Die2=Sound'CreaturesSnd.Fish.fish08' 00186 Die3=Sound'CreaturesSnd.Fish.fish08' 00187 bCanLook=True 00188 MaxBodyAngle=(Pitch=8000,Yaw=14500) 00189 MaxHeadAngle=(Pitch=500,Yaw=500) 00190 LookDegPerSec=200.000000 00191 DrawScale=4.000000 00192 SoundRadius=20 00193 SoundVolume=157 00194 SoundPitch=42 00195 AmbientSound=Sound'CreaturesSnd.Fish.fish02L' 00196 TransientSoundRadius=800.000000 00197 CollisionRadius=11.000000 00198 CollisionHeight=13.000000 00199 Mass=400.000000 00200 Skeletal=SkelModel'creatures.eel' 00201 }