User:Crusha/UltimateMappingTools/UltimateVCTFFactory

From Unreal Wiki, The Unreal Engine Documentation Site

by Crusha K. Rool, thanks to iwanpompier for help at getting the radar to work.

UT2004 Object >> Actor >> SVehicleFactory >> UltimateVCTFFactory (custom)
Package:
UltimateMappingTools

Ultimate Factory for VCTF, giving the mapper more control over vehicle balancing and the functionality of the vehicle itself. Vehicles can be tracked as well, if an UltimateRadarMap Actor is placed in the map.

Properties

Property group 'Events'

PreSpawnEvent

Type: name

Event to trigger before spawn. Not activated when the vehicle was trigger-spawned.

Property group 'UltimateVCTFFactory'

bRandomFlip

Type: bool

Vehicle may be rotated by the AlternativeRotation.

AlternativeRotation

Type: int

If bRandomFlip, the Vehicle may spawn rotated by this value.

8192 = 45°; 16384 = 90°; 32768 = 180°; etc.. Negative values will rotate in the opposite direction.

bAutoTeam

Type: bool

Uses the TeamNum of the closest GameObjective.

bCrushable

Type: bool

Allow spawning over colliding actors.

bEnabled

Type: bool

Factory is triggered "on" at the beginning.

Default value: True

bTriggeredSpawn

Type: bool

If True, this factory will immediately spawn a vehicle when being triggered.

If False, triggering will enable the factory and untriggering will disable it.

bUniqueVehicle

Type: bool

Factory spawns only a limited number of vehicles, there will be no second one when they are destroyed. MaxVehicleCount determines the number of vehicles that can be spawned.

NotLockedForTeam

Type: byte

This will always lock the Vehicles for the TeamNum that is NOT entered here. 255 is normal, 0 will always lock this for Blue, 1 always for Red.

