Lab 8B - Basic Weapons, Projectiles, Aiming

Summary

You will implement a basic weapon that shoots a projectile from the air and onto the ground. The projectile will fly towards the player from a pre set position.

Learning Outcomes

  • Ability to create weapons and projectiles
  • Ability to calculate flight paths such that an actor is targeted

Files to Implement

  • L8SpawnerBase.uc
  • L8Weapon.uc
  • L8Projectile.uc

Submission Requirements

Show your completed lab part B to your instructor(s) including the weapon being picked up from the barrel actor and firing causing the weapon to shoot a projectile at the player from the center high point of the map.

Instructions

L8Weapon

  • Create the class L8Weapon which inherits from UTWeapon
  • Give it the following properties:
    • Add an AnimNodeSequence component and give it a name. Give it the following properties:
      • bCauseActorAnimEnd should be set to true
    • Add a skeletal mesh component. Give it a name. Give it the following properties:
      • Component should display the skeletal mesh SkeletalMesh'WP_RocketLauncher.Mesh.SK_WP_RocketLauncher_1P'
      • Set the first AnimSets property entry to AnimSet'WP_RocketLauncher.Anims.K_WP_RocketLauncher_1P_Base'
      • Set the Animations property to the name of the AnimNodeSequence component created above
    • Set the Mesh property to the name of the skeletal mesh component created above
    • For fire mode 0, set the following:
      • Set the fire interval to 1
      • Set the weapon projectile class = class'L8Projectile'
      • Set the weapon fire type to projectile
      • Set the weapon fire animation to WeaponAltFireLaunch1End
      • Set the shot cost to 1
    • Set the weapon idle animation to WeaponIdle
    • Set the maximum ammo count to 100
    • Set the ammo count to 50
  • Override the function GetPhysicalFireStartLoc, returning a vector, and accepting an optional vector AimDir
    • Have this function return a location in the world that is 0 on the X and Y, and 500 on the Z
  • Override the function GetAdjustedAim, returning a rotator, and accepting a vector StartFireLoc
    • Have this function return a rotator that represents the direction from StartFireLoc to the player's character's current location

L8Projectile

  • Create the class L8Projectile which inherits from UTProjectile
  • Give it the following properties:
    • Add a static mesh component. Give it a name. Give it the following properties:
      • Component should display the static mesh StaticMesh=StaticMesh'LT_Light.SM.Mesh.S_LT_Light_SM_Light01'
    • Add this component to the component list

L8SpawnerBase

  • Update the class L8SpawnerBase from part 1 as follows:
    • In the Touch function:
      • If the contacted actor is a Pawn (which you checked for in part A), after incrementing the counter item and calling announce, do the following:
        • Check the pawn's inventory for existence of the class L8Weapon
          • If not found, have the pawn's inventory manager create an inventory of class L8Weapon