| Home Page | Recent Changes | Preferences

VitalOverdose/QuickVecSpawner

UT2004 :: Actor >> Trigger >> QuickVec

By VitalOverdose

This is a very simple and easy to use SINGLE spawn vehicle factory for use in all map types for UT2004.

I mainly use this actor myself for testing vehicle levels. If you want a vehicle factoty that can respawn the vehicles try AllMapVehicleFactory? .Its basically a subclassed trigger that will;-

  • spawn a Vehicle set by the mapper. The only other property that can be set is the spawn delay.
  • Also triggering this actor with another actor will spawn a vehicle.
  • Theres no default properties so it can be saved to mylevel and there wont be any additional .u files needed to make it work on any level you use it in.
//=============================================== 
// QuickVec By vitaloverdose, Feb 2006, http://www.Vitaloverdose.com
// This is part of the 'Vitals Pro Mapping Tools' Mod 
// Full class list http://wiki.beyondunreal.com/wiki/Vital's_Pro_Mapping_Tools
// Direct Download the Mod in zipped format Http://promappingtools.zapto.org
//=============================================== 

class QuickVec extends Triggers
placeable;

var() class<vehicle>                     spawnvec;           // Vehicle to Be spawned
var() float                              spawndelay;         // float variable for the spawn Delay

Function PostBeginPlay()
{
local Gameinfo FoundGameInfo;                                // blank variable of type 'Gameinfo' to store ref
foreach DynamicActors(Class'Engine.Gameinfo', FoundGameInfo) // iterates though all dynamic actors that are 'gameinfos'
        {                                                    // and stores a ref to them in  FoundGameInfo
         if (FoundGameInfo.bAllowVehicles == false)           //
             {
              FoundGameInfo.bAllowVehicles = True;           // Sets the value FoundGameInfo.bAllowVehicles to true
             }                                               // so can be all maps
         settimer(spawndelay,false);                         // activates timer to run 1 time in (spawndelay) seconds
             }
super.postbeginplay();                              // copys any function related code from parent class
}

Timer()

When the timer function is executed a vehicle is spawned at the location of the quickvec actor.writting location or rotation is really short for self.location and self.rotation and refferes to the poroteies of the QuickVec A velid ref vor the vehicle is stored in an empty variable of type vehicle called 'spawnvec'.Anything we do to the variable 'spawnedvec' will automatically get updated back to the vehicle that we spawned.

simulated function timer()
{
 local vehicle spawnedvec;                            // creates local variable of type vehicle
 spawnedvec=spawn(spawnvec,self,,location,rotation);  // spawn Vehicle & store ref in spawnedvec
 spawnedvec.Team=255;                                 // uses valid ref  in spawnedvec to set team to 255
}

Trigger()

Finally so that we can use the quickvec more thean once we overwrite the trigger function to set the timer going whenever we are triggered. This class is still basically a trigger that spawns a vehicle and still does all the other things a normal trigger would do.

event Trigger(Actor Other,Pawn EventInstigator)
{
 settimer(spawndelay,false);            // activates timer to run 1 time in (spawndelay) seconds
 super.Trigger(other,EventInstigator);  // copys any function related code from parent class
}

The complete script;-

//-----------------------------------------------------------
// QuickVec - Easy To use all Map Factory
// By VitalOverdose
//updated april 2006
//-----------------------------------------------------------

class QuickVec extends Triggers
placeable;

var() class<vehicle>                     spawnvec;           // Vehicle to Be spawned
var() float                              spawndelay;         // float variable for the spawn Delay

Function PostBeginPlay()
{
 local Gameinfo FoundGameInfo;                                // blank variable of type 'Gameinfo' to store ref
 foreach DynamicActors(Class'Engine.Gameinfo', FoundGameInfo) // iterates though all dynamic actors that are 'gameinfos'
        {                                                    // and stores a ref to them in  FoundGameInfo
         if (FoundGameInfo.bAllowVehicles == false)         
             FoundGameInfo.bAllowVehicles = True;           // Sets the value FoundGameInfo.bAllowVehicles to true
         settimer(spawndelay,false);                         // activates timer to run 1 time in (spawndelay) seconds
        }
super.postbeginplay();                       // copys any function related code from parent class
}

event Trigger(Actor Other,Pawn EventInstigator)
{
 settimer(spawndelay,false);                                // activates timer to run 1 time in (spawndelay) seconds
 super.Trigger(other,EventInstigator);                      // copys any function related code from parent class
}

simulated function timer()
{
 local vehicle spawnedvec;                           // creates local variable of type vehicle
 spawnedvec=spawn(spawnvec,self,,location,rotation); // spawn Vehicle & store Ref in spawnedvec
 spawnedvec.Team=255;                                // Uses spawnedvec to set team to 255
}

Download

Here is a link to the .UC for this script;-

[Download this Script]

Related Topics

Discusion

Unknown: Why is this a subclass of Trigger? Why not SVehicleFactory? This seems like a misleading tutorial if that's not explained.

Category Custom Class

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In