Creating Skill Trees / Actions

So I’m making a turn-based RPG-like game and I’m looking for a jumping off point. The part that throws me off with GDevelop is that I want to make it so that after a player completes a stage, they get a choice of a random set of actions (could be single-target attacks, multiple target attacks, healing, buffs and debuffs) and they have a total of 6 available to them so eventually they would be replacing some of those actions.

I can get GDevelop to execute the actions but the part that throws me is that there aren’t any functions so that you can just refer to a function and the code executes it. The only thing I can think of is creating a global variable that lists all of the possible actions and a player variable of what actions they have access to and just code in every single possible action into when they activate so every level knows what to do when that action is selected but that FEELS redundant and not the smartest, most optimized way.

Any insight would be great to figure this out and not feel the need to hard code streamline what each character can do in any given encounter.

Thanks!

Maybe show your events, so it is easier to understand what you want.
From what I am reading, you are looking for a way to dynamically change some variables to influence your events. That is possible using Structures (or Arrays).

So something like:

Structure Variable: CurrentActions[Option1...6]
Variables that controls your action: Option1 - Option6
So whenever you change the value of OptionX, the Structure behaves accordingly.

Is that anywhere close to your issue?

Here is an example of what I’m doing in terms of the actions.

So for example, a character could have access to Smack / Uppercut / Dodge / Duck / Distract / Fly. And then at the end of the stage, they get a choice of Fireball or Icefall to replace once of the actions above.

Right now I am using arrays to collect the actions. I execute the actions by if the ChosenAction variable equals to the number corresponding to the action, then it executes the series of actions you see in the screenshot. Over the course of the game, a character could have 50+ possible actions, so unless I write all 50 for every single stage, I’m not sure how to give the player a choice of Fireball and Iceball when the next stage won’t know which one the player chose and neither will I to make sure the code is present in that stage.

First off, have a look at the Object Stack Extension. That could serve you well.

So your Actions are in an Array. From my perspective I would create a Structure that holds your selected 6 options and when each option is picked you allow the player to switch one option with a one that is still left in your array. The one you swap back needs to go back to the array then. Array Tools is another good extension for this, if you need advanced array manimulation.

1 Like

This Object Stack Extension may really help streamline both the generation of actions in an encounter as well as pulling actions from the choices of actions to update. I’ll need to research this one a little closer in its execution. Thank you for this avenue to go down.

I guess the question is more asking is the actual execution of the action. If I don’t know which 6 options out of 50 the player is going to have access to in a stage, do I just code all 50 options in every encounter just in case or is there a more optimized way to house the 50 options and what actions are executed when one of them is chosen?

From your snippet, you have a lot of similar events. If you created a structure with the actions as structures then you could use the action name to get the various parameters like animation, sound and wait times. You could also use booleans or other types to denote what type of action it was. It could be categorizes or types like attack or defense. Whatever might apply.

Here’s how I tested the concept.

I used 3 copies of the same button object and a sprite for the player. I used simple animations that just used the first letter of the action.

You can setup the buttons at design time or through action. I added an ActionName variable to the button in case the action name was more than 1 word. You can’t have spaces in child names so the name could be 2 words while the structure name was just 1 word.

These are the scene variables. I used just 3 actions. Once you create 1 structure, you just copy and paste it. I used a array of the actions because it’s easier to lick items from an array. The array can be created automatically at runtime with a few events. The variable R is only used to hold a random number and Action holds the action.

These are the events. The first part sets up the buttons. I used random. You can load from storage or use a seperate array with the default names. In that case, it might be easier to use a repeat for each child.

You can’t play sounds by name without an extension. I created a fake action just to demonstrate it. The action could contain a function to play the sound by name using Javascript or it could be a bunch of seperate events that play a sound based on the value of a variable or parameter.

You could group similar actions together inside an OR by name or by type like attack or defend. You could also have solo items if the action was extremely different. You could also use multiple events. So, this would trigger the common events and other event group could trigger unique actions. The event itself could check for a value or boolean and do additional things depending on the value.

This is just 1 way out of infinite ways to do it.

1 Like

This looks amazing. I think I need to sit with this when family isn’t around to wrap my head through the logical paths but a lot of this makes a ton of sense. This actually answers what would have been my next question of how I can execute the actions through structures which a lot of people told me but never could communicate the execution. Something to really play around with.

1 Like