Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel

User:Crusha/UltimateMappingTools/UltimateONSFactory

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

UltimateONSFactory

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

UT2004 Object >> Actor >> SVehicleFactory >> ONSVehicleFactory >> UltimateONSFactory (custom)

Contents

Package: 
UltimateMappingTools

An ONS-mapper's jack of all trades device. This allows the mapper to tweak the vehicle balance of the match right down to the last detail. Allows to specify an individual vehicle list for both teams from which the next vehicle can be chosen randomly or sequentially. Each individual vehicle entry in a list can be further modified, also with the ability to track the vehicle on the RadarMap.

Properties

Property group 'Events'

PreSpawnEvent

Type: name

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

Property group 'ONSVehicleFactory'

BlueTeamRotation

Type: int

If bReverseBlueTeamDirection, the Vehicle will not turn by 180 degrees but by this value.

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

Property group 'UltimateONSFactory'

bCrushable

Type: bool

Allow spawning over colliding actors.

bEnabled

Type: bool

Factory is triggered "on" at the beginning.

Default value: True

bIndependentFactory

Type: bool

PowerNode has no influence on the factory's activity or team number.

bRandomFlip

Type: bool

Neutral vehicles may face in BlueTeamRotation.

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.

bUseStaticTeams

Type: bool

Factory works only for one team.

NotLockedForTeam

Type: byte

This will always lock the Vehicles for the TeamNum that is NOT entered here. 255 is normal ONS, 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

StaticTeamNum

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.

VehicleListBlue

Type: array<SpawnedVehicleProperties>

List for random vehicle spawn if blue has the factory

VehicleListRed

Type: array<SpawnedVehicleProperties>

List for random vehicle spawn if red or neutral has the factory

VehicleSelectionType

Type: EVehicleSelectionType

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

Internal variables

bInitiallyEnabled

Type: bool

Needed for Reset().

RadarRI

Type: UltimateONSRadarHUDRI

Takes care of spawning the HUDOverlay on the client.

RandomArrayNumber

Type: int

For accessing the properties of the individual vehicle

SequentialArrayNumberRed

Type: int

Same, but in a sequential order.

SequentialArrayNumberBlue

Type: int

Need seperate ones for Red and Blue.

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 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 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: ONSVehicleFactory.PostBeginPlay

Performs a check to notify the mapper if this actor is useless. References the one and only VehicleLRIMaster in the map. If it doesn't exist yet, a new one is spawned. 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: ONSVehicleFactory.PostNetBeginPlay

Activates the factory, either according to the closest ONSPowerNode (uses super function) or with a fixed team number, making the factory effectively independent from a PowerNode.

SetInitialState

event SetInitialState ()

Overrides: Actor.SetInitialState

Remove this factory from the PowerCore's dynamic 'CloseActors'-array. By doing this, destroying the closest Node will no longer disable this factory. Executing at this point makes sure that the PostNetBeginPlay() of the PowerCore has been called already.

Timer

event Timer ()

Overrides: ONSVehicleFactory.Timer

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

Trigger

event Trigger (Actor Other, Pawn EventInstigator)

Overrides: ONSVehicleFactory.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: ONSVehicleFactory.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)

Overrides: ONSVehicleFactory.Activate

Activation depending on close Nodes.

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.

Deactivate

function Deactivate ()

Overrides: ONSVehicleFactory.Deactivate

Deactivation depending on close Nodes.

Reset

function Reset ()

Overrides: Actor.Reset

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

SidesAreSwitched

function bool SidesAreSwitched ()

Just to make the code more surveillable.

SpawnBuildEffect

function SpawnBuildEffect ()

Overrides: ONSVehicleFactory.SpawnBuildEffect

Spawns the BuildEffect emitter.

SpawnVehicle

function SpawnVehicle ()

Overrides: ONSVehicleFactory.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: ONSVehicleFactory.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.


UltimateONSRadarHUDRI

UT2004 Object >> Actor >> Info >> ReplicationInfo >> UltimateONSRadarHUDRI (custom)
Package: 
UltimateMappingTools


Creates the HUDOverlay for the Ultimate ONS radar map. For the vehicle stuff and so on.

Properties

bCreatedOverlay

Type: bool


bRadarMutatorEnabled

Type: bool

Disable radar functionality in that case.

Default values

Property Value
NetUpdateFrequency 1.0

Functions

Events

PostBeginPlay

event PostBeginPlay ()

Overrides: Actor.PostBeginPlay


Tick

simulated event Tick (float DeltaTime)

Overrides: Actor.Tick


Other instance functions

HasRadarMutator

function bool HasRadarMutator ()


HealDamage

function bool HealDamage (int Amount, Controller Healer, class<DamageTypeDamageType)

Overrides: Actor.HealDamage



UltimateRadarVehicleHUDOverlay

UT2004 Object >> Actor >> HudOverlay >> UltimateRadarVehicleHUDOverlay (custom)
Package: 
UltimateMappingTools

HUDOverlay for UltimateONSFactory

This Overlay displays the location of a Vehicle on the RadarMap in realtime.

Properties

ONSHUD

Type: ONSHUDOnslaught


OnsIconScale

Type: float


PCOwner

Type: PlayerController


RadarPosX

Type: float


RadarPosY

Type: float


RadarRange

Type: float


RadarScale

Type: float


RadarTrans

Type: float


VehicleLRIMaster

Type: UltimateRadarVehicleLRIMaster


Functions

Events

Tick

simulated event Tick (float DeltaTime)

Overrides: Actor.Tick


Other instance functions

bDrawRadar

simulated function bool bDrawRadar ()


DrawRadar

simulated function DrawRadar (Canvas C, float CenterRadarPosX, float CenterRadarPosY, float RadarWidth, Object.Vector MapCenter)


Render

simulated function Render (Canvas C)

Overrides: HudOverlay.Render