When is it my turn? - RPG Turn Order question

First, here are the screenshots showing the BattleUI buttons and the programming behind the “Attack” button.

Right now, this is all there is under the EndTurn function, which is on the player character BP.

Though I just tested and the widget seems to appear and disappear only when called. But I could have sworn that widget would stack on top of itself. It might be because there’s only one enemy and one player character and I once had two enemies. I’m just not sure how to make this work for multiple characters in the same battle sequence.

so its working?

some good practice tips.

  1. RemoveFromParent last, while this likely works because garbage collection isnt instant, if you think about it logically you’re destroying the widget before calling the attack function.
  2. PlayerTurn false makes sense to be inside the EndTurn function.

this shouldnt happen if its created in BeginTurn and only one unit is ever active

It works with just one player character and one enemy character, so far. I’m just not sure how to get the program to work properly with multiple characters. The demo will have one party member and battles will have up to five enemies.

it shouldnt be an issue, you dont even need the widget for enemies. if youre using a parent class for players/enemies just override the player BeginTurn to add the widget.

Right. I want it to only appear when it’s a party member’s turn. So I should just move the Remove from Parent and Set PlayerTurn nodes as you specified?

What would you suggest I add when I have more than one party member and/or one enemy to make sure the widget only appears when called?

Also, I made the changes as you suggested.

you can either have the function/interface on the unitbase, for playerunit override function to add widget, for AI unit do nothing.

or put a bool on the unit, bIsPlayer and use that if you want to handle the widget elsewhere.

both are fine it just depends on the structure of your game

You mean make a newer override function controlling the player BP from the base BP?

assuming thats how you’re setup, i have to make guesses about your project.

(post deleted by author)

I’m not really sure how to explain it any better, so I can either send you screenshots of each relevant BP and attributes like functions and variables on screenshots via PM.

is anything not working? if so try to debug it with printstrings/breakpoints and if you get stuck send a picture that is specific to the problem.

It’s working fine. I’m just not sure how to set it to work with multiple party members and enemies in the same battle sequence.

your setup is there, you have an array of units sorted by speed.

when one unit ends turn get the next one and start turn. this creates a loop of actions.

you can monitor ‘rounds’ by when you get to the last index if you want to.

there are also a few tutorials on Turn Based RPGs on youtube

Can you point me to any ones most relevant, please?