Legacy:VitalOverdose/Short Scripts

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 16:14, 19 November 2007 by Sweavo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
UT2004 :: Actor>>Various Short scripts (Package: custom)

Overview

These scripts all contain only a few lines of modified code each. All the scripts listed here are part of the Vitals Pro Mapping Tool's MOD.

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>

This script can be downloaded in .u or .uc format:AmphibiousVolume.uc,Mylevel.u


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>

This script can be downloaded in .u or .uc format:NoTelleportMonsterController.uc,Mylevel.u


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>

This script can be downloaded in .u or .uc format:UntouchVolume.uc,mylevel.u.


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>

This script can be downloaded in .u or .uc format:VariZoomGunner.uc,mylevel.u.


Related

Vitals Pro Mapping Tool's

Discussion

MythOpus: Tarq, I tested out the Amphibious Volume myself and it works fine. The only problem might be there is no untouch function to restore the pawn to its defaults, but I'm not sure if thats even necessary. (I'm too lazy to go looking through the source.)