(Hack for Minigun turrets - it makes pretty much only sense to use this with them at the team's Core)

Default value: 255

PreSpawnTime

Type: float

Time before spawn to trigger PrepSpawn-Event and -Effect.

Default value: 2.0

RetrySpawnTime

Type: float

Interval to wait if spawn area is blocked.

Default value: 1.0

TeamNum

Type: byte

0= red, 1= blue, 255= neutral / none

TeamNums are switched automatically on Reset, if necessary. This is primarily used in combination with bIndependentFactory.

VehicleList

Type: array<SpawnedVehicleProperties>

List for random vehicle spawn.

VehicleSelectionType

Type: EVehicleSelectionType

Which method should be used to select the vehicle for spawning.

Internal variables

bInitiallyEnabled

Type: bool

Needed for Reset().

bPreSpawn

Type: bool

Neither the vehicle or build effect have been spawned yet

LastSpawned

Type: Vehicle

The last vehicle that has been spawned.

RandomArrayNumber

Type: int

For accessing the properties of the individual vehicle

SequentialArrayNumber

Type: int

Same, but in a sequential order.

URM

Type: UltimateRadarMap

The UltimateRadarMap Actor in the map. If none is there, no radar tracking is available.

Default values

Property Value
DrawType DT_Sprite

Enums

ESpawnSize

The size of the spawneffect particle ring around the vehicle to use.

SIZE_None
SIZE_Scorpion
SIZE_Manta
SIZE_Raptor
SIZE_Hellbender
SIZE_Goliath
SIZE_Leviathan

EVehicleSelectionType

Which method should be used to select the vehicle for spawning.

VST_Random
Random from list, equal chances for everyone.
VST_Probability
Use Probability values of the vehicle, so some vehicles are more likely than others.
VST_Sequential
Always select the next entry from the list when spawning a new vehicle.
VST_OnceRandom
Random as above, just that the choice will be used for the whole match.
VST_OnceProbability
Use Probablity as above, just that the choice will be used for the whole match.

Structs

SpawnedVehicleProperties

A load of customization and you need to do it for every entry in the list and for red and blue separately. But it pays out.

class<Vehicle> Vehicle
The vehicle that is spawned with this entry.
int Health
Give the spawned Vehicle a custom Health value. 0 will use the Vehicle's default.
float SpawnProbability
Used with bUseSpawnProbability. You can enter whatever you like, just the relative difference between the entries counts.
name VehicleSpawnedEvent
Tag to be triggered upon spawning of this particular vehicle (additionally to the one of the factory itself). The vehicle will be the instigator.
name VehicleDestroyedEvent
Tag to be triggered upon destruction of the vehicle. Vehicle must be a subclass of ONSVehicle for this to happen.
ESpawnSize SpawnEffectSize
The size of the spawneffect around the vehicle to use.
bool bCanCarryFlag
This vehicle can carry the flag.
bool bEjectDriver
Eject driver when vehicle gets destroyed instead of killing him.
bool bEnterringDoesNotUnlock
Vehicle is not unlocked when a player enters it.
float SpawnProtectionTime
The vehicle is shielded from any damage for this many seconds after spawn (spawn protection is lift immediately when a driver enters). 0 disables this, -1 means the vehicle is protected until someone enters it.
bool bChangeMaxDesireability
If True, use a custom MaxDesirability value to tell bots if they should use the vehicle or not.
float MaxDesireability
Default values are: Scorpion - 0.4; Hellbender - 0.5; Raptor, Cicada, Manta, SPMA, Paladin - 0.6; Goliath, Ion Tank - 0.8; Leviathan - 2.0. Go figure what matches your vehicle best.
bool bTrackVehicleOnRadar
The vehicle's location will be shown in realtime on the RadarMap.
bool bRadarVisibleToDriver
Should the vehicle be shown on the radar to it's driver? Only useful if you have a large delay between the updates and want to estimate where your team sees you on the radar.
bool bRadarNeutralWhenEmpty
If true, the vehicle is drawn with white team color when it's left.
bool bRadarHideWhenEmpty
If true, the vehicle is not drawn when it's empty.
UltimateRadarVehicleLRI.ERadarVehicleVisibility RadarVehicleVisibility
Here you set to which players the vehicle is shown on the RadarMap.
float RadarOwnerUpdateTime
How many seconds have to pass before the location of vehicle is updated for the owning team.
float RadarEnemyUpdateTime
Same as above, just for enemies.
bool bRadarFadeWithOwnerUpdateTime
If True, the icon on the radar map will interpolate between opaque and translucent as time passes between location updates on the radar.
bool bRadarFadeWithEnemyUpdateTime
If False, the icon will always stay fully opaque.
Material RadarTexture
The texture that represents the vehicle on the radar. It should have an alpha channel and be set to TC_Clamp. A bunch of vehicle textures for the radar are delivered in the texture package that comes with this toolset.
float RadarTextureScale
The image will be scaled by this factor.
int RadarTextureRotationOffset
The image will be rotated by this (in Rotation Units), in case your texture doesn't face the right way (up is the direction the vehicle is driving to).

Functions

Events

PostBeginPlay

event PostBeginPlay ()

Overrides: Actor.PostBeginPlay

Performs a check to notify the mapper if this actor is useless. References the UltimateRadarMap if it exists. Sets some inherited variables to the correct values, enables the factory if necessary and precaches all the vehicles in the array.

PostNetBeginPlay

event PostNetBeginPlay ()

Overrides: Actor.PostNetBeginPlay

Activates the factory, either according to the closest GameObjective or with a fixed team number.

Timer

event Timer ()

Overrides: Actor.Timer

The main function of this actor. It handles when to call which other function.

Trigger

event Trigger (Actor Other, Pawn EventInstigator)

Overrides: SVehicleFactory.Trigger

Either enable or spawn directly if bTriggeredSpawn.

UnTrigger

event UnTrigger (Actor Other, Pawn EventInstigator)

Overrides: Actor.UnTrigger

Disable if not bTriggeredSpawn.

VehicleDestroyed

event VehicleDestroyed (Vehicle V)

Overrides: SVehicleFactory.VehicleDestroyed

VehicleCount gets reduced (if wished) and the LinkedReplicationInfo for the radar is removed, if one for this vehicle existed.

Other instance functions

Activate

function Activate (byte T)

Activate the Factory.

ChooseVehicle

function ChooseVehicle ()

Sets the VehicleClass to a Vehicle from the currently valid array. The class can be chosen randomly or sequential. In any case is RandomArrayNumber the index of the chosen entry in the array, so that we can find the matching properties for this vehicle when it's spawned.

Reset

function Reset ()

Overrides: Actor.Reset

Adjust this actor if the sides are switched in ONS and deletes all remaining vehicles on the map.

SpawnBuildEffect

function SpawnBuildEffect ()

Spawns the BuildEffect emitter.

SpawnVehicle

function SpawnVehicle ()

Spawns the chosen VehicleClass and applies the properties from the matching entry in the array. The creation of a LinkedReplicationInfo for the radar is also handled here, if necessary.

If the ChooseVehicle function chose an entry with an empty vehicle class, then the Timer is set back to the length of a RespawnTime to try it again.

UpdatePrecacheMaterials

simulated function UpdatePrecacheMaterials ()

Overrides: Actor.UpdatePrecacheMaterials

Loads all vehicles in the arrays into cache to have fast access during the game.

VehicleArrayPrecache

simulated function VehicleArrayPrecache ()

Loads all vehicles in the arrays into cache to have fast access during the game.