Announcement

Collapse
No announcement yet.

UE4 Fps template: How do I make a weapon switching system?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    UE4 Fps template: How do I make a weapon switching system?

    Hello, I am trying to make a FPS game in the Unreal engine 4 and I am stuck on how to make a weapon switching system that allows you to collect weapons and be able to switch between them in combat. (Like Half-Lifes weapon system) I have tried many tutorials on how to do this but all of them do not fit what I wanted to do and if any one has an idea on how to do something like this please let me know! Thank you!

    #2
    You could create an "ActiveWeapon" variable for your player, and perhaps an array / list (map even, to store ammo?) of their current weapons and go from there

    Comment


      #3
      You want to learn more about blueprint systems in general. You want to think about your system like a list of features and you'll have to think about how to setup such features. Maybe combine several tutorials and your knowledge to build these features one by one.

      Your feature list could look like this:
      - a weapon being displayed on the FPS mesh
      - different ability to shoot based on the weapon equipped
      - the ability to switch from a weapon to another
      - the ability to display the list of weapons
      - the ability to display the current weapon and its ammo
      - weapons should have ammo and a reload function

      Lots of different systems and setups can lead you to this. What path you choose depends on the rest of your game.

      To give you a simple lead: I would create a Weapon Actor, a Weapon List Widget and a Current Weapon Widget (in addition to the Player Character obviously).

      Weapons can be interacted with. It has a reference to a class of Weapon Actor.
      When picked up, it is added as reference to an array of Weapon contained in the Player Character.
      All weapons in the list are not visible. They are all attached to the right socket on the Third Person mesh of the Player Character.
      It tells the Widget List to add a weapon there.
      It automatically equips the new weapon and is added as a reference in a variable of the Player Character (Current Weapon).
      It tells the Widget Current Weapon to switch to that weapon. The Current Weapon is made visible.
      Weapon Actors would have different shoot behaviors.
      When Character presses left mouse button, it triggers the shoot behavior of his Current Weapon.
      When wheel scrolling, it switches Current Weapon from a weapon to another contained within the array in the Player Character.
      It tells the Widget Current Weapon to reflect that.

      Etc.

      Quote me if you want more details.
      [Released] Multiplayer Combat Editor
      A-RPG Sacred Swords
      Youtube Tutorials

      Comment


        #4
        Originally posted by Yun-Kun View Post
        You want to learn more about blueprint systems in general. You want to think about your system like a list of features and you'll have to think about how to setup such features. Maybe combine several tutorials and your knowledge to build these features one by one.

        Your feature list could look like this:
        - a weapon being displayed on the FPS mesh
        - different ability to shoot based on the weapon equipped
        - the ability to switch from a weapon to another
        - the ability to display the list of weapons
        - the ability to display the current weapon and its ammo
        - weapons should have ammo and a reload function

        Lots of different systems and setups can lead you to this. What path you choose depends on the rest of your game.

        To give you a simple lead: I would create a Weapon Actor, a Weapon List Widget and a Current Weapon Widget (in addition to the Player Character obviously).

        Weapons can be interacted with. It has a reference to a class of Weapon Actor.
        When picked up, it is added as reference to an array of Weapon contained in the Player Character.
        All weapons in the list are not visible. They are all attached to the right socket on the Third Person mesh of the Player Character.
        It tells the Widget List to add a weapon there.
        It automatically equips the new weapon and is added as a reference in a variable of the Player Character (Current Weapon).
        It tells the Widget Current Weapon to switch to that weapon. The Current Weapon is made visible.
        Weapon Actors would have different shoot behaviors.
        When Character presses left mouse button, it triggers the shoot behavior of his Current Weapon.
        When wheel scrolling, it switches Current Weapon from a weapon to another contained within the array in the Player Character.
        It tells the Widget Current Weapon to reflect that.

        Etc.

        Quote me if you want more details.
        Hey sorry that i haven't responded to you (i moved last month and i havent really had time to work on anything) but i would like too know more. Thank you.

        Comment

        Working...
        X