I don't need to test my programs. I have an error-correcting modem.

Difference between revisions of "Legacy:VitalOverdose/ONSVehicleSpeedTrap"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m
Line 47: Line 47:
 
     ((bLessThan == false) && (VehicleVelocity > TestSpeed)))
 
     ((bLessThan == false) && (VehicleVelocity > TestSpeed)))
 
       Triggerevent(event,self,instigator);
 
       Triggerevent(event,self,instigator);
 +
 
Super.Touch(Other);  // all the code from the parent function of the same name is added in here
 
Super.Touch(Other);  // all the code from the parent function of the same name is added in here
 
}
 
}

Revision as of 04:12, 21 November 2007

UT2004 :: Actor >> Triggers >> ONSVehicleSpeedTrap (Package: custom)

by VitalOverdose

Overview

This custom class is a trigger that tests the speed of an ONSVehicle against a value set by the mapper in unrealed.

Method

The test against the value set can be greater than or lesser than. Its a boolean variable (true/false) and is set to greater than as a default and can set by the mapper in unrealed.

Once the condition has been me the ONSVehicleSpeedTrap will trigger itself, calling whatever is in its event field like any other trigger.

  • Can Test For > or < lower than the speed set by the mapper.
  • Triggers self when condition is met.

Note

Max speed for an RV is about 1000.

The script

//-----------------------------------------------------------
//ONSVehicleSpeedTrap : a trigger based actor that tests the speed of a vehicle.
//By VitalOverdose //http://WWW.VitalOverdose.com
//Updated Oct 2007
//-----------------------------------------------------------
class ONSVehicleSpeedTrap extends Triggers;
 
var () float  TestSpeed;
var () bool   bLessThan;
 
// Generic function : overwriting
function Touch(actor other)
{
 local float      VehicleVelocity;
 local ONSVehicle VehicleToTest;
 
 if (!other.isa('ONSVehicle'))
     return;
 
 VehicleToTest   = ONSVehicle(Other);
 VehicleVelocity = Vsize(VehicleToTest.Velocity);
 
 if (((bLessThan == true) && (VehicleVelocity < TestSpeed)) ||
    ((bLessThan == false) && (VehicleVelocity > TestSpeed)))
      Triggerevent(event,self,instigator);
 
Super.Touch(Other);   // all the code from the parent function of the same name is added in here
}

Easy to embed into a level

This script can be downloaded here : MyLevel.u or ONSVehicleSpeedTrap.uc

Related

Vehicle

ONSVehicle

ONSVehicleFXTagger

VitalOverdose/ONSVehicleBooster

QuickVecSpawner

BoostingVehicleFactory

Discussion