RPG Skill Tree abilities

I have a skill tree with three buttons that when enabled, increase the player health by a certain amount. I have the T key designated now to open the skill tree, and a “close” button in the UI that closes the tree. The functionality for the skills works perfectly - when I click the skill, the designated amount of skill points are removed and the skill is enabled.

The issue that I am having is that when I close the skill tree and reopen it, the buttons are reset and are active again. My goal is to make them a one-time use so when they are pressed once, the skill is acquired and the button is no longer active no matter how many times the skill tree is opened/closed.

I have tried a branch that checks if the skill is activated or not. When the button is pressed, the IsSkillAcquired bool is set to true. That did not work.

I guess the best option would be to add some functionality that saved the actions made in the skill tree so that when it is closed and reopened, the active buttons are still active and cannot be clicked again.

I would appreciate any help or tips on this. Thanks!

You will need to save the state of the skill tree eventually. But also consider simply hiding your widget when not in use, rather than removing it from the parent and recreating it from scratch.

Ok I will try both of those. Thanks for the feedback.

I got a working solution for this issue. In my character blueprint, I set “T” to create the widget. I took the output of the create widget and made it into a variable. The exec and output from the new variable, named Skill Tree, connects to the add to viewport node. The last two nodes are Set Input Mode (UI Only) and Set Show Mouse Cursor (True). In the UI Skill Tree widget BP, I have a close button that when pressed, removes the widget from parent but I have the Skill Tree variable connected to the input of Remove From Parent. I end with Set Input Mode (Game Only) and Set Show Mouse Cursor (False). When the T button is pressed, the Skill Tree appears. I can click on the first skill, the skill is activated and a skill point is removed. I close the skill tree and then reopen, and the skill is still active. It works well so far.

You are (in my opinion) doing it wrong.
If I understand you correctly, your widget controls the SkillTree you are using, not the Character itself.

You should store the SkillTree itself in the Character and the widget just controls which skills you learn.
If you remove the Widget from the Character, your Character won’t have any skills.

Unbenannt.png

You seem to be doing it like this:
7ee2b9677e310c1f8047de5d947c489305219cfa.jpeg

I have attached screenshots from both the Character BP and UI Skill Tree BP.

If you press T, you are recreating another widget. If i am not wrong, remove from parent doesnt mean removal of the widget object from the game as it is still in existence. So if you need to get it back, just add it back to viewport of the player controller (or whatever that was the original parent of the widget).

The functionality in the images I attached is working as I need it to. The issue I had before was the changes made inside the skill tree were not being saved when the skill tree was closed. The changes are now saved in the variable so when it’s opened again, the changes I made are still there.

I’m still not clear how I’m doing it wrong. Should the skill tree command be placed in player controller rather than directly into the character BP?

Disregard previous posts and attached images. Still not working the way I need it to.

Got it working. I create all widgets (HUD, Skill Tree, etc) on event begin play. The SKill Tree is hidden by default. When input key is pressed, Skill Tree is set to visible. Input is pressed again, skill tree is set back to hidden. Changes made in skill tree remain when tree is opened again.

As I said earlier, you’re doing it wrong in some way.
The Widget contains your data. This is not the purpose of Widgets. They are just an interface to manipulate data.
Everyone their own way, but the Widgets are created at BeginPlay and set to hidden. The Getter-Functions of the Widgets are still called in the background and eating some tickfunctions.

I probably am doing it wrong - but this is the only way I have found so far that works.

I started out following a youtube tutorial, but I think the video for Saving Skill Tree cut out and skipped a section because his end result worked and mine didn’t. In the tutorial, the youtuber used the create widget node to draw the skill tree on screen when the input button was pressed. The menu pops up and the skill buttons are manipulated. The buttons are bound to functionality that increase player health one time. Then the skill tree is closed with “close” button. I’ll post the links to the tutorial videos I was watching when originally trying to get this to work.

Layout

Functionality

Additional Skills

Core Concept

Fixing Skill Tree Problem

Saving Skill Tree

Looks nice

https://greed.host/lol.jpg?v=2

I’ve got all of skills and the functionality for skills in the Character BP. When I display the skill tree on screen, I can interact with the skill tree. First tier button is clicked, button is disabled and next skill in line is made active. I close skill tree and when I reopen, the first tier button is active again. I think I am creating a new skill tree each time I press the input action button to display it and the disabled buttons are enabled again. What is the best way to keep the skill buttons from resetting each time the tree is closed and reopened?

Imo you need to think about whether you want to save this data for save/loading games and if so you should be saving and loading the data to a save file.