Always snap to grid

Legacy:MCloudZone

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
Actor >> Info (UT) >> ZoneInfo >> MCloudZone

Another old class. It's mixed CloudZone and VacuumZone. It'll destroy everything (except CTF flags) like cloud zone. If player enters this zone, he can be killed instantly or like in VacuumZone.

//==========================================================
// Cloud zone is a good thing, but it destroys all actors
// that enter this zone. That's why I've created this class :)
//==========================================================
// Basicly it kills all pawns instantly or like Vacuum Zone.
// Bot's are killed instantly.
//==========================================================
// CTF flag stays :)
// Projectiles are destroyed
//==========================================================
// author: Raven
// I use Vacuum Zone code.
//==========================================================
// If You want to use this script put me in Credits.
class MCloudZone extends ZoneInfo;
 
var int Damage;
var name DamageType;
var() bool bKillInstantly;        // Player should be killed instantly after entered this zone?
var() float  KillTime;	          // How long to kill the player?
var() float  StartFlashScale;     // Fog values for client death sequence
var() Vector StartFlashFog;
var() float  EndFlashScale;
var() Vector EndFlashFog;
var() float  DieFOV;		  // Field of view when dead (interpolates)
var() float  DieDrawScale;	  // Drawscale when dead
 
 
function BeginPlay()
{
	Super.BeginPlay();
	Disable('Tick');
	DieFOV = FClamp( DieFOV, 1, 170 );
}
 
 
event ActorEntered( actor Other )
{
 
        Super.ActorEntered(Other);
 
	if (Other.IsA('Pawn'))
        {
             if(Other.IsA('PlayerPawn'))
             {
                  Pawn(Other).PlaySound( Pawn(Other).Die, SLOT_Talk );
 
                  if(bKillInstantly)
                  {
	                Pawn(Other).TakeDamage(Damage, Pawn(Other),Pawn(Other).Location, Vect(0,0,0), DamageType);
	          }
	          else if(!bKillInstantly)
	          {
	                Enable('Tick');
	          }
	     }
             else
                  Pawn(Other).TakeDamage(Damage, Pawn(Other),Pawn(Other).Location, Vect(0,0,0), DamageType);
        }
	else if(Other.IsA('FlagBase'))
	{
             return;
        }
        else if(Other.IsA('CTFFlag'))
	{
             return;
        }
        else if(Other.IsA('RedFlag'))
	{
             return;
        }
        else
        {
             Other.Destroy();
        }
}
 
function Tick( float DeltaTime )
{
	local float  		ratio, curScale;
	local vector 		curFog;
	local PlayerPawn	pPawn;
	local Pawn P;
	local bool bActive;
	local int OldFatness;
 
	for ( P=Level.PawnList; P!=None; P=P.NextPawn )
	{
		// Ensure player hasn't been dispatched through other means already (suicide?)
		if( (P.Region.Zone == self) && (P.Health > 0) )
		{
			ratio = FMax(0.01,float(Max(P.Fatness,128) - P.Default.Fatness)/FMax(1,(255 - P.Default.Fatness)));
			ratio += DeltaTime/KillTime;
			bActive = true;
			// Fatness
			OldFatness = P.Fatness;
			P.Fatness = Max(P.Fatness,128) + Max(1, ratio * (255 - P.Default.Fatness) - (P.Fatness - P.Default.Fatness));
			if ( P.Fatness < Max(OldFatness,P.Default.Fatness) )
				P.Fatness = 255;
 
			// Fog & Field of view
			pPawn = PlayerPawn(P);
			if( pPawn != None )
			{
				curScale = (EndFlashScale-StartFlashScale)*ratio + StartFlashScale;
				curFog   = (EndFlashFog  -StartFlashFog  )*ratio + StartFlashFog;
				pPawn.ClientFlash( curScale, 1000 * curFog );
 
				pPawn.SetFOVAngle( (DieFOV-pPawn.default.FOVAngle)*ratio + pPawn.default.FOVAngle);
			}
			if ( P.Fatness > 250 )
			{	
				Level.Game.SpecialDamageString = DamageString;		
				P.TakeDamage
				(
					10000,
					P,
					P.Location,
					Vect(0,0,0),
					DamageType				
				);
				MakeNormal(P);
			}
		}
	}	
 
	if( !bActive )
		Disable('Tick');
}
 
function MakeNormal(Pawn P)
{
	local PlayerPawn PPawn;
	// set the fatness back to normal
	P.Fatness = P.Default.Fatness;
	P.DrawScale = P.Default.DrawScale;
	PPawn = PlayerPawn(P);
	if( PPawn != None )
		PPawn.SetFOVAngle( PPawn.Default.FOVAngle );
}
 
// When an actor leaves this zone.
event ActorLeaving( actor Other )
{
	if( Other.bIsPawn )
		MakeNormal(Pawn(Other));
	Super.ActorLeaving(Other);
}
 
defaultproperties
{
     Damage=999999
     DamageType='Fell'
     KillTime=2.500000
     StartFlashScale=1.000000
     EndFlashScale=1.000000
     DieFOV=90.000000
     DieDrawScale=1.000000
     DamageString="%o flayed away."
     bStatic=False
     bKillInstantly=false;
}

Category:Legacy Mapping
Category:Legacy Custom Class (UT) \\