Jump to content
  • Advertisement
Sign in to follow this  
TruthsEdge

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

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

If you intended to correct an error in the post then please contact us.

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:

 

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

 

Share this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
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.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!