SarkBall
Class SarkBallGoblin

source: c:\runehov\SarkBall\Classes\SarkBallGoblin.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Weapon
            |
            +--RuneI.NonStow
               |
               +--SarkBall.SarkBall
                  |
                  +--SarkBall.SarkBallScriptPawn
                     |
                     +--SarkBall.SarkBallGoblin
Direct Known Subclasses:None

class SarkBallGoblin
extends SarkBall.SarkBallScriptPawn

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 Actor CurrentPoint
 EGoblinHead GoblinHead
 EGoblinLimb GoblinLimb
 EGoblinTorso GoblinTorso
 bool bGoblinMask
 int breathcounter

States
Settling, Pickup, Throw

Function Summary
 void AttachMask()
     
//============================================================
//
// AttachMask
//
//============================================================
 void HitGoal(Actor Other)
 
simulated
HitWall(vector HitNormal, Actor HitWall)
 void PickUpSarkBall(Pawn Other)
 void PreBeginPlay()
     
//============================================================
//
// PreBeginPlay
//
//============================================================
 void SetGoblinSkins(EGoblinLimb arms, EGoblinTorso torso, EGoblinHead head)
     
//============================================================
//
// SetGoblinSkins
//
//============================================================
 void SetupGoblin()
     
//============================================================
//
// SetupGoblin
//
//============================================================
 void StartRound()


State Settling Function Summary
 void BeginState()


State Pickup Function Summary
 void BeginState()


State Throw Function Summary
 void BeginState()



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class SarkBallGoblin expands SarkBallScriptPawn;
00005	
00006	/* Description:
00007	
00008	   Walk speed = 54 @ 20Hx
00009	   Run speed = 260 @ 15Hz
00010	   
00011	   ANIMS:
00012	        HuntStop Animation (sniffing)
00013	        Threaten anim
00014	
00015	   TODO:
00016	*/
00017	
00018	var(Sounds) sound          RollSound;
00019	var(Sounds) sound          PaceSound;
00020	
00021	
00022	enum EGoblinLimb
00023	{
00024	     LIMB_RANDOM,
00025	     LIMB_RANDOMWARPAINT,
00026	     LIMB_NORMAL,
00027	     LIMB_WARPAINT1
00028	};
00029	
00030	enum EGoblinTorso
00031	{
00032	     TORSO_RANDOM,
00033	     TORSO_RANDOMWARPAINT,
00034	     TORSO_NORMAL,
00035	     TORSO_WARPAINT1,
00036	     TORSO_WARPAINT2,
00037	     TORSO_WARPAINT3
00038	};
00039	
00040	enum EGoblinHead
00041	{
00042	     HEAD_RANDOM,
00043	     HEAD_RANDOMWARPAINT,
00044	     HEAD_NORMAL,
00045	     HEAD_WARPAINT1,
00046	     HEAD_WARPAINT2,
00047	     HEAD_WARPAINT3
00048	};
00049	
00050	
00051	var() EGoblinLimb     GoblinLimb;
00052	var() EGoblinTorso     GoblinTorso;
00053	var() EGoblinHead     GoblinHead;
00054	var() bool               bGoblinMask;
00055	
00056	var Actor CurrentPoint;
00057	var private int breathcounter;
00058	
00059	Function StartRound(){
00060	    switch (int(RandRange(1,10))){
00061	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath01',Slot_None,5);
00062	        break;
00063	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath02',Slot_None,5);
00064	        break;
00065	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath03',Slot_None,5);
00066	        break;
00067	      case 4: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath05',Slot_None,5);
00068	        break;
00069	      case 5: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath06',Slot_None,5);
00070	        break;
00071	      case 6: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath07',Slot_None,5);
00072	        break;
00073	      case 7: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath11',Slot_None,5);
00074	        break;
00075	      case 8: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath12',Slot_None,5);
00076	        break;
00077	      case 9: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath13',Slot_None,5);
00078	        break;
00079	      case 10: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath15',Slot_None,5);
00080	        break;
00081	      }
00082	}
00083	
00084	
00085	Function HitGoal(Actor Other){
00086	
00087	  switch (int(RandRange(1,10))){
00088	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath01',Slot_None,5);
00089	        break;
00090	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath02',Slot_None,5);
00091	        break;
00092	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath03',Slot_None,5);
00093	        break;
00094	      case 4: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath05',Slot_None,5);
00095	        break;
00096	      case 5: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath06',Slot_None,5);
00097	        break;
00098	      case 6: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath07',Slot_None,5);
00099	        break;
00100	      case 7: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath11',Slot_None,5);
00101	        break;
00102	      case 8: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath12',Slot_None,5);
00103	        break;
00104	      case 9: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath13',Slot_None,5);
00105	        break;
00106	      case 10: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath15',Slot_None,5);
00107	        break;
00108	      }
00109	
00110	}
00111	
00112	
00113	Function PickUpSarkBall(Pawn Other){
00114	  switch (int(RandRange(1,13))){
00115	    case 1: PlaySound(Sound'CreaturesSnd.Goblin.attack01');
00116	    break;
00117	    //case 2: PlaySound(Sound'CreaturesSnd.Goblin.attack02');
00118	    //break;
00119	    case 3: PlaySound(Sound'CreaturesSnd.Goblin.attack05');
00120	    break;
00121	    case 4: PlaySound(Sound'CreaturesSnd.Goblin.attack06');
00122	    break;
00123	    case 5: PlaySound(Sound'CreaturesSnd.Goblin.attack08');
00124	    break;
00125	    case 6: PlaySound(Sound'CreaturesSnd.Goblin.attack12');
00126	    break;
00127	    case 7: PlaySound(Sound'CreaturesSnd.Goblin.attack17');
00128	    break;
00129	    case 8: PlaySound(Sound'CreaturesSnd.Goblin.attack18');
00130	    break;
00131	    case 9: PlaySound(Sound'CreaturesSnd.Goblin.attack21');
00132	    break;
00133	    case 10: PlaySound(Sound'CreaturesSnd.Goblin.attack25');
00134	    break;
00135	    case 11: PlaySound(Sound'CreaturesSnd.Goblin.attack26');
00136	    break;
00137	    //case 12: PlaySound(Sound'CreaturesSnd.Goblin.attack31');
00138	    //break;
00139	    //case 13: PlaySound(Sound'CreaturesSnd.Goblin.attack32');
00140	    //break;
00141	  }
00142	
00143	  Super.PickUpSarkBall(Other);
00144	}
00145	
00146	simulated function HitWall(vector HitNormal, actor HitWall){
00147	
00148	    switch (int(RandRange(1,8))){
00149	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb01');
00150	        break;
00151	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb02');
00152	        break;
00153	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb04');
00154	        break;
00155	      case 4: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb07');
00156	        break;
00157	      case 5: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb12');
00158	        break;
00159	      case 6: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb13');
00160	        break;
00161	      case 7: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb14');
00162	        break;
00163	      case 8: PlaySound(Sound'CreaturesSnd.Goblin.goblinamb16');
00164	        break;
00165	  }
00166	  Super.HitWall(HitNormal,HitWall);
00167	
00168	}
00169	
00170	
00171	
00172	//============================================================
00173	//
00174	// PreBeginPlay
00175	//
00176	//============================================================
00177	function PreBeginPlay()
00178	{
00179	     Super.PreBeginPlay();
00180	
00181	     SetupGoblin();
00182	}
00183	//============================================================
00184	//
00185	// SetupGoblin
00186	//
00187	//============================================================
00188	function SetupGoblin()
00189	{
00190	     local EGoblinLimb limbs;
00191	     local EGoblinTorso torso;
00192	     local EGoblinHead head;
00193	
00194	     limbs = GoblinLimb;
00195	     switch(GoblinLimb)
00196	     {
00197	          case LIMB_RANDOM:
00198	               switch(Rand(2))
00199	               {
00200	                    case 0:     limbs = LIMB_NORMAL;     break;
00201	                    case 1:     limbs = LIMB_WARPAINT1;     break;
00202	               }
00203	               break;
00204	          case LIMB_RANDOMWARPAINT:
00205	               limbs = LIMB_WARPAINT1;
00206	               break;
00207	     }
00208	
00209	     torso = GoblinTorso;
00210	     switch(GoblinTorso)
00211	     {
00212	          case TORSO_RANDOM:
00213	               switch(Rand(4))
00214	               {
00215	                    case 0:     torso = TORSO_NORMAL;          break;
00216	                    case 1:     torso = TORSO_WARPAINT1;     break;
00217	                    case 2:     torso = TORSO_WARPAINT2;     break;
00218	                    case 3:     torso = TORSO_WARPAINT3;     break;
00219	               }
00220	               break;
00221	          case TORSO_RANDOMWARPAINT:
00222	               switch(Rand(3))
00223	               {
00224	                    case 0:     torso = TORSO_WARPAINT1;     break;
00225	                    case 1:     torso = TORSO_WARPAINT2;     break;
00226	                    case 2:     torso = TORSO_WARPAINT3;     break;
00227	               }
00228	               break;
00229	     }
00230	     
00231	     head = GoblinHead;
00232	     switch(GoblinHead)
00233	     {
00234	          case HEAD_RANDOM:
00235	               switch(Rand(4))
00236	               {
00237	                    case 0:     head = HEAD_NORMAL;          break;
00238	                    case 1:     head = HEAD_WARPAINT1;     break;
00239	                    case 2:     head = HEAD_WARPAINT2;     break;
00240	                    case 3:     head = HEAD_WARPAINT3;     break;
00241	               }
00242	               break;
00243	          case HEAD_RANDOMWARPAINT:
00244	               switch(Rand(3))
00245	               {
00246	                    case 0:     head = HEAD_WARPAINT1;     break;
00247	                    case 1:     head = HEAD_WARPAINT2;     break;
00248	                    case 2:     head = HEAD_WARPAINT3;     break;
00249	               }
00250	               break;
00251	     }
00252	
00253	     SetGoblinSkins(limbs, torso, head);
00254	
00255	     if (bGoblinMask)
00256	          AttachMask();
00257	}
00258	
00259	//============================================================
00260	//
00261	// SetGoblinSkins
00262	//
00263	//============================================================
00264	function SetGoblinSkins(EGoblinLimb arms, EGoblinTorso torso, EGoblinHead head)
00265	{
00266	     switch(arms)
00267	     {
00268	          case LIMB_NORMAL:
00269	               break;
00270	          case LIMB_WARPAINT1:
00271	               SkelGroupSkins[2] = texture'runei.goblinpaintedarmleg';
00272	               SkelGroupSkins[12] = texture'runei.goblinpaintedarmleg';
00273	               SkelGroupSkins[8] = texture'runei.goblinpaintedarmleg';
00274	               SkelGroupSkins[11] = texture'runei.goblinpaintedarmleg';
00275	               break;
00276	     }
00277	     switch(torso)
00278	     {
00279	          case TORSO_NORMAL:
00280	               break;
00281	          case TORSO_WARPAINT1:
00282	               SkelGroupSkins[7] = texture'runei.goblinpaintedbody';
00283	               break;
00284	          case TORSO_WARPAINT2:
00285	               SkelGroupSkins[7] = texture'runei.goblinpaintedbody2';
00286	               break;
00287	          case TORSO_WARPAINT3:
00288	               SkelGroupSkins[7] = texture'runei.goblinpaintedbody3';
00289	               break;
00290	     }
00291	     switch(head)
00292	     {
00293	          case HEAD_NORMAL:
00294	               break;
00295	          case HEAD_WARPAINT1:
00296	               SkelGroupSkins[1] = texture'runei.goblinpaintedhead';
00297	               SkelGroupSkins[6] = texture'runei.goblinpaintedhead';
00298	               break;
00299	          case HEAD_WARPAINT2:
00300	               SkelGroupSkins[1] = texture'runei.goblinpaintedhead2';
00301	               SkelGroupSkins[6] = texture'runei.goblinpaintedhead2';
00302	               break;
00303	          case HEAD_WARPAINT3:
00304	               SkelGroupSkins[1] = texture'runei.goblinpaintedhead3';
00305	               SkelGroupSkins[6] = texture'runei.goblinpaintedhead3';
00306	               break;
00307	     }
00308	}
00309	
00310	
00311	//============================================================
00312	//
00313	// AttachMask
00314	//
00315	//============================================================
00316	function AttachMask()
00317	{
00318	     local actor mask;
00319	     mask = Spawn(class'GoblinMask',,, GetJointPos(JointNamed('head')),);
00320	     if (mask != None)
00321	     {
00322	          AttachActorToJoint(mask, JointNamed('head'));
00323	          mask.PlayAnim('on_face', 1.0, 0.1);
00324	     }
00325	     else slog("No spawn mask");
00326	}
00327	
00328	
00329	
00330	State Throw{
00331	  Function BeginState(){
00332	    Super.BeginState();
00333	    switch (int(RandRange(1,3))){
00334	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblinsee01');
00335	        break;
00336	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblinsee03');
00337	        break;
00338	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblinsee05');
00339	        break;
00340	    }
00341	    Super.BeginState();
00342	  }
00343	}
00344	
00345	auto state Pickup{
00346	
00347	  function BeginState(){
00348	    switch (int(RandRange(1,4))){
00349	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblinword01');
00350	        break;
00351	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblinword09');
00352	        break;
00353	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblinword11');
00354	        break;
00355	      case 4: PlaySound(Sound'CreaturesSnd.Goblin.goblinword12');
00356	        break;
00357	    }
00358	    Super.BeginState();
00359	  }
00360	}
00361	
00362	
00363	State Settling{
00364	
00365	  Function BeginState(){
00366	    switch (int(RandRange(1,10))){
00367	      case 1: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath01',Slot_None,3);
00368	        break;
00369	      case 2: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath02',Slot_None,3);
00370	        break;
00371	      case 3: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath03',Slot_None,3);
00372	        break;
00373	      case 4: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath05',Slot_None,3);
00374	        break;
00375	      case 5: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath06',Slot_None,3);
00376	        break;
00377	      case 6: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath07',Slot_None,3);
00378	        break;
00379	      case 7: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath11',Slot_None,3);
00380	        break;
00381	      case 8: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath12',Slot_None,3);
00382	        break;
00383	      case 9: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath13',Slot_None,3);
00384	        break;
00385	      case 10: PlaySound(Sound'CreaturesSnd.Goblin.goblindeath15',Slot_None,3);
00386	        break;
00387	      }
00388	    Super.BeginState();
00389	  }
00390	
00391	}
00392	
00393	defaultproperties
00394	{
00395	    DrawScale=0.70
00396	    CollisionHeight=12.00
00397	    Skeletal=SkelModel'creatures.Goblin'
00398	}

End Source Code