x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Shooter weapon inventory array setup

I'm looking to make a simple inventory system for my FPS that I'm working on, so at the start of the match, a player chooses a primary weapon, and the secondary is always a handgun, it can't be modified. However, I also want to have the option for the player to pick up special weapons in the game, such as a flamethrower, or launcher, which would mean that they would need another slot. From looking at the ShooterGame example it looks like creating an array BP would be the best option, but I have two questions-

  1. In my Character BP, I'm referencing the fire function of the specific weapon I'm using, and I have an if statement to change the spawned weapon, and fire function to the secondary, when the swap weapon button is pressed. The problem with this is that it only can reference two specific weapons, and I would like to be able to simply say, "when the swap button is pressed, spawn a new active weapon, and use the function of that active weapon"- so it could be any of the weapons, all with their own different functions, just like ShooterGame does. Any idea on how to achieve this? Basically I want to be able to make a generic spawn actor and a generic function for firing which are automatically filled depending on the weapon you have selected, as opposed to spawning a specific weapon BP.

  2. Assuming I got question 1 working, I would have a selectable primary weapon that swaps to a fixed secondary weapon, but then if I picked up a special weapon in game such as a launcher, how would I then add that to my inventory, and call that specific weapon BP?

Thanks

Product Version: Not Selected
Tags:
more ▼

asked Dec 30 '14 at 06:54 PM in Blueprint Scripting

avatar image

EoinOBroin
111 31 25 31

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I've decided to go for a simple flip flop approach (Primary/Secondary), and then spawning special weapons with another key, so all good!

more ▼

answered Jan 06 '15 at 09:17 PM

avatar image

EoinOBroin
111 31 25 31

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Can you tell me how you did it? I'm a bit of a newbie but your system sounds great, what exactly is the blueprint required? Thanks!

more ▼

answered Aug 29 '15 at 08:26 AM

avatar image

AlfieLC
44 7 7 12

avatar image EoinOBroin Sep 21 '15 at 10:33 PM

It's all about destroying the currently spawned actor, and attaching a new one to the hand socket of the character mesh. The flip flop determines which weapon is currently equipped, and will go back and forth from primary to secondary!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question