Hi; I am making a script that runs a line trace on event tick, and if it hits a certain class, then it will show a widget, and if it doesn’t hit that class, I don’t want the widget to be shown. I am doing this for a weapon pickup, so if you look at a weapon, you are able to pick it up, but if not, you are not able to pick it up and the widget goes away.
Here is the script I currently have. I do not have it set up so you can pick up the weapon if you look at it, but just so it shows the widget.
A problem I am running into is that if you move the camera off of the object (in between a tick), then the set visibility to hidden doesn’t work, and so it shows the widget until the line trace hits something else. I don’t really know how to fix this, and any advice would be great.
I was also wondering if someone could offer any advice on how I should setup the blueprints; for example, should I make the pickup system run through the character, or through the weapon? Before, I was having it run a custom event in the object if it hit the object, and that would show the widget. Would it be better to make the pickup system run through the weapons?
Finally, I am going to have multiple weapons that I am going to be creating. They are all children of one specific blueprint, but I do not know how to check if the hit actor is one of those children, and if it is a certain one, which widget to show (each widget shows a different name/image of the weapon). Would there be any way to make it so it just runs through one simple function, instead of having to make multiple branches to check which of the actors was hit?
I understand there is a lot of questions here, and they might be hard to understand. I really appreciate your help if you manage to answer one of the questions.
okay so im a noob but this is how i would do it man.
your first problem.
Q1) off of the first boolen (true/false) in stead of having nothing at the false put your set visibility to that one. it should work like that
Q2) i personal have the pickup system run in my player character
Q3) okay so this one gets a little more complicated. so i am assuming you have made a structure to reference in your “weaponMaster” which should have a list of details such as static mesh, name, and other stuff. you then need to turn it into an array within your “weaponMaster” and then when you reference it. you just need to loop through the array to find the weapon.
i have explained every badly sorry about that but if check out these videos and they should get you an idea how to do your “WeaponMaster”
this video should give you a rough idea how to do it hopefully if not give me a message and ill try to help more in depth