Using Vehicle Setting Override

Ok, this tutorial is perhaps a little late for many of you (a little late? You're not kidding!), but I thought I'd write up an online tutorial on how to get VSOverride working in a standard DM map. Not only that, but I'll also show you how to embed it in your map so you don't have to include the VSOverride.u file. Just please give me credit.. ;-)

Actually, I think I will cover how to embed it in your map first, since it's so much more convenient. Firstly, open your actor browser (you must have your map open) and go to File - New. When prompted for a package name, enter myLevel. When prompted for the actor's name, use something like VSOverride.

The code editor window should then open. Copy and paste the following code into the code window:

Class VSOverride extends Actor placeable;

var(VSOverride) bool bRespawnVehicles;
var(VSOverride) bool bNoTeamLock;

function PostBeginPlay()
{
SetTimer(1, true);
}

simulated function Timer()
{
local GameInfo I;
local Vehicle V;
local ONSVehicleFactory F;
local ASVehicleFactory P;

foreach DynamicActors(class'Engine.Gameinfo', I)
{
if (!I.bAllowVehicles)
I.bAllowVehicles = true;
}

if (bNoTeamLock)
{
foreach DynamicActors(class'Vehicle', V)
{
V.bTeamLocked = false;
V.Team = 255;
}
}

if (bRespawnVehicles)
{
foreach DynamicActors(class'ONSVehicleFactory', F)
{
F.SpawnVehicle();
}

foreach DynamicActors(class'ASVehicleFactory', P)
{
P.SpawnVehicle();
}
}
}

Then go to the compile menu and select Compile Changed. That's it. Your script should now be compiled. Select it in the actor browser and insert it into your map somewhere. Anywhere will be sufficient, as long as it exists.

If you're not using teams then set bNoTeamLock, but if you are then you can set it to false and specify the team in the vehicle factories. bRespawnVehicles... don't touch this. Not unless you really want vehicle after vehicle to spawn and bog down your map. It's there as an option, but I would advise you never to use it. If it is on false, leave it on false. If it's on true, for heaven's sake make it false!

Ok, final part! Do not use ONSVehicleFactory actors. Use ASVehicleFactory actors, since they do not require any ONS power nodes to spawn the vehicles. Under the defaultproperties menu there are two items that will be of most interest to you - bRespawnWhenDestroyed and Team. Hopefully these two variables are more than self-explanitory.

That's all. Have fun!

Return to homepage