How do I create a weapon switching/swapping system (i.e. the player has more than one weapon and can switch between them)? I am not sure where exactly to start and YouTube nor google seem to know what I am talking about. Any ideas?
Try this example, it might help a bit c:Weapon Equip System 2.0 - YouTube not a tut, yet if you need to, it’s available in the marketplace
Marketplace
Is there a tutorial though?
No, afaik, sorry
www.shootertutorial.com - I’ve done exactly what you are looking for.
I was looking at your tutorial on creating an inventory (Database Error) but the GetGameInstance function (https://shootertutorial.files.wordpress.com/2015/06/returngameinstance.jpg) you made in the tutorial won’t ever return anything nor will it hook up to the set backpack weapons in this graph (far right) https://shootertutorial.files.wordpress.com/2015/06/itemconstruct.jpg
are you sure you have ShooterGameInstance added as GameInstance in Project Settings?
Yes. I did change the name as I already had a game instance but that should not affect anything. I get the note that the node path doesn’t end with a return node (yet i copied your graph exactly). When I try to connect the custom GetGameInstance function to the get Backpack Weapons it says that the Game Reference is not compatable with My Game Instance Reference.
Are you able just Get Game Instance (not custom node but UE4 node) and cast it to ShooterGameInstance? It will still get null? If yes there and you are sure that ShooterGameInstance is selected in Project Setting there might be issue with GameInstances in UE4. Then you should post it on answer hub.
Try to create new game instance class -> assign it to game instance in project setting -> check if you can get reference to it.
The Backpack Weapons apparently has an invalid target. Otherwise it does connect.
http://dl.markyrosongaming.ar.nf/2015-07-24_0925.png
Too bad you don’t have your tutorial UE project available for download but I understand your reluctance to do something like that but would help in scenarios like this where it does not work. Anyways, back to the matter at hand.
Do you have variable BackpackWeapons in MyGameInstance?
You can download my blueprints here: Dropbox - Blueprints.rar - Simplify your life
yes i do and I will look at your blueprints
EDIT: This is the message I get when I try to import your game instance
http://dl.markyrosongaming.ar.nf/2015-07-24_1224.png
Unreal really does not like your sniper rifle blueprint in particular and they are broken in my project as well. I am going to create a new project and try them there I guess. When I hit ‘play’ and say yes to ignoring the sniper rifle error I cannot get any UI to appear
What version of unreal did you build the project in? I will download that version and try.
ShooterGameInstance was created on 8.1 and normally converted to 8.2. As I can see UE from this error message: it cannot find Structures. Try to make variables from them again in ShooterGameInstance.
What types of variables are the Ammo Conventional and Ammo Grenades Conventional?
I glanced at your website, looks like some good information there… Thanks!
I tried it in a new project and it did not generate the same errors however the player does not have any movement controls. I tried to add them only to have it not work properly (player can only go in a straight line without turning etc). The sniper rifle blueprint still has the same error as before. The inventory system also generates errors around the weapons.
They are AmmoType structure mentioned here: Database Error
please see by previous post
Markyrson - try to read the tutorials carefully.
- They aren’t focused on movement. Game is about looking around and shooting. You could add movement from shooter starter without a problem,
- There were people having the same issue with Game Instance and they found out that if they move step by step with tutorial everything works correctly,
- You can’t just copy my blueprints and expect everything will work - they are for you as reference because I have lot of other stuff going on there with assets that you don’t have,
Almost in every post I’m writing that making games take time and it isn’t easy - you need to invest your time to learn, debug and learn again. Weapons switching was implemented in GameplayCharacter and it’s good starting point on how you could create your own implementation. Take your time and try to figure this out.
I followed the tutorials to the letter and get to the weapon basics without issue however, after following the tutorials to the letter this is the result I get when I equip the assault rifle. For some reason it is flipped and facing the wrong way however it fires in the right direction(How is that possible?). In the animation preview window it looks normal yet it apparently is not according to when actually playing. I tried to correct it a few ways but they do not change what happens when I press ‘play’ and load the game. Any idea what the issue might be and how to solve it? Continuing to look into it now and will edit this if i manage to solve it.