UnrealScript Game Programming Cookbook

(Chris Devlin) #1

Crafting Pickups


106

/** Vehicle's skeletal mesh. What you actually see in the
game and editor */
Begin Object Name=SVehicleMesh
SkeletalMesh=SkeletalMesh'VH_Scorpion.Mesh.
SK_VH_Scorpion_001'
Translation=(X=0.0,Y=0.0,Z=-70.0)
End Object

/** Removes the sprite from the in game editor. We see
the actual skeletal mesh instead of a sprite */
Components.Remove(Sprite)

Begin Object Name=CollisionCylinder
CollisionHeight=+80.0
CollisionRadius=+120.0
Translation=(X=-45.0,Y=0.0,Z=-10.0)
End Object

/** Path to our custom made scorpion content, which can
now pickup items */
VehicleClassPath="Tutorial.Tut_Vehicle_Scorpion_Content"
/** Default scale for the object to appear in game */
DrawScale=1.2
}

This is almost identical to the scorpion used in UDK. The only changes I've made were
the comments and the VehicleClassPath variable. This now leads to the custom
scorpion content that we made at the beginning of this recipe, as it allows
our scorpion to use pickups.
Our vehicle now has the ability to gather pickups throughout a level. The problem
now however, is that UDK doesn't come with any vehicle pickups! So we must
create one ourselves.


  1. Now that we've made several pickups in the previous recipes, this part should be
    easy. We'll just be editing the functional part of the pickup, and leave the aesthetics
    as they are for now. For this, create a new class called Tut_VehicleHealth
    Pickup and have it extend from UTHealthPickupFactory as shown in the
    following code:
    class Tut_Vehicle_Health_Pickup extends
    UTHealthPickupFactory
    // Hides categories that we won't be needing from the archetype
    HideCategories(Object, Debug, Advanced, Mobile, Physics);
    In the default properties block, add the following code:
    Defaultproperties
    {
    /* The value at which an AI bot desires the pickup. Higher
    value = will lean towards this pickup
    /

Free download pdf