UMSPawn
Class UMSPawn

source: e:\games\UnrealTournament\UMSPawn\Classes\UMSPawn.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--UMS1_6.UMS
         |
         +--UMS1_6.UMSModule
            |
            +--UMSPawn.UMSPawn
Direct Known Subclasses:None

class UMSPawn
extends UMS1_6.UMSModule



Function Summary
 void ExecutePawnChangeAccel(MoviePawn TargetPawn)
 void ExecuteSetHeadSize(MoviePawn TargetPawn)



Source Code


00001	class UMSPawn expands UMSModule;
00002	
00003	function bool runCommand(string Script[20])
00004	{
00005	    switch(Script[0])    
00006	    {
00007	        case "Pawn":
00008	            return ExecutePawnAction(Script);
00009	            break;
00010	    }
00011	
00012		return false;
00013	}
00014	
00015	//*******************************************************************
00016	//Pawn Stuff
00017	//*******************************************************************
00018	
00019	function bool ExecutePawnAction(string Script[20])
00020	{
00021	    local MoviePawn TargetPawn;
00022	    
00023	    TargetPawn = MoviePawn(FindPawn(Script[1]));
00024	    
00025	    //When working on a project you will probably want more control
00026	    //over the pawns you are filming.  Therefore this is the code
00027	    //you are going to most likely have to modify.  Just add another
00028	    //case in here, another Execute function, and then add support
00029	    //for your new action in the pawn you plan to use it in, or in
00030	    //MoviePawn itself.
00031	
00032	    switch(Script[2])
00033	    {
00034	        case "Move":
00035	            ExecuteMove(TargetPawn, Script);
00036	        	return true;
00037	            break;
00038	        case "Rotate":
00039	            ExecuteRotate(TargetPawn, Script);
00040	        	return true;
00041	            break;
00042	        case "PlayAnim":
00043	            ExecutePlayAnim(TargetPawn, Script);
00044	        	return true;
00045	            break;
00046	        case "StopAnim":
00047	            ExecuteStopAnim(TargetPawn, Script);
00048	        	return true;
00049	            break;
00050	        case "SetWeapon":
00051	            ExecuteSetWeapon(TargetPawn, Script);
00052	        	return true;
00053	            break;
00054	        case "SetHead":
00055	            ExecuteSetHead(TargetPawn, Script);
00056	        	return true;
00057	            break;
00058	        case "Fire":
00059	            ExecuteFire(TargetPawn, Script);
00060	        	return true;
00061	            break;
00062	        case "AltFire":
00063	            ExecuteAltFire(TargetPawn, Script);
00064	        	return true;
00065	            break;
00066	        case "Circle":
00067	            ExecutePawnCircle(TargetPawn, Script);
00068	        	return true;
00069	            break;
00070	        case "Track":
00071	            ExecutePawnTrack(TargetPawn, Script);
00072	        	return true;
00073	            break;
00074	        case "SetSkin":
00075	            ExecuteSetSkin(TargetPawn, Script);
00076	        	return true;
00077	            break;
00078	        case "Interpolate":
00079	        	ExecutePawnInterpolate(TargetPawn, Script);
00080	        	return true;
00081	        	break;
00082	        case "Accelerate":
00083	        	ExecutePawnAccelerate(TargetPawn, Script);
00084	        	return true;
00085	        	break;
00086	        case "ChangeAcceleration":
00087	        	ExecutePawnChangeAccel(TargetPawn);
00088	        	return true;
00089	    }
00090	    
00091	    return false;
00092	}
00093	
00094	function ExecutePawnChangeAccel(MoviePawn TargetPawn)
00095	{
00096		local AccelerateMoviePawn TargetAccelPawn;
00097		local vector AccelVector;
00098		
00099		TargetAccelPawn = AccelerateMoviePawn(TargetPawn);
00100		log(self$": ExecutePawnChangeAccel() called");
00101		if(TargetAccelPawn == none)
00102		{
00103			log(self$": The pawn selected was not an accelerated pawn");
00104			return;
00105		}
00106		
00107		AccelVector = currentScriptVector;
00108		
00109		TargetAccelPawn.ChangeAccel(AccelVector);
00110	}
00111	
00112	function ExecutePawnAccelerate(MoviePawn TargetPawn, string Script[20])
00113	{
00114		local float Acceleration;
00115	    local actor TargetActor;
00116	    local vector TargetLocation;
00117	    local float Time;
00118	    
00119	    if (Script[3] == "")
00120	        TargetActor = NONE;
00121	    else
00122	        TargetActor = FindActor(Script[3]);
00123	    
00124	    //Check for no target.
00125	    if(TargetActor == NONE)
00126	        TargetLocation = currentScriptVector;
00127	    else
00128	        TargetLocation = TargetActor.Location;
00129	    
00130	    Time = currentScriptVal;
00131	    
00132	    Acceleration = 17;
00133	    
00134	    TargetPawn.DoAccelMove(TargetLocation, Time, Acceleration);
00135	}
00136	
00137	function ExecutePawnInterpolate(MoviePawn TargetPawn, string Script[20])
00138	{
00139	    local actor TargetActor;
00140	    local float NewRate, NewAlpha;
00141	
00142	    TargetActor = FindActor(Script[3]);
00143	    NewRate = currentScriptVal;
00144	    //As I've said before, we're just using the vector as a float.
00145	    //You'll want to set either X, Y, or Z to the value.
00146	    NewAlpha = VSize(currentScriptVector);
00147	    
00148	    TargetPawn.DoInterpolate(TargetActor, NewRate, NewAlpha);
00149	}
00150	
00151	function ExecuteMove(MoviePawn TargetPawn, string Script[20])
00152	{
00153	    local actor TargetActor;
00154	    local vector TargetLocation;
00155	    local float Time;
00156	    
00157	    if (Script[3] == "")
00158	        TargetActor = NONE;
00159	    else
00160	        TargetActor = FindActor(Script[3]);
00161	    
00162	    //Check for no target.
00163	    if(TargetActor == NONE)
00164	        TargetLocation = currentScriptVector;
00165	    else
00166	        TargetLocation = TargetActor.Location;
00167	    
00168	    Time = currentScriptVal;
00169	    
00170	    TargetPawn.DoMove(TargetLocation, TargetActor, Time);
00171	}
00172	
00173	function ExecuteRotate(MoviePawn TargetPawn, string Script[20])
00174	{
00175	    local actor RotTarget;
00176	    local vector TargetVector;
00177	    local rotator TargetRotation;
00178	    local float Time;
00179	    
00180	    //to something, or not to something, that is the question
00181	    if(Script[3] ~= "to")
00182	    {
00183	        //If no name after to, use the value in ScriptVectors
00184	        if(Script[4] == "")
00185	            RotTarget = NONE;
00186	        else
00187	            RotTarget = FindActor(Script[4]);
00188	        
00189	        if(RotTarget != NONE)
00190	            TargetVector = RotTarget.Location;
00191	        else
00192	            TargetVector = currentScriptVector;
00193	                    
00194	        TargetRotation = rotator(TargetVector - TargetPawn.Location);
00195	    }    
00196	    else
00197	        TargetRotation = TargetPawn.Rotation + currentScriptRotator;
00198	        
00199	    Time = currentScriptVal;
00200	    
00201	    TargetPawn.DoRotate(TargetRotation, RotTarget, Time);
00202	}
00203	
00204	function ExecutePlayAnim(MoviePawn TargetPawn, string Script[20])
00205	{
00206	    local float Time, TweenTime;
00207	    local name AnimSeq;
00208	    
00209	    Time = currentScriptVal;
00210	    AnimSeq = currentScriptName;
00211	    //Yes, it dosen't make much sense to use ScriptVectors, but it
00212	    //means one less array of variables.  Put the value you want in
00213	    //X, Y, or Z, but only one of them.
00214	    TweenTime = VSize(currentScriptVector);
00215	    
00216	    if(Script[3] ~= "Loop")
00217	        TargetPawn.DoLoopAnim(AnimSeq, Time, TweenTime);
00218	    else    
00219	        TargetPawn.DoPlayAnim(AnimSeq, Time, TweenTime);
00220	}
00221	
00222	function ExecuteStopAnim(MoviePawn TargetPawn, string Script[20])
00223	{
00224	    if(Script[3] ~= "Hard")
00225	        TargetPawn.DoHardStop();
00226	    else
00227	        TargetPawn.DoSoftStop();
00228	}
00229	
00230	function ExecuteSetWeapon(MoviePawn TargetPawn, string Script[20])
00231	{
00232	    local weapon NewWeapon;
00233	    local class<weapon> WeaponType;
00234	    local rotator WeaponRotation;
00235	
00236	    WeaponRotation = currentScriptRotator;
00237	
00238	    WeaponType = class<weapon>(DynamicLoadObject(Script[3], class'Class'));
00239	    TargetPawn.Weapon = spawn(WeaponType);
00240	    TargetPawn.Weapon.GiveTo(TargetPawn);
00241	    TargetPawn.Weapon.SetRotation(WeaponRotation);
00242	}
00243	
00244	function ExecuteSetHeadSize(MoviePawn TargetPawn)
00245	{
00246	    local float NewHeadSize;
00247	
00248	    NewHeadSize = currentScriptVal;
00249	    TargetPawn.Weapon.ThirdPersonScale = NewHeadSize;
00250	}
00251	
00252	function ExecuteSetHead(MoviePawn TargetPawn, string Script[20])
00253	{
00254		local weapon NewHead;
00255	    local class<weapon> HeadType;
00256	    local rotator HeadRotation;
00257	
00258	    HeadRotation = currentScriptRotator;
00259	
00260	    HeadType = class<MovieHead>(DynamicLoadObject(Script[3], class'Class'));
00261	    TargetPawn.Weapon = spawn(HeadType);
00262	    TargetPawn.Weapon.GiveTo(TargetPawn);
00263	    TargetPawn.Weapon.SetRotation(HeadRotation);
00264	
00265		
00266	}
00267	
00268	function ExecuteFire(MoviePawn TargetPawn, string Script[20])
00269	{
00270	    local vector Offset;
00271	    local actor TargetActor;
00272	    
00273	    TargetActor = FindActor(Script[3]);
00274	    Offset = currentScriptVector;
00275	    
00276	    TargetPawn.DoFire(TargetActor.Location, Offset);
00277	}
00278	
00279	function ExecuteAltFire(MoviePawn TargetPawn, string Script[20])
00280	{
00281	    local vector Offset;
00282	    local actor TargetActor;
00283	    
00284	    TargetActor = FindActor(Script[3]);
00285	    Offset = currentScriptVector;
00286	    
00287	    TargetPawn.DoAltFire(TargetActor.Location, Offset);
00288	}
00289	
00290	function ExecutePawnCircle(MoviePawn TargetPawn, string Script[20])
00291	{
00292	    local actor TargetActor;
00293	    local rotator Speed;
00294	    local vector Offset;
00295	    local float Distance;
00296	    
00297	    TargetActor = FindActor(Script[3]);
00298	    Speed = currentScriptRotator;
00299	    Offset = currentScriptVector;
00300	    Distance = currentScriptVal;
00301	    
00302	    TargetPawn.DoCircling(TargetActor, Speed, Offset, Distance);
00303	}
00304	
00305	function ExecutePawnTrack(MoviePawn TargetPawn, string Script[20])
00306	{
00307	    local actor TargetActor;
00308	    local vector Offset;
00309	    local rotator TrackDirections;
00310	    
00311	    TargetActor = FindActor(Script[3]);
00312	    Offset = currentScriptVector;
00313	    TrackDirections = currentScriptRotator;
00314	    
00315	    TargetPawn.DoTracking(TargetActor, Offset, TrackDirections);
00316	}
00317	
00318	function ExecuteSetSkin(Pawn TargetPawn, string Script[20])
00319	{
00320	    local string NewSkinName;
00321	    local int ElementNum;
00322	    
00323	    NewSkinName = Script[3];
00324	    
00325	    ElementNum = currentScriptVal;
00326	    
00327	    if(ElementNum >= 0 && ElementNum <= 7)
00328	        TargetPawn.SetSkinElement(TargetPawn, ElementNum, NewSkinName, "");
00329	    else
00330	        TargetPawn.Skin = Texture(DynamicLoadObject(NewSkinName, class'Texture'));
00331	}
00332	
00333	defaultproperties
00334	{
00335	}

End Source Code