Weapon System API


1 BP_WeaponComponent_USG


1.1 Propeties


  • WeaponSlots: The weapon slots that decides how many weapons the owner actor can equip.

  • bDestroyWeaponWhenDead: Determine if destroy the weapon when owner actor dead.


1.2 Functions


  • StartAttack: General function to start weapon attack.

  • StopAttack: General function to stop weapon attack.

  • CreateAndEquipWeapon: Create and equip the weapon by class and output weapon instance.

  • EquipWeapon: Equip the input weapon.

  • UnEquipWeapon: Unequip the input weapon.

  • UnEquipCurrentWeapon: Unequip(holster) current in use weapon.

  • SwitchWeapon: Switch to the input weapon.

  • SwitchWeaponBySlot: Switch to the weapon in target slot.

  • SwitchToNextWeapon: Switch to the weapon in next slot.

  • DiscardWeapon: Discard the input weapon.

  • DiscardWeaponBySlotID: Discard the weapon in target slot.

  • DiscardAllWeapons: Discard all weapons in owner actor.

  • DestroyAllWeapons: Destroy all weapons in owner actor.

  • GetCurrentWeapon: Return current in use weapon.

  • GetCurrentWeaponSlot: Return slot id of current in use weapon.

  • GetWeaponInSlot: Return the weapon from target slot.

  • GetWeaponSlotID: Return slot id of given weapon.

  • GetWeaponData: Return replicated weapon data.


1.3 Events


  • OnWeaponsChanged: The event that will be called when the owning weapons changed.

  • OnAttackStart: The event that will be called while starting attack.

  • OnAttackEnd: The event that will be called when attack finished.


2 BP_WeaponBase_USG


2.1 Propeties


  • MaleLinkAnimClass: Linked amin class for male owner (default).

  • FemaleLinkAnimClass: Linked amin class for female owner.

  • BaseDamage: The basic damage value for this weapon.

  • DamageTypeClass: The damage type class for this weapon.

  • bIsPointDamage: If trigger point damage for this weapon.

  • EquipAttachInfo: The attachment info of owner actor for this weapon.

  • DefaultUnequipAttachInfo: Default attachment info when unequip this weapon.

  • UnequipAttachSlotInfo: If the owner actor has more than one slot for this weapon type, you should config attachment info for each one.

  • CrossHairConfig: Cross hair configuration for this weapon. We assume every weapon can have the cross hair, no just shooting weapon.


2.2 Functions


  • StartAttack: function called while starting weapon attack.

  • StopAttack: function called while stopping weapon attack.

  • OnEquipWeapon: function called while equipping weapon.

  • OnUnEquipWeapon: function called while unequipping weapon.

  • OnServerHit: Trigger damage and call the damage interface (TakeWeaponDamage in IF_WeaponDamage_USG).

  • CheckLegalDamage: Verify whether the damage is valid, if not, the damage event will not be triggered.

  • GetCrossHairOffset: Return crosshair offset for this weapon.

  • GetCrossHairMultiplier: Return crosshair size multiplier for this weapon.

  • GetWeaponID: Return weapon instance id.

  • IsEquipped: Return if the weapon equipped or not.


2.3 Events


  • OnDisuseWeapon: The event that will be called when the weapon disused or unequipped.

  • OnDiscardWeapon: The event that will be called when the discarded.


3 BP_ShootingWeapon_USG


3.1 Propeties


  • MuzzleSocketName: Muzzle socket name from the weapon skeletal.

  • BulletSpeed: The move speed of the bullet for this weapon.

  • BulletClass: The bullet class for this weapon.

  • BulletItemID: The item id of bullet, which will be use to find the appropriate bullet for this weapon from inventory.

  • IsPointDamage: If true, this weapon will cause point damage, otherwise, it will cause normal damage (which will notify the injured actor or pawn).

  • FireAudio: Fire audio asset.

  • DefaultFireMode: Default fire mode for this weapon

  • SupportedFireMode: Supported fire mode for this weapon (single, auto and burst mode).

  • MaxCanLoadedBullet: Max bullet number which can be loaded for this weapon.

  • PelletsPerShot: Pellet number for each shooting.

  • BurstFireInterval: Shooing interval for burst shooting mode.

  • BurstFireBullets: Bullet number for each shooting at burst mode.

  • AnimConfig: Animation config for this weapon, such as reload montage.

  • bAutoReload: If true, this weapon will try reload after bullets running out.


3.2 Functions


  • Fire_Single: Start a single shot.

  • Fire_Burst: Start fire with burst mode.

  • Fire_Auto: Start fire with auto mode.

  • GetShootingMode: Return current shooting mode.

  • GetBulletData: Return replicated bullet data.

  • SwitchNextShootMode: Switch to next shooting mode.

  • PlayFireSound: Play fire sound effect.

  • ShowFireEffect: Show fire particle effect.

  • TryReload: Try starting reload process.

  • GetMuzzleTranform: Return muzzle transform of this shooting weapon.

  • GetBulletNumToAdd: Return the bullet number needed in this moment.

  • SpawnBulletFromPool: Spawn new bullet instance or get it from pool.

  • GetFireLocation: Return the shooting direction, start and end location.


3.3 Events


  • OnBulletCountChanged: The event that will be called when the bullet changed.

  • OnShootingModeChanged: The event that will be called when the shooting mode changed.


4 BP_WeaponTrajectory_USG


4.1 Propeties


  • CameraShake: Camera shake for shooting.

  • RecoilIncrement: Recoil increment for each shot.

  • RecoilDecreaseSpeed: Recoil decrease speed for continuous shooting.

  • SpreadMultiplierMax: Max multiplication fator of spread.

  • SpreadMultiplierCrouching: Max multiplication fator of spread while crouching.

  • SpreadMultiplierADS: Max multiplication fator of spread while ADS.

  • SpreadMultiplierScope: Max multiplication fator of spread while Scoping.

  • SpreadPitchMax: Max pitch spread of one shooting.

  • RecoilToSpreadCurve: Curve corresponding the relationship between recoil and spread.

  • RecoilToPitchCurve: Curve corresponding the relationship between recoil and pitch.

  • SpeedToMultipilerCurve: Curve corresponding the relationship between speed and multiplier.


4.2 Functions


  • ApplySpread: Apply spread for input shooting direction.

  • ApplyCameraMovement: Apply camera movement for shooting.

  • TickSpreadData: Update spread data in the tick.

  • GetSpreadMultiplier: Return spread multiplier according owner character states.

  • ModifyYawPitchInput: Change yaw and pitch according to current spread.

  • GetSreenSpreadRadius: Return screen spread radius for cross hair.