- Home /
Making in turn-based rpg in which characters can take turn ahead of time
I am current working on a strategy turn-based rpg (Ala Final Fantasy Tactics) and I would like to implement a system in which players (and enemies) can spend "Action Points" to take more than one turn at once. (Similar to Bravely Default) However, I am having trouble wrapping my head around the logic. Characters start with a set amount of AP and gain 1 AP every turn. Movement does not take AP only actions like attacking and using items. Strong abilities require more AP to use. If the character has negative AP then their turn is skipped. AP can be used all at once to allow the player to take the future turns in the present turn. For now lets call this Berserk mode. Berserk mode is a menu option in the battle menu. Activating it costs 1 AP and will cause another battle menu to be queued behind the active battle menu. Berserk mode can be activated a maximum of 3 times.
For example:
Player`s Turn***
Hero 1 (Arthur) has 4 out of 4 AP.
Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
Arthur MOVES 3 spaces.
Arthur ATTACKS Enemy A with a sword (-1 AP)
Arthur has 3 out of 4 AP.
Enemy`s Turn***
Enemy A has 4 out of 4 AP.
Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
Enemy A activates BERSERK MODE (-1 AP)
Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE*/END TURN)?
Enemy A MOVES 3 spaces.
Enemy A ATTACKS Arthur with a bow (-1 AP)
BERESERK MODE TURN*
Enemy A's Turn (MOVE/ATTACK/ITEM/BERSERK MODE*/END TURN)
"Can't move again unless a special ability is activated"
Enemy A ATTACKS Arthur with a bow (-1 AP)
Enemy A has 1 out of 4 AP
Player`s Turn *** (Heroes +1 AP)
Arthur has 4 out of 4 AP
Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
Arthur activates BERSERK MODE* (-1 AP)
Arthur activates BERSERK MODE** (-1 AP)
Arthur activates BERSERK MODE*** (-1 AP)
Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)? "Used Berserk Mode 3 times already"
Arthur moves 3 Spaces
Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
Arthur uses STRENGTH POTION (-1 AP)
BERESERK MODE TURN*
Arthur's Turn (MOVE/ATTACK/ITEM/BERSERK MODE/END TURN)?
Arthur ATTACKS Enemy A with a Sword (-1 AP)
BERESERK MODE TURN**
Arthur ATTACKS Enemy A with a FIREBALL (-1 AP)
BERESERK MODE TURN***
Arthur ATTACKS Enemy A with a SPECIAL ATTACK (-2 AP)
Arthur has -4 AP out of 4
Enemy`s Turn *** (Enemies +1 AP)
Enemy A`s Turn
***REPEAT OF LAST TIME***
Player`s Turn *** (Heroes +1 AP)
Arthur has -3 of 4 AP
Arthur has < 0 AP ** SKIPS TURN
Enemy`s Turn***
.............And so on.
What I am having trouble with is deciding how and where to implement this AP/Bereserk Mode. Right now I have turn order based on a characters speed stat. Characters can move, attack, and end turn. At the end of a characters turn they can select what direction they want to face.
What I believe I can do is: ** All in Csharp
Create an AP variable in the Character class
public int AP = 4;
In the Turn class check current characters AP
(if AP > 0){ CanTakeTurn = true;}
Then in the Action class check what actions are being taken, add and subtract character`s AP accordingly and override end turn method if necessary.
public int BerserkModeCounter = 0;
public void Attack(){
if(BerserkModeActive = true){ DealDamage(); CanTakeTurn = true; //Run the Turn method again? } else DealDamage(); EndTurn(); // CanTakeTurn = false; }
public void BerserkMode(){
AP - 1; BerserkModeCounter + 1;
if(BerserkModeCounter > 0){ BerserkModeActive = true; }
if(BerserkModeCounter >= 3){ BerserkModeMenuOption = disabled;} }
Am I on the right track? Because if feel like I am missing something. I haven`t begun to test this yet because I do not really know how to approach this properly. Maybe my Turn class is to rigid for this.
I would just let player queue actions when CanTakeTurn is true until players "accepts" (somewhat similar idea as VATS in Fallout 3). After accepting all queued attacks will happen and your turn ends. I think it should work just fine with both traditional turn-based and active time battle systems.