How to switch ability widget on/off depending on which character is possessed?
I am working on a multi-character RPG and I need to make it so depending on which character I am using, it will turn off other character's action widgets, but turn on its own action widget. Action abilities and the widget changes are held in parent character that other characters inherit from, but each character has its own ability WBP. I have turned off the WBP that the parent character uses, and I can turn on my "Shooter" and/or "Healer" character WBP, but I haven't figured out how to turn them off and on when the proper character is possessed. In the parent character, I thought about casting to the character as seen in the pic, but I either don't understand the cast, or that's not the way to do it. The Remove Widget pic may or may not be needed to understand whats going on, but I believe it is imperative and has no problem.
As a rehash, my goal here is to get the ability widgets to switch and stay with whatever its character is only when that is the current character.
PS, in order to get the widgets to disappear, I have used the system found in this forum post here:
Many thanks ahead of time.
asked Jun 12 '17 at 07:48 PM in Using UE4
So I solved my problem and this is how: 1.) I had to create a new action controller for each character that dictated AND created the widget for their own abilities. This eliminated the need for casting. I had to get the WBP reference, right click and check "convert to validated get" which was something I didnt know how to do at first. The ball was rolling from here. That way, the specific create widget node could reference itself. 2.) I also had to create an interface for each character dictating the hide/revealing of said characters own ability widget. Each character had to reference that specific interface and not the generic ability interface, which at the time I had to disconnect. (Note that the parent must NOT be connected to the child character's ability widget interface--otherwise they will interact with the wrong widget visibility) 3.) I also have a BP that dictates what happens when an action is taken, and that needed some work to prevent an "Accesssed None..." error. What I did here was check if the widget was valid before trying to remove the widget. This was critical to eliminating constant error feed of not checking before acting.
Thats about it! Hope it helps someone else, if not thats ok too. After spending two weeks being stuck, finishing it a day after posting works for me.
answered Jun 13 '17 at 08:42 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here