BP_LPSP_WEP

Introduction

The BP_LPSP_WEP blueprint is essential to the asset as it represents the weapon actor. It functions as a base class for all weapons, providing necessary functionality like ammunition management, fire rate, damage output, and reload animations. This blueprint ensures that weapon actors behave consistently and function properly for a seamless player experience. Furthermore, it allows for easy customization of each weapon, as changes made to the base class apply to all inherited weapons. This helps the asset be scalable and able to accommodate new weapons seamlessly.

If you seek to access the BP_LPSP_WEP, it is conveniently located at the following path: InfimaGames/LowPolyShooterPack/Core/Weapons/BP_LPSP_WEP.

Editable Variables

Debug Components:

This variable determines whether we should spawn the attachment components to check their placement and make sure that everything is correct.

Setting this variable to true is very helpful when ensuring that things are working properly, but it is not intended to remain set to true during gameplay at any point.

Row Handle Weapon Information:

Points to this Weapon’s Information. This Weapon Information is stored inside a Data Table called DT_LPSP_WEP_Info.

Row Handle Settings Ironsights:

This variable determines the settings to use for the iron sights of this weapon.

This row handle determines both the static mesh and gameplay settings for the iron sights.

Row Handle Settings Magazine:

Determines what settings to use for this Weapon’s Magazine.

This Row Handle determines both the Magazine’s Static Mesh, and its gameplay settings.

Weapon Preset Row Handle:

Determines what Weapon Preset we should use.

Weapon Preset Override:

Allows us to override parts, or the whole, of the Preset set.

Row Handle Settings Physical Weapon:

Determines the Weapon’s Physical Settings.

Row Handle Settings Physical Attachments:

Determines the Attachment’s Physical Settings. This value doesn’t affect the Weapon Body at all.

Socket Name Scope:

Name of the socket the Scope Attachment should be parented to.

Socket Name Grip:

Name of the socket the Grip Attachment should be parented to.

Socket Name Ironsights:

Name of the socket the Ironsight Attachment should be parented to.

Weapon Offset:

Offset inside a Character’s arms. Very helpful for adjusting custom Weapons.

Private Variables

Weapon Preset:

Contains the Weapon Preset’s value.

Weapon Information:

Contains the Weapon’s Information. A struct that has lots of the important values a Weapon needs.

Scope Mesh Row Handle:

Row Handle pointing to the selected Scope Static Mesh.

Scope Settings:

Cached Scope Settings.

Scope Settings Row Handle:

Row Handle pointing to the selected Scope Settings.

Laser Mesh Row Handle:

Row Handle pointing to the selected Laser Static Mesh.

Laser Settings:

Cached Laser Settings.

Laser Settings Row Handle:

Row Handle pointing to the selected Scope Settings.

Grip Mesh Row Handle:

Row Handle pointing to the selected Grip Static Mesh.

Grip Settings:

Cached Grip Settings.

Grip Settings Row Handle:

Row Handle pointing to the selected Grip Settings.

Magazine Settings:

Cached Magazine Settings.

Muzzle Settings:

Cached Muzzle Settings.

Muzzle Mesh Row Handle:

Row Handle pointing to the selected Muzzle Static Mesh.

Muzzle Settings Row Handle:

Row Handle pointing to the selected Muzzle Settings.

Weapon Settings:

Cached Weapon Settings.

Player Character Abilities:

Cached Player Character Abilities. These are normally stored in the Weapon Information, as a Row Handle.

Skin:

Cached Weapon Skin.

Skin Row Handle:

Handle to the Skin’s row.

Settings Animation:

Cached Animation Settings.

Settings Ironsights:

Cached Ironsight Settings.

Settings Lasersight:

Cached Lasersight Settings.

Settings Flashlight:

Cached Flashlight Settings.

Spread Multiplier:

Current spread multiplier.

Movement Spread:

Amount of spread applied while the Character that has this Weapon equipped is moving.

Dot Material Dynamic:

Laser Dot Material.

Aiming:

Determines if the Character that has this Weapon is aiming.

Slide Racked:

Determines if the Weapons’ slide is racked. This doesn’t necessarily mean that it is using the slide back pose, but it will copy that value over when picking or dropping it.

Slide Racked Visually:

Determines if the Weapons’ slide is racked. This doesn’t necessarily mean that it is using the slide back pose, but it will copy that value over when picking or dropping it.

Laser On:

Determines if the Weapons’ slide is racked. This doesn’t necessarily mean that it is using the slide back pose, but it will copy that value over when picking or dropping it.

Laser Turned On:

Determines if the Character with this Weapon equipped has set the Laser to be On.

Hidden Magazine:

Determines if the Weapon’s Magazine should be hidden. Used when we copy values from one Weapon to another to determine how it should look.

Hidden Magazine Visually:

Determines if the Weapon’s Magazine is not visible.

Can Be Picked Up:

Determines if the Weapon can be picked up. Usually true, but at some points we stop it from being picked up to avoid weird bugs.

Show Attachment Scope:

Determines if the Scope should currently be visible. This value is super important.

Show Attachment Ironsights:

Determines if the Muzzle should currently be visible. This value is super important.

Shot Count:

Number of continuous shots fired. Helpful for determining recoil and checking whether we need to spawn certain particle effects.

Calculation:

Number of Material Instance slots that should be visible on the Magazine.

Ammunition Current:

Current amount of ammunition.

Bolt State:

Bolt State.

Material Map Invisible:

Material Map of Materials to assign to Attachments when they should be hidden.

Materials Default Magazine:

The Magazine’s Materials when the game starts.

Components Attachments:

Array of Weapon Parts. These include all the Attachments. Very helpful when needing to do something to all of them.

Hit Result:

This represents the hit that results from the end line trace of the projectile.

Facing Rotation:

This value is the current rotation that the character who owns this weapon is facing, and it is used to fire the projectiles.

Scale:

This value represents the current scale of the weapon's attachments.

Equipped Scope:

This value contains a reference to the weapon’s equipped scope attachment.

Equipped Laser:

This value contains a reference to the weapon’s equipped laser attachment.

Previous Montage Name:

This variable contains the name of the previous montage that the weapon was playing. It is used to keep track of which montage to play if the player character owning this weapon changes from third-person to first-person. This ensures that we can play the same montage in its first-person variation.

Updating Animation For State:

If this variable is set to true, it means that the weapon is currently updating the animation it is playing due to a change in the character's viewpoint.

New Animation For State Position:

This variable represents the current position of the animation that is playing for the weapon at the time of the player character's view mode change. It's important to start playing the same animation in its different state mode from the same time to match them.

Is Player Controlled:

This variable is set to true when this weapon is being controlled by an actual player, as opposed to an AI. This is important so that we can adjust any parameters that need adjusting.

Fire Point Location:

This variable is set to the vector location from which the weapon needs to fire. It is simply a utility variable.

Equipped Muzzle:

This value contains a reference to the weapon’s equipped muzzle attachment.

Bodies Attached:

We use this variable to track all the components added to this blueprint that aren't meant to be included by default. This allows us to apply necessary physical settings and field-of-view adjustments to these components, resolving certain issues developers were encountering.

Functions

Try Update Attachment Ironsights:

Tries to change the weapon’s ironsights.

Try Update Attachment Magazine:

Tries to change the Weapon’s Magazine.

Try Update Attachment Scope:

Tries to change the Weapon’s Scope.

Try Update Attachment Laser:

Tries to change the Weapon’s Laser.

Try Update Attachment Muzzle:

Tries to change the Weapon’s Muzzle.

Try Update Attachment Grip:

Tries to change the Weapon’s Grip.

Update Skin:

Sets the weapon's skin from a different preset. This is very helpful when you want to completely change how the weapon looks in-game.

Update Materials From Skin:

This function updates all the materials of the weapon to match the currently selected skin. Additionally, it ensures that any attachments that should not be visible are hidden.

Update Ammunition Current:

Update the current ammunition and ensure that everything related to it is also updated.

Try Update Ammunition Visual:

This update improves the visual representation of ammunition. Specifically, it makes the casing materials on the magazine visible or invisible depending on how many bullets remain in the magazine. This feature is especially useful for weapons with transparent magazines.

Get Ironsights Scope Settings:

Returns the value of Scope Settings.

Scope Render Target Enable:

Enables the Scope’s Render Target component.

Scope Render Target Disable:

Disables the Scope’s Render Target component.

Update Lasersight Properties:

Changes the equipped laser’s properties.

Update Socket Attachments:

Updating the attachment's attachment may sound odd, but this function ensures that certain attachments are properly parented to a socket on the weapon.

Make Map From Arrays:

Returns a map of materials given an array of materials and an array of names. Basically, it's just a utility function.

Weapon Drop:

The function changes the weapon from a "view model" to a "physics body.”

Try Hide Magazine:

This function updates the physical settings of the magazine attachment to match whatever "Hide" value we pass it. Essentially, it simply hides the magazine when necessary.

Randomize Preset:

Calling this function will randomize the preset that the weapon is currently using and automatically adjust everything to make it look nice.

Equip Skin From Random Preset:

Calling this function changes the skin of this weapon to a completely different one. The new skin will be one of the skins assigned to the presets that this weapon can use.

Equip Random Scope:

Calling this function will change the currently equipped scope attachment.

Equip Random Muzzle:

Calling this function will change the currently equipped muzzle attachment.

Equip Random Grip:

Calling this function will change the currently equipped grip attachment.

Equip Random Laser:

Executing this function will change the currently equipped laser attachment.

Set Attachments Scale:

Sets the relative scale of all attachments.

Update Scope From Name:

Changes the scope attachment to the one with the input name.

Save Loadout:

Saves the current attachment names to a save game object.

Try Load Loadout:

Loads the attachments saved in the loadout save game.

Finalize Attachment Change:

This function is called after changing attachments to ensure their functionality is not compromised. Additionally, it randomizes the equipped skin. Keep this in mind when using the function.

Get Grip Parent:

Returns the grip attachment's parent.

Get Muzzle Parent:

Returns the muzzle attachment's parent.

Get Scope Parent:

Returns the scope attachment's parent.

Get Equipped Laser Mesh:

Returns the equipped laser’s mesh.

Spawn Drop Magazine:

The Spawn Drop Magazine function spawns a magazine, copying both the mesh and materials from the weapon it is spawned from, ensuring a perfect match and the appearance that it fell out naturally. Use this function to save time and effort when replicating magazine models for your game or project.

Update Attachment Physical Settings:

This method updates the physical settings for all equipped attachments. It's useful to have as a method, but it's not used in many instances.

Update Preset:

This function updates the weapon’s preset entirely to match whatever is passed to it.

Update Root Physical Settings:

This function updates the physical settings of the root Static Mesh component.


Last updated

Was this helpful?