Vous êtes sur la page 1sur 6

Vehicle Tutorial Mike Rowntree Part 1 Creating a Boat Script Framework

In this instance we will be making a custom version of the original Cicada code shipped with UDK.

Copy and rename the following to a custom class name, in the respective folders. UTVehicle_Cicada.uc - C:\UDK\UDK-2012-07\Development\Src\UTGame\Classes UTVehicle_Cicada_Content.uc - C:\UDK\UDK-2012-07\Development\Src\UTGameContent\Classes UTVehicleFactory_Cicada.uc - C:\UDK\UDK-2012-07\Development\Src\UTGameContent\Classes Copied and renamed to (for this walkthrough) UTVehicle_HoverTest.uc UTVehicle_HoverTest_Content.uc UTVehicleFactory_HoverTest.uc Now before we go and compile these new scripts by running UDK, instead we are going to edit them beforehand or we may (will) run into conflicts, confusion and all general mess

A good text-editor I recommend is Notepad++ found at http://notepad-plus-plus.org/

UTVehicleFactory_HoverTest.uc

While we build the framework, we are just going to set up all the initial custom class framework, save for creation and linking of the assets which will follow in Part 2 Within this file simply make the correct revisions to the class name on line (4) and vehicle class content path (21), changing Cicada for HoverTest. If you already have all your assets prepared, you can go ahead and make the modifications for that content within the code. This is where naming convention is very important, if only for the sake of having your objects in logical places when you need to go look for them. Example:
(9) SkeletalMesh=SkeletalMesh'VH_Cicada.Mesh.SK_VH_Cicada'

VH_Cicada

Mesh

SK_VH_Cicada

Package(UDK)

Group

Asset

We will revisit to change these parts of the framework later

UTVehicle_HoverTest_Content.uc

Moving swiftly forwards onto the

UTVehicle_HoverTest_Content.uc file, make the following corrections to only line (5) for this stage. Take the time to read through this script file as it details the majority of the content assets we are required to make in creating a vehicle script class that is totally independent of the original Cicada. Below is a screenshot detailing an example of just some of the many lines of code within this file we will be required to change in the later stage and using the knowledge of how this code interacts with the content you should be starting to see now how the vehicle classes actually operate.

UTVehicle_HoverTest.uc

Once again make the following revision on line (4) and then ensure all files are saved .uc. Now we will move as swiftly as possible through the content creation stage to actually then get to implementation and testing!

This file will become much more familiar in the later stage when we adjust the values within subsections such as defaultproperties and assign socket locations/names for effects, weapons fire, camera location etc. etc. Also since this paticular part of the vehicle class scripts extends the UTAirVehicle class, later it allows us to visit the UTAirVehicle class file and add paticular sections of reference code not used within the Cicada base from it that could aid our vehicle mechanic.

Compiling the new scripts: Lets go ahead and run UDKEditor to compile our new Vehicle Framework and hope it all works!

By making modifications to the files contained within UDKs directories the Editor will automatically wish to rebuild, click Yes and proceed.

Success 0 error(s), 0 warning(s) means our scripts do not cause any conflicts! Close the terminal and reopen UDK, this time it should start-up correctly and we can go ahead and open up the Actor Classes window via View > Browser Windows > Actor Classes in UDK:

Our Hover Test vehicle class is located here under the Vehicles subsection and adding it to a scene in UDK spawns the modified Cicada for us to fly around the game world with. In the scene below is it interacting with a FluidSurfaceActor which is to simply illustrate that it is fully working.

Coming up: Part 2 - Asset Creation This section details the creation and rigging of a skeletal mesh and quick creation of the various elements also needed such as speedy UV Mapping and Textures etc. as well a brief coverage of pre-emptive file organisation before we move into UDK in Part 3 Implementation

Vous aimerez peut-être aussi