When is it my turn? - RPG Turn Order question

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.

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?

sorry forgot to reply, this guy is doing one now, not sure how relevant it is to you

That’s actually closer to what I’m looking for! I’ll check out the rest of the playlist and see what I can find there, too. Thanks again for your help and for your patience too.

1 Like

After going over the tutorials - and pushing myself to keep going - I have most of the RPG battle mechanics finished. But I will need someone to look over what I have to make sure there’s nothing wrong. Also, I’m not quite sure how to get the game to initialize a battle if the BP_BattleScene is an actor.