Game Development Reference
In-Depth Information
Allowing vehicles to use a pickup
By default, vehicles in UDK cannot make use of pickups. If you had a game that relied heavily
on vehicle use however, I'm sure you'd love to find a way to repair your vehicle's health, or
increase its dwindling ammunition reserves.
Getting ready
Vehicles in UDK cannot pickup items and add them to their inventory by default. The process
of allowing vehicles to make use of the pickup inventory is incredibly simple, and we'll start by
creating our own vehicle class, along with its content class.
Make the first class, Tut_Vehicle_Scorpion_Content , and have it extend from
UTVehicle_Scorpion_Content .
class Tut_Vehicle_Scorpion_Content extends UTVehicle_Scorpion_Content;
The only information in this class is found within the defaultproperties block, and should
read as follows:
defaultproperties
{
bCanPickupInventory=true
}
This is what allows our vehicle to use pickups. We use a vehicle's content class, because
that's where all of the data for the aesthetics, weapons, and attributes are held, while the
vehicle class generally holds the gameplay functions and mechanics for the vehicle.
Create another class, specifically for the vehicle, and call it Tut_Vehicle_Scorpion .
It should extend from UTVehicleFactory . Now let's begin.
How to do it...
This is perhaps the most daunting of our recipes so far. We'll have to create a few classes,
in addition to archetypes, and place them throughout the level for our use. This will include
creating a new vehicle class, as well as a content class for the vehicle, which is where it
inherits most of its default properties from, such as the aesthetics, sounds, and even part
of the physics behavior. Additionally, we'll be creating a pickup class that allows our vehicle
to drive over and acquire the pickup as explained in the following steps:
1.
In the defaultproperties block for Tut_Vehicle_Scorpion , add the
following code:
defaultproperties
{
 
Search Nedrilad ::




Custom Search