Announcement

Collapse
No announcement yet.

How do I use a Weapon functionality when picked up by the player?

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

  • replied
    Cheers Aaron.

    I resolved this by simply enabling Auto Receive Input = Player 0

    Leave a comment:


  • replied
    I am currently working on an Inventory System with equip-able items. This is how I have approached the situation so far:
    1. I have a base item blueprint, and use polymorphism/Inheritance for all my items. So I have a base Weapon blueprint that inherits off of my base item blueprint
    2. All my base items/weapons ect all use my custom blueprint interface which has interface functions like: DropItem, EquipItem, UnEquip Item etc
    3. In all my base blueprints that inherit from my base item blueprint, I implement all the interface functions, making sure to add a call to parent
    4. I have all my functionality inside my base item, so when you pickup an item, it will call the implemented interface function
    There are a few ways to go about equipping items, so I've found out in my post https://forums.unrealengine.com/deve...hysics-enabled I have a working version, that when you call AttachToComponent on the players skeletal mesh, it will attach the item to the socket described.

    As for making your weapon blueprint catch the shoot event, the simplest way I would do this is in your player character blueprint, and the fire Input event and call a new interface function called fire, with all your logic inside the weapon class.

    Interface
    Click image for larger version

Name:	Help1.png
Views:	80
Size:	22.3 KB
ID:	1709162

    Implement interface in class settings in your Weapon item blueprint
    Click image for larger version

Name:	HelpInterfaces.png
Views:	38
Size:	113.0 KB
ID:	1709163
    In the player blueprint, listen for the Fire action key pressed, then call our interface function. You will have to pass in the weapon that is currently equipped. Note: You want to call the interface function that has (message) in the context menu
    Click image for larger version

Name:	HelpPlayer.png
Views:	38
Size:	39.4 KB
ID:	1709164

    I keep all my logic inside my base item blueprint. If I want to do something special on a particular type of item, I would add it to say Base Weapons interface function, then call the parents function when I was done with my item specific logic.
    Click image for larger version

Name:	HelpLogic.png
Views:	39
Size:	55.8 KB
ID:	1709165

    Leave a comment:


  • How do I use a Weapon functionality when picked up by the player?

    I'm a novice.... I want my player to be able to pickup a weapon. The weapon could be a melee or ranged weapon, whateva, but each has unique function... Anyways, the player is wielding the weapon. I want to place all the firing mechanism, ballistics etc, inside the weapon blueprint and not the character blueprint. How do I make my weapon blueprint catch the Shoot Input event? I'm sure this must be really simple but not sure which topic to look into.
Working...
X