• 9
• 10
• 10
• 11
• 17

# Making in turn-based rpg in which characters can take turn ahead of time

This topic is 431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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:

Players 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.

Enemys 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

Players 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

Enemys Turn *** (Enemies +1 AP)
Enemy As Turn
***REPEAT OF LAST TIME***

Players Turn *** (Heroes +1 AP)
Arthur has -3 of 4 AP
Arthur has < 0 AP *** SKIPS TURN

Enemys 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 C Sharp

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 characters 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){
}

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.

##### Share on other sites

This is more of a programming question than anything else, I'd recommend moving the topic to either the Game or General Programming tabs of the Technical Forum section.

##### Share on other sites

It looks like the berserk counter should just be in the Turn class.

• If you choose Berserk during a Character's Turn, increment the counter in the Turn.
• If the counter is zero when you finish executing an Action, the turn ends.
• If the counter is greater than zero when you finish executing an action, decrement the counter and choose another Action.

(Also, moving to Game Programming.)