Legacy:VitalOverdose/Short Scripts

From Unreal Wiki, The Unreal Engine Documentation Site
UT2004 :: Actor>>Various Short scripts (Package: custom)

Overview

These scripts all contain only a few lines of modified code each.

AmphibiousVolume

Hardley any code is changed here just the time before the player start to drown is pushed up far higher than a game is likley to last.

<uscript> //----------------------------------------------------------- // AmphibiousVolume. Updated Oct2007 // By Vitaloverdose : http://www.Vitaloverdose.com // A water volume that wont drown players / bots . //-----------------------------------------------------------

class AmphibiousVolume extends WaterVolume Placeable;

struct UnderWaterTimeBacks { var Pawn PawnRef; Var float OldUnderWaterTime; Var float OldPawnDrawscale; }; var array<UnderWaterTimeBacks> UWTBacks;

Var() float PawnDrawscale; Var() float SafeSwimTime;

simulated event Touch(Actor Other) {

if ((Other.isa('pawn')) && (pawn(Other).UnderWaterTime < SafeSwimTime) && (CheckExistingSwimmerList(pawn(Other)) > -1))
    ProcessNewSwimmer(pawn(Other));
super.touch(Other);

}

simulated event UnTouch(Actor Other) {

local int  RecordNumber;
local Pawn ASwimmer;
if (Other.isa('pawn'))
   {
   ASwimmer     = Pawn(Other);
   RecordNumber = CheckExistingSwimmerList(ASwimmer);
   if ( RecordNumber == -1 )
        return;
   if ( SafeSwimTime > 0 )
        ASwimmer.UnderWaterTime = UWTBacks[RecordNumber].OldUnderWaterTime;
   }

super.Touch(Other); }

function int CheckExistingSwimmerList(Pawn ASwimmer) { local int Inc;

if (UWTBacks.Length < 1)

   return -1;

for (inc=0;inc<UWTBacks.Length;inc++)

    if (UWTBacks[inc].PawnRef == ASwimmer)
        return inc;

return -1; }

simulated function ProcessNewSwimmer(Pawn NewSwimmer) {

UWTBacks.Insert(0,1);
UWTBacks[0].PawnRef = NewSwimmer;
if ( SafeSwimTime > -1 )
   {
    UWTBacks[0].OldUnderWaterTime = NewSwimmer.UnderWaterTime;
    NewSwimmer.UnderWaterTime = SafeSwimTime;
   }
else
    UWTBacks[0].OldUnderWaterTime = -1;

}

defaultproperties { SafeSwimTime=10000 } </uscript>


No teleport monster controller

A monster controller that will stop the monsters from randomly teleporting around the level when they cant anything to fight.

<Uscript>

//-----------------------------------------------------------

// NoTelleportMonsterController by vitaloverdose

// To stop the monsters teleporting around the level when they

// dont have anyone to fight.

//-----------------------------------------------------------

class NoTelleportMonsterController extends MonsterController;

function FightEnemy( bool bCanCharge)

{

if ( (Enemy == None ) || (Pawn == None))

   log("HERE 3 Enemy "$Enemy$" pawn "$Pawn) ;

if ( (Enemy == FailedHuntEnemy) && (Level.TimeSeconds == FailedHuntTime))

  {
  if ( !Enemy.Controller.bIsPlayer )
       FindNewEnemy() ;
  if ( Enemy == FailedHuntEnemy )
     {
      GoalString = "FAILED HUNT - HANG OUT";
      if ( EnemyVisible())
           bCanCharge = false;
 else if ( (LastRespawnTime != Level.TimeSeconds) && ( (LastSeenTime == 0 ) || (Level.TimeSeconds - LastSeenTime) > 0 ) && !Pawn.PlayerCanSeeMe())
            LastRespawnTime = Level.TimeSeconds;
      if ( !EnemyVisible())
         {
          WanderOrCamp(true) ;
          return;
          }
      }
   }

} </Uscript>


PhysicsVolume with Untouch()

The untouch function is available higher up the class tree but not implemented in this class.

<uscript> //----------------------------------------------------------- // UntouchVolume .By Vitaloverdose. // physics volume with added Untouch event //----------------------------------------------------------- class UntouchVolume extends physicsvolume Placeable; var() name UntouchEvent; event untouch(Actor Other) { if (other.isa('pawn'))

  triggerEvent(UntouchEvent,Self,Instigator);
super.Untouch(other);

} </uscript>


VariZoomGunner

A stationary gunner with extended zoom options, designed for the excellent map ONS-Minus-ece By Biv.

<uscript>

//-----------------------------------------------------------

// VariZoomGunner. By Vitaloverdose.

// ONSManualGunPawn with mapper setable distance on the zoom.

//-----------------------------------------------------------

class VariZoomGunner extends ONSManualGunPawn;

var() float VariZoom; // this is the max range of the zoom

function AltFire(optional float F)

{

if (PlayerController(Controller) != None)

  {
   bWeaponIsAltFiring = true;
   PlayerController(Controller).ToggleZoomWithMax(VariZoom);
  }

Super.AltFire(F);

}

defaultproperties

{

VariZoom=0.900000

}

</Uscript>


Discussion