Weapon_SO

INTRODUCTION

Weapon_SOs are at the heart of the FPS Engine's weapon systems. They define all the characteristics and stats for the different weapons in your project. A Weapon_SO is a scriptable object, which means you can create a unique one for each weapon by right-clicking in your Project folder, going to Create → COWSINS → New Weapon.

FPS Engine comes with various showcase weapons that have Weapon_SOs fully configured. You can find them under Cowsins/ScriptableObjects/Weapons.

Understanding the importance of Weapon_SOs is crucial for adding new weapons. If you're unsure how to add weapons in the FPS Engine, be sure to check out the following tutorial:

WEAPON_SO

BASIC

  • Name: You weapon´s name. Ex: Glock

  • WeaponObject: Attach your weapon prefab here. This weapon prefab will be instantiated on your screen when you equip this weapon.

  • Pick Up Graphics: Visuals that will appear on a dropped weapon.

  • Icon: Custom image of your weapon

When you assign an icon, it will be displayed in the inspector to ensure it is the appropriate one

SHOOTING

  • ShootStyle: Type of shooting.

    • Hitscan = This weapon fires and instantly hits its target at any range.

    • Projectile =Fires a physical bullet that travels through the world and can be affected by gravity

    • Melee: Close range weapons such as swords or knives.

  • ShootMethod: Defines how Input is processed to shoot.

    • Press

    • PressAndHold

    • HoldAndRelease

    • HoldUntilReady

  • FireRate: Time between each shot

  • BulletRange: How far the bullet is able to travel

  • BulletsPerFire: Bullets instantiated per each shot. Grants the possibility of making shotguns, burstguns etc.

    • TimeBetweenShots: Elapsed time until the next bullet spawns.

Keep TimeBetweenShots at 0 to make shotguns. Change its value to make burst weapons.

  • AmmoCostPerFire: How much ammo you lose per each fire ( & per each fire point )

  • ApplyBulletSpread:Apply spread per shot

    • SpreadAmount:How much spread is applied.

    • AimSpreadAmount:How much spread is applied while aiming.

  • ApplyRecoil:Apply recoil on shooting

    • RecoilX: Horizontal Recoil Animation Curve

  • RecoilY: Vertical Recoil Animation Curve

These two movements are mixed to create the pattern.

  • xRecoilAmount: Horizontal Recoil Distance

  • yRecoilAmount: Vertical Recoil Distance

  • RecoilRelaxSpeed: : When the user is not shooting, speed to go from the current recoil point to the origin point of the recoil.

  • ApplyDifferentRecoilOnAiming: Enable this to set different recoil amounts while aiming.

  • xRecoilAmountOnAiming: Distance of the recoil on the X axis while aiming.

  • yRecoilAmountOnAiming: Distance of the recoil on the Y axis while aiming.

  • PenetrationAmount: Amount of bullet penetration ( Wallbang )

  • PenetrationDamageReduction: Damage reduction multiplier. From 0 to 1 ( 0% to 100% )


PROJECTILE WEAPONS ONLY:

  • Projectile: Attach your projectile here. It must have a Bullet.cs script attached to it.

  • ProjectileUsesGravity: When enabled, your projectiles will use gravity and describe a parabola. It is important to set a rigidbody to the projectile attached above. You can easily adjust the parabola with the rigidbody and projectile speed settings

  • Speed: Speed of the instantiated projectile

  • ShootDelay: Time to wait for the bullet to be shot.

  • BulletDuration: Bullet Lifetime.

  • HurtsPlayer: When enabled, projectiles will also hurt the player. Generally used for explosive weapons.

  • ExplosionOnHit: When enabled, the projectile will cause an explosion on hit. Check new features unlocked under the “Visuals” tab.

    • ExplosionRadius: Area to deal damage and apply explosion forces to.

    • ExplosionForce: Force applied on nearby rigid bodies ( with the explosion radius ).

If explosionOnHit is true, new customization features unlocked under the "Visuals" Tab

MELEE WEAPONS ONLY:

  • AttackRange: How far you are able to land a hit

  • AttackRate: Attacking pace. TheTime to delay the melee hit lower, the faster.

  • HitDelay: Time to delay the melee hit

STATS

  • Infinite Bullets: If true, you will never run out of bullets. Bullets and Magazine UI won´t be displayed for infinite bullets weapons.

    • MagazineSize: Magazine capacity. Amount of bullets per magazine.

    • : If true, your weapon will have a certain amount of bullets, so you can run out of ammo.

      • TotalMagazines: Amount of initial magazines. Amount of initial bullets = magazineSize * TotalMagazines.

  • DamagePerBullet: Amount of damage dealt per each body shot.

  • CriticalDamageMultiplier: If a headshot is landed, base damage (DamageperBullet) will be multiplied by this.

  • ApplyDamageReductionBasedOnDistance: if true, damage will decrease or increase depending on how far you are from the target

    • MinimumDistanceToApplyDamageReduction: Damage reduction will be applied for distances larger than this

    • DamageReductionMultiplier: Adjust the damage reduction amount

  • ReloadStyle: The way the weapon reloads

    • DefaultReload

    • Overheat

  • ReloadTime: Time required to fully reload your weapon.

  • AllowAim: Enable this if you want the players to be able to aim the weapon. Check new options unders spread options.

    • AimDistance: Distance of the camera from the aim point

    • AimingRotation: : Rotation of the weapon while aiming.

    • AimingSpeed: Interpolation speed between states.

    • AimingFOV: Camera field of view while aiming.

    • AllowAimingIfReloading: Allows the player to aim even when reloading. False by default.

    • SetMovementSpeedWhileReloading: If true, you will be able to determine a velocity for your player while you are aiming.

      • MovementSpeedWhileAiming: Speed of the player while aiming.

  • ApplyWeight: If true, the weight of the weapon will affect the speed of the player.

    • WeightMultiplier: Being 1 the lightest, and 2 the heaviest.

VISUALS

  • useProceduralShot: Set this to true if you want to use a procedural shot instead of an animation.

    • proceduralShotPattern: Attach your procedural shot pattern here.

  • GrapplesFromTip: : if your player can use the grappling hook, enable this to draw the rope ( or grapple hook ) from the tip of your gun. This position will be the position of your first firePoint.

  • CamShakeAmount: Amount of camera shake per shot. Recommended = .15f

  • CamShakeCrouchMultiplier: Multiplier applied to the cam shake amount when crouching

  • CamShakeAimMultiplier: Multiplier applied to the cam shake amount when aiming.

  • ApplyFOVEffectOnShooting: If true it will apply a different FOV value when shooting to add an extra layer of detail. FOV will automatically lerp until it reaches its default value.

    • FOVValueToSubstract: : FOV Value to substract to the current fov value.

    • AimingFOVValueToSubstract: FOV Value to substract to the current fov value when aiming.

  • ShowBulletShells: If enabled, bullet shells will be instantiated on shooting.

    • BulletGraphics: Bullet shells 3D gameObject. This will be instantiated on shooting

  • BulletHoleImpact: Array of visual effects on bullets hitting objects. Attach each layer its own impact effect.

  • BulletTrail: Assign a Trail Renderer prefab that follows the bullet.

AUDIO

  • audioSFX: Array of AudioClips for each specified event, such as firing or reloading. Add your clips individually for each situation

  • pitchVariationFiringSFX: Per each shot, pitch will be modified by a number between - pitchVariationFiringSFX and +pitchVariationFiringSFX

UI

  • crosshairResize: Crosshair size when shooting.

  • crosshairPreset: Crosshair preset for the specific weapon


Weapon_SOEditor can be found within Weapon_SO.cs

Last updated