Hazel Whorley
2D Art / Level Design

me@hazelwhorley.com

tutorials

Moving Volume [UED 3]

By default, all Volumes in UnrealEd are static - this means they can't be moved in-game. Every volume has a hidden property bStatic, which you can't change through the properties window. This tutorial shows you how to make a few simple changes to create a moving volume. Please note: you can make .uc files with a plain text editor like notepad or WotGreal, but I'm using UnrealEd to create a new class and export .uc files in this tutorial because it's easier for non-coders.



Custom Volume Class

First we need to make a subclass of an existing volume and change the bStatic property to false.

  1. Open the actor browser and uncheck Placeable classes only
  2. Expand Brush > Volume in the list
  3. Find the volume (i.e PhysicsVolume) you want to change, right-click it and select New
  4. In the window that appears, enter myLevel as the package, and MovingPhysicsVolume (or whatever you want to call it) as the class name

A window like the one below should appear with some ready-written basic code.

//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume placeable;

We can't change the bStatic property through UnrealEd, so you need to export the script and edit it in a text editor.

  1. Click File > Export changed scripts in the script editor.
  2. Go and look in the UT2004 folder - you should see a folder called myLevel and inside it a folder called Classes which contains the script file with your code.
  3. Open the .uc file with a text editor such as notepad. It should look something like the code below:

//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume placeable; defaultproperties { }

Remove the line which says placeable; - we only want the volume to be added from the Volume button, not from the actor browser.

Now you can add the bStatic property:

//=========================================================================== // MovingPhysicsVolume. //=========================================================================== class MovingPhysicsVolume extends PhysicsVolume; defaultproperties { bStatic=false; }

Don't forget to close UnrealEd and save the .uc file.



Compiling and importing the custom class

Next you need to compile the package into a .u file so you can import it back into the map with the new properties. Since it's already called "myLevel", it should be automatically embedded in the map file when you import it.

  1. First go to the UT2004/System folder and open UT2004.ini (you might want to make a backup copy first)
  2. Search for the lines which say EditPackages=... and add EditPackages=myLevel at the end
  3. Save and close UT2004.ini
  4. Open the command prompt (Start > Run type "command" and press enter)
  5. Type ucc make mylevel at the command prompt and press enter
  6. If compiling was successful, you should get something like the window below and there will be a file in UT2004/System called myLevel.u. If you got errors or warnings, make sure you didn't misspell anything or miss out a semicolon
ucc compile

Open UnrealEd again and go to the actor browser.

To attach the new volume to a mover, set the Volumes Movement > Attach tag to the mover's Event > Tag. There is a bug where velocity and gravity on moving PhysicsVolumes (and WaterVolumes) will only take effect if the player is already touching it. To solve this, place the volume so the top is a few units above the floor the player is standing on so they are already touching the volume before it moves. Don't add too many moving volumes to a map, especially on constantly looping movers as it can cause a drop in fps and lag online.



I hope you found this tutorial easy to follow! If you're still stuck, take a look at this example map [movingvolume.zip]