Mighty Gun Extras

Mighty Gun Extras

This package adds some extra functionality on top of the standard Gun package and doesn’t require any code modification.

Features:

  • Recoil
  • Scope
  • Limited ammo

Basic Setup

This is the key step that should be performed regardless of what features you want to add to your gun.

  1. Drag and drop “PlayerGunExtras” template into your Player template
  2. Drag and drop “GunExtras” template into your Gun template

Recoil Setup

  1. Drag and drop “PlayerGunRecoil” template into your Player template
  2. Drag and drop “GunRecoil” template into your Gun template
  3. Adjust recoil values in GunRecoil:
    The recoil is a Vector2D property where x is a max horizontal offset of the cursor (this offset will be randomized) and y is a vertical offset (this value is applied as it is).
    The ironSightRecoilMultiplier property allows you to specify the recoil multiplier that will be applied while iron sight is active (could be useful for recoil reduction).

Scope Setup

  1. Drag and drop “PlayerGunScope” template into your Player template
  2. Drag and drop “GunScope” template into your Gun template
  3. Adjust scope values:
    The breathMultiplier and the shakeMultiplier properties are allowing you to control the contribution of the player breath and handshaking on the scope movement.

Note:
To increase the zoom of the Scope you need to modify the “fov” property of the
ironSightItemScript is usually attached to the gun entity (the lower the fov value, the higher the zoom is).

LimitedAmmo

  1. Drag and drop “PlayerAmmoHolder” template into your Player template
  2. Open the “PlayerAmmoHolder” and drag and drop “PlayerAmmoProperties” inside
  3. Configure the “PlayerAmmoProperties”:
    The name property is used to identify the ammo (example: “6mm”, “.357MAG”, “Rocket”, “Potato”, “Dead cat”)
    The initialAmmo property defines the initial amount of ammo of that type players hold. When set to -1 player starts with the maximum allowed ammo.
    The maxAmmo property controls the maximum amount of ammo of that type players are allowed to hold. When set to -1 the ammo is infinite
    The icon property allows you to specify the URL of the icon that will be shown next to the ammo counter in the widget.
  4. Repeat steps 2 and 3 for each ammo type you want to have in your game
  5. Drag and Drop “GunAmmo” template into your Gun template
  6. Specify the appropriate ammo name within “GunAmmo” (It should match the previously defined ammo types)

Note:
The package also includes the “AmmoPickupExample” template. (You need to specify the ammo type and the amount of ammo it holds within it)
If you want to add ammo to the player through the code you could do it by calling: mge_PlayerAmmoHolderScript:AddAmmo(name, count